pub struct MultiPeerCatchUp { /* private fields */ }Expand description
Pipelined catch-up from multiple peer nodes simultaneously.
Spawns one thread per peer in peers and waits for all to finish (or
for the first to succeed). Returns the name of the peer that supplied
the entries, or None if no peer could serve the range.
The log_writer_factory closure is called once per thread to produce a
per-thread LogWriter. The factory must be Send + Sync.
Implementations§
Source§impl MultiPeerCatchUp
impl MultiPeerCatchUp
Sourcepub fn new(peers: Vec<(String, SocketAddr)>, start_vlsn: u64) -> Self
pub fn new(peers: Vec<(String, SocketAddr)>, start_vlsn: u64) -> Self
Create a new multi-peer catch-up request.
peers is a list of (node_name, socket_addr) pairs to try.
Sourcepub fn run<F, W>(self, make_writer: F) -> Option<String>
pub fn run<F, W>(self, make_writer: F) -> Option<String>
Run pipelined catch-up.
Spawns one thread per peer and waits for the first to succeed.
Each thread calls catch_up_from_peer; the winning thread’s entries
are applied through make_writer(). Other threads are joined once
the first succeeds.
Returns the name of the first peer that successfully served the range,
or None if all peers declined.
Auto Trait Implementations§
impl Freeze for MultiPeerCatchUp
impl RefUnwindSafe for MultiPeerCatchUp
impl Send for MultiPeerCatchUp
impl Sync for MultiPeerCatchUp
impl Unpin for MultiPeerCatchUp
impl UnsafeUnpin for MultiPeerCatchUp
impl UnwindSafe for MultiPeerCatchUp
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
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>
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>
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