pub struct CdcLog { /* private fields */ }Expand description
The core CDC log — a ring buffer of events with subscriber notification.
Implementations§
Source§impl CdcLog
impl CdcLog
Sourcepub fn emit(&self, events: Vec<CdcEvent>)
pub fn emit(&self, events: Vec<CdcEvent>)
Emit a batch of CDC events (typically one per row in a transaction).
This is called from the commit path after WAL flush + group commit. Must be fast — no I/O, no allocations on the hot path (beyond the ring buffer push).
Sourcepub fn next_sequence(&self) -> u64
pub fn next_sequence(&self) -> u64
Allocate the next sequence number.
Sourcepub fn current_sequence(&self) -> u64
pub fn current_sequence(&self) -> u64
Get the current (latest) sequence number.
Sourcepub fn read_from(
&self,
from_seq: u64,
max_events: usize,
) -> CdcResult<Vec<CdcEvent>>
pub fn read_from( &self, from_seq: u64, max_events: usize, ) -> CdcResult<Vec<CdcEvent>>
Read events starting from from_seq (inclusive).
Returns up to max_events events. If from_seq has been evicted
from the ring buffer, returns CdcError::Overrun.
Sourcepub fn wait_for_events(
&self,
after_seq: u64,
max_events: usize,
timeout: Duration,
) -> CdcResult<Vec<CdcEvent>>
pub fn wait_for_events( &self, after_seq: u64, max_events: usize, timeout: Duration, ) -> CdcResult<Vec<CdcEvent>>
Wait for new events after after_seq, with timeout.
Returns events with sequence > after_seq, blocking until at least
one event is available or the timeout expires.
Sourcepub fn oldest_sequence(&self) -> u64
pub fn oldest_sequence(&self) -> u64
Get the oldest available sequence number (or 0 if empty).
Auto Trait Implementations§
impl !Freeze for CdcLog
impl RefUnwindSafe for CdcLog
impl Send for CdcLog
impl Sync for CdcLog
impl Unpin for CdcLog
impl UnsafeUnpin for CdcLog
impl UnwindSafe for CdcLog
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more