pub struct WalShipper { /* private fields */ }Expand description
WAL Shipper manages the replication TCP server and follower connections.
Implementations§
Source§impl WalShipper
impl WalShipper
Sourcepub fn new() -> (Self, Sender<WALEntry>)
pub fn new() -> (Self, Sender<WALEntry>)
Create a new WAL shipper. Returns the shipper and a broadcast sender that should be given to the WAL for publishing new entries.
Sourcepub fn set_replication_mode(
&mut self,
mode: ReplicationMode,
ack_timeout: Duration,
)
pub fn set_replication_mode( &mut self, mode: ReplicationMode, ack_timeout: Duration, )
Set the replication mode and ACK timeout.
Sourcepub fn replication_mode(&self) -> ReplicationMode
pub fn replication_mode(&self) -> ReplicationMode
Get the current replication mode.
Sourcepub fn current_leader_offset(&self) -> u64
pub fn current_leader_offset(&self) -> u64
Get the current leader WAL offset.
Sourcepub async fn wait_for_ack(&self, target_offset: u64) -> bool
pub async fn wait_for_ack(&self, target_offset: u64) -> bool
Wait for follower ACK(s) up to the given WAL offset.
Behavior depends on replication mode:
- Async: returns immediately.
- SemiSync: waits until at least 1 follower has ACKed
target_offset, or the timeout expires (returnstrueon success,falseon timeout). - Sync: waits until ALL connected followers have ACKed
target_offset, or the timeout expires.
Sourcepub fn set_metrics(&mut self, metrics: Arc<MetricsRegistry>)
pub fn set_metrics(&mut self, metrics: Arc<MetricsRegistry>)
Set the Prometheus metrics registry for replication metrics.
Sourcepub fn set_store(&mut self, store: Arc<EventStore>)
pub fn set_store(&mut self, store: Arc<EventStore>)
Attach the EventStore reference for catch-up protocol support.
When set, the shipper can stream Parquet snapshot files to followers
that are too far behind for WAL-only catch-up. Must be called before
serve().
Sourcepub fn status(&self) -> ReplicationStatus
pub fn status(&self) -> ReplicationStatus
Get current replication status for the health endpoint.
Auto Trait Implementations§
impl Freeze for WalShipper
impl !RefUnwindSafe for WalShipper
impl Send for WalShipper
impl Sync for WalShipper
impl Unpin for WalShipper
impl !UnwindSafe for WalShipper
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