Skip to main content

Module sync

Module sync 

Source
Expand description

Synchronization lifecycle of one subscribed book.

BookSync holds the state an adapter tracks per book: its phase, the time of its last accepted frame, a pending snapshot wait, and its recovery episode. It performs no I/O and takes &mut self, so an adapter keeps it under its existing state lock or owning task.

§Sync Contract

  • Output happens only in BookPhase::Synced, which starts with an accepted snapshot.
  • A book out of sync needs an owner: a running recovery or an armed snapshot deadline. BookSync::gap returns BookSequenceOutcome::Recover when it has neither, and the adapter then claims a recovery once it has what the replacement needs.
  • The adapter passes every incremental update for an unsynced book through BookSync::gap, so a book whose recovery could not start asks again on its next update.
  • BookSync::stale reports a book that stops advancing without a running recovery.

§Adapters

The adapter keeps its venue sequence rule, wire commands, snapshot parsing, and buffers, and stores the venue position of the last accepted frame as P.

Structs§

BookSync
Synchronization state of one subscribed book.

Enums§

BookPhase
Synchronization phase of one book.