pub struct Announcer { /* private fields */ }Implementations§
Source§impl Announcer
impl Announcer
Sourcepub fn new(config: AnnouncerConfig) -> Result<Announcer, AnnouncerError>
pub fn new(config: AnnouncerConfig) -> Result<Announcer, AnnouncerError>
Construct a new Announcer from the AnnouncerConfig.
This will ensure that the local NodeId, provided in the
AnnouncerConfig, will be removed from all sets.
§Errors
Returns the following errors:
AnnouncerError::NoSeeds: both sets of already synchronized and un-synchronized nodes were empty of nodes were emptyAnnouncerError::AlreadySynced: no more nodes are available for synchronizing withAnnouncerError::Target: the target has no preferred seeds and no replicas
Sourcepub fn synced_with(
&mut self,
node: PublicKey,
duration: Duration,
) -> ControlFlow<Success, Progress>
pub fn synced_with( &mut self, node: PublicKey, duration: Duration, ) -> ControlFlow<Success, Progress>
Mark the node as synchronized, with the given duration it took to
synchronize with.
If the target for the Announcer has been reached, then a Success is
returned via ControlFlow::Break. Otherwise, Progress is returned
via ControlFlow::Continue.
The caller decides whether they wish to continue the announcement process.
Sourcepub fn timed_out(self) -> AnnouncerResult
pub fn timed_out(self) -> AnnouncerResult
Complete the Announcer process returning a AnnouncerResult.
If the target for the Announcer has been reached, then the result
will be AnnouncerResult::Success, otherwise, it will be
AnnouncerResult::TimedOut.
Sourcepub fn can_continue(self) -> ControlFlow<NoNodes, Announcer>
pub fn can_continue(self) -> ControlFlow<NoNodes, Announcer>
Check if the Announcer can continue synchronizing with more nodes.
If there are no more nodes, then NoNodes is returned in the
ControlFlow::Break, otherwise the Announcer is returned as-is in
the ControlFlow::Continue.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Announcer
impl RefUnwindSafe for Announcer
impl Send for Announcer
impl Sync for Announcer
impl Unpin for Announcer
impl UnwindSafe for Announcer
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