Skip to main content

Module snapshot

Module snapshot 

Source
Expand description

Subscription write gates and pending snapshot lifetimes.

  • SnapshotGate prevents snapshot acceptance while a replacement subscription is being sent.
  • PendingSnapshot owns the cancellation token, gate, and optional deadline for a pending snapshot. Removing it cancels the associated wait.
  • snapshot_expired waits for a snapshot deadline or cancellation. A zero timeout disables monitoring.

§Snapshot Lifecycle

Gates start open. The adapter closes a gate before a guarded write and opens it only after the intended connection confirms that write. Snapshot acceptance checks the gate under its lock.

An adapter can keep an absolute deadline for monitoring or await snapshot_expired after write confirmation. Accepting a snapshot or retiring its subscription drops the pending owner, cancelling obsolete work.

§Adapters

The adapter verifies sequence validity and any subscription-generation correlation. The gate alone cannot identify which request or connection produced a snapshot.

Scheduling waits and starting recovery remain adapter responsibilities.

Structs§

PendingSnapshot
Pending snapshot ownership, cancelled on acceptance, replacement, or removal.
SnapshotGate
Coordinates subscription sends with snapshot acceptance.
SnapshotGateGuard
Locked snapshot acceptance gate.

Functions§

snapshot_expired
Returns whether the snapshot deadline expires before cancellation.