Crate fedimint_eventlog

Source
Expand description

Client Event Log

The goal here is to maintain a single, ordered, append only log of all important client-side events: low or high level, and move as much of coordination between different parts of the system in a natural and decomposed way.

Any event log “follower” can just keep going through all events and react to ones it is interested in (and understands), potentially emitting events of its own, and atomically updating persisted event log position (“cursor”) of events that were already processed.

Structs§

EventKind
EventLogEntry
EventLogId
Ordered, contiguous ID space, which is easy for event log followers to track.
EventLogIdPrefix
EventLogIdPrefixAll
PersistedLogEntry
Struct used for processing log entries after they have been persisted.
UnordedEventLogId
A self-allocated ID that is mostly ordered
UnorderedEventLogEntry
UnorderedEventLogIdPrefixAll

Constants§

DB_KEY_PREFIX_EVENT_LOG
DB_KEY_PREFIX_UNORDERED_EVENT_LOG
DB prefixes hardcoded for use of the event log fedimint-eventlog was extracted from fedimint-client to help include/re-use in other part of the code. But fundamentally its role is to implement event log in the client. There is currently no way to inject the prefixes to use for db records, so we use these constants to keep them in sync. Any other app that will want to store its own even log, will need to use the exact same prefixes, which in practice should not be a problem.

Statics§

UNORDEREDED_EVENT_LOG_ID_COUNTER 🔒
An counter that resets on every restart, that guarantees that UnordedEventLogIds don’t conflict with each other.

Traits§

DBTransactionEventLogExt
Event

Functions§

handle_events
run_event_log_ordering_task
The code that handles new unordered events and rewriters them fully ordered into the final event log.