pub struct ReplicationFollower { /* private fields */ }Expand description
A replication follower that polls a leader’s /wal/stream endpoint and
applies WAL records to a local database directory via SharedWal::replay.
Usage:
use mongreldb_client::ReplicationFollower;
let mut follower = ReplicationFollower::new("http://leader:8453", "/local/copy")?;
follower.sync(); // fetches and applies all new records since last syncImplementations§
Source§impl ReplicationFollower
impl ReplicationFollower
Sourcepub fn new(leader_url: &str, local_path: impl AsRef<Path>) -> ClientResult<Self>
pub fn new(leader_url: &str, local_path: impl AsRef<Path>) -> ClientResult<Self>
Create a follower. leader_url is the daemon base URL; local_path is
the local database directory to sync into.
pub fn with_bearer_token(self, token: impl Into<String>) -> Self
pub fn with_basic_auth( self, username: impl Into<String>, password: impl Into<String>, ) -> Self
pub fn with_local_encryption_passphrase( self, passphrase: impl Into<String>, ) -> Self
pub fn with_local_credentials( self, username: impl Into<String>, password: impl Into<String>, ) -> Self
Sourcepub fn sync(&mut self) -> Result<usize, String>
pub fn sync(&mut self) -> Result<usize, String>
Bootstrap when needed, fetch complete committed transactions, append them durably, recover the local database, then advance the watermark.
pub fn bootstrap(&mut self) -> Result<(), String>
Sourcepub fn last_epoch(&self) -> u64
pub fn last_epoch(&self) -> u64
The highest leader commit epoch applied so far.
Sourcepub fn last_seq(&self) -> u64
pub fn last_seq(&self) -> u64
Backward-compatible alias for Self::last_epoch.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ReplicationFollower
impl !UnwindSafe for ReplicationFollower
impl Freeze for ReplicationFollower
impl Send for ReplicationFollower
impl Sync for ReplicationFollower
impl Unpin for ReplicationFollower
impl UnsafeUnpin for ReplicationFollower
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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