pub struct ReplicationQueue { /* private fields */ }Expand description
In-memory replication queue. Retains ops from first_lsn to highest_lsn. Ops are GC’d when all configured secondaries have ACKed them.
This serves the same role as SF’s ReplicationQueueManager — it bridges the gap between the copy stream (committed state) and live replication (new ops) by retaining in-flight ops that can be replayed to new replicas.
Implementations§
Source§impl ReplicationQueue
impl ReplicationQueue
pub fn new() -> Self
Sourcepub fn push(&mut self, lsn: Lsn, data: Bytes)
pub fn push(&mut self, lsn: Lsn, data: Bytes)
Append a new op. Called from the data path on every replicate.
Sourcepub fn ops_from(&self, from_lsn: Lsn) -> Vec<(Lsn, Bytes)>
pub fn ops_from(&self, from_lsn: Lsn) -> Vec<(Lsn, Bytes)>
Get all ops from from_lsn onward (inclusive).
Used at add_secondary time to replay pending ops to a new replica.
Sourcepub fn gc(&mut self, acked_lsn: Lsn)
pub fn gc(&mut self, acked_lsn: Lsn)
Remove all ops with LSN <= acked_lsn.
Called when the minimum ACKed LSN across all secondaries advances.
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ReplicationQueue
impl RefUnwindSafe for ReplicationQueue
impl Send for ReplicationQueue
impl Sync for ReplicationQueue
impl Unpin for ReplicationQueue
impl UnsafeUnpin for ReplicationQueue
impl UnwindSafe for ReplicationQueue
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request