pub struct Replicator<IO: Io> { /* private fields */ }Implementations§
Source§impl<IO: Io> Replicator<IO>
impl<IO: Io> Replicator<IO>
pub fn new( shared: Arc<SharedWal<IO>>, next_frame_no: u64, wait_for_more: bool, ) -> Self
Sourcepub fn into_frame_stream(
self,
) -> impl Stream<Item = Result<Box<Frame>, Error>> + Send
pub fn into_frame_stream( self, ) -> impl Stream<Item = Result<Box<Frame>, Error>> + Send
Stream frames from this replicator. The replicator will wait for new frames to become available, and never return.
The replicator keeps track of how much progress has been made by the replica, and will attempt to find the next frames to send with following strategy:
- First, replicate as much as possible from the current log
- The, if we still haven’t caught up with
self.start_frame_no, we select the next frames to replicate from tail of current. - Finally, if we still haven’t reached
self.start_frame_no, read from durable storage (todo: maybe the replica should read from durable storage directly?)
In a single replication step, the replicator guarantees that a minimal set of frames is sent to the replica.
Auto Trait Implementations§
impl<IO> Freeze for Replicator<IO>
impl<IO> !RefUnwindSafe for Replicator<IO>
impl<IO> Send for Replicator<IO>
impl<IO> Sync for Replicator<IO>
impl<IO> Unpin for Replicator<IO>
impl<IO> !UnwindSafe for Replicator<IO>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§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 moreCreates a shared type from an unshared type.