pub(crate) struct ActivePeerTracker {
peers: Mutex<HashMap<Endpoint, PeerRecord>>,
}Expand description
Tracker for the active peers
Fields§
§peers: Mutex<HashMap<Endpoint, PeerRecord>>Implementations§
Source§impl ActivePeerTracker
impl ActivePeerTracker
Sourcepub(crate) fn upsert(&self, target: &SyncTarget) -> bool
pub(crate) fn upsert(&self, target: &SyncTarget) -> bool
Records a peer as active, together with the origin it was validated against. Returns whether this is the first time it has been seen, which is what earns it an introductory reply.
pub(crate) fn targets(&self) -> Vec<SyncTarget>
Sourcepub(crate) fn prune_stale(&self, stale_after: Duration)
pub(crate) fn prune_stale(&self, stale_after: Duration)
Drops peers that have not been heard from within stale_after, so this peer stops syncing
to clients that are no longer running.
Trait Implementations§
Source§impl Default for ActivePeerTracker
impl Default for ActivePeerTracker
Source§fn default() -> ActivePeerTracker
fn default() -> ActivePeerTracker
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for ActivePeerTracker
impl RefUnwindSafe for ActivePeerTracker
impl Send for ActivePeerTracker
impl Sync for ActivePeerTracker
impl Unpin for ActivePeerTracker
impl UnsafeUnpin for ActivePeerTracker
impl UnwindSafe for ActivePeerTracker
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
Create a new handle for an Arc value Read more
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
Clone a handle Read more
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Consume a handle, getting back the initial
Arc<> Read more§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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