Expand description
Primary-side replication source — bounded backlog of recent mutations, indexed by monotonic offset.
Behaviour at a glance:
ReplicationSource::push_mutationis called on every applied write. It assigns the next monotonic offset, encodes the frame withcrate::wire::encode_frame, and appends to the backlog.- The backlog is bounded by a byte budget (
max_bytes, fed from[replication]replication_buffer_sizein config). When a new frame would exceed the budget, the oldest frames are dropped to make room. - Replicas that disconnect and reconnect within the backlog window
resume via
ReplicationSource::frames_from. Replicas that fall off the back of the buffer getErr(FromOffset::TooOld)and the caller initiates a full snapshot ship.
The source does not know about replicas — slot tracking lives
in crate::slot::SlotTable. The source is a passive structure
the streaming loop reads; mutation/serialisation lock policy is the
wiring layer’s concern.
Structs§
- Frame
- One encoded mutation frame parked in the backlog.
- Frames
Iter - Iterator over backlog frames returned by
ReplicationSource::frames_from. - Replication
Source - Bounded backlog of recent replicated mutations.
Enums§
- From
Offset - Reason
ReplicationSource::frames_fromcannot serve a replica from the backlog.