Skip to main content

Module delta_buffer

Module delta_buffer 

Source
Expand description

Delta buffering for sync scenarios (Invariant I6).

When a snapshot sync is in progress, incoming deltas are buffered so they can be replayed after the snapshot completes. This ensures that:

  1. Deltas arriving during sync aren’t lost (Invariant I6 - Liveness Guarantee)
  2. Event handlers can execute for buffered deltas after context is initialized

§Delivery Contract

  • Buffer size: Configurable, default 10,000 deltas per context
  • Drop policy: Oldest-first when buffer full (with metric increment)
  • Backpressure: None (fire-and-forget from network layer)
  • Metrics: drops counter MUST be observable

§Minimum Capacity Warning

If buffer capacity is set below MIN_RECOMMENDED_CAPACITY, a warning should be logged at startup. Zero capacity is valid but will drop ALL deltas.

Structs§

BufferedDelta
A single buffered delta.
DeltaBuffer
Buffer for storing deltas during snapshot sync.

Enums§

PushResult
Result of pushing a delta to the buffer.

Constants§

DEFAULT_BUFFER_CAPACITY
Default buffer capacity (10,000 deltas per context).
MIN_RECOMMENDED_CAPACITY
Minimum recommended buffer capacity.