pub struct CdcRing { /* private fields */ }Expand description
Fixed-capacity circular buffer for CDC events.
Events are appended with push and assigned a
monotonically increasing sequence number. When the buffer is full the
oldest slot is silently overwritten. Consumers read batches via
read and are informed through
CdcReadResult::gap when events they have not yet consumed were
evicted.
Implementations§
Source§impl CdcRing
impl CdcRing
Sourcepub fn push(
&mut self,
op: CdcOp,
key: Vec<u8>,
value: Option<Vec<u8>>,
timestamp_ms: u64,
)
pub fn push( &mut self, op: CdcOp, key: Vec<u8>, value: Option<Vec<u8>>, timestamp_ms: u64, )
Append a mutation event to the ring, assigning it the next sequence number.
If the buffer is full the oldest event is overwritten and
start_seq advances accordingly.
Sourcepub fn write_seq(&self) -> u64
pub fn write_seq(&self) -> u64
Return the sequence number that will be assigned to the next pushed event.
Sourcepub fn start_seq(&self) -> u64
pub fn start_seq(&self) -> u64
Return the earliest sequence number still available in the buffer.
Sourcepub fn read(&self, from_seq: u64, limit: usize) -> CdcReadResult
pub fn read(&self, from_seq: u64, limit: usize) -> CdcReadResult
Read up to limit events starting at from_seq.
If from_seq has already been evicted the read begins at the
earliest available sequence and CdcReadResult::gap is set to
true, signalling that the consumer missed events.