pub struct LeaderHandover { /* private fields */ }Expand description
Watcher that detects leader transitions across successive
MembershipState snapshots. Stateful: holds the previous
snapshot’s leader and emits a LeaderHandoverEvent only on
change.
Wire it up by calling LeaderHandover::observe every gossip
tick — a Some(event) return value means a handover occurred and
should be published. Across-process handover comes from the
cluster daemon broadcasting these events on the
crate::ClusterEventBus via remote.
Implementations§
Source§impl LeaderHandover
impl LeaderHandover
pub fn new() -> Self
Sourcepub fn observe(
&mut self,
state: &MembershipState,
) -> Option<LeaderHandoverEvent>
pub fn observe( &mut self, state: &MembershipState, ) -> Option<LeaderHandoverEvent>
Observe a new membership snapshot. Returns Some(event) if
the leader changed since the last observation; None if it
did not.
Sourcepub fn current(&self) -> Option<&Address>
pub fn current(&self) -> Option<&Address>
The leader observed at the last call to Self::observe.
Trait Implementations§
Source§impl Clone for LeaderHandover
impl Clone for LeaderHandover
Source§fn clone(&self) -> LeaderHandover
fn clone(&self) -> LeaderHandover
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LeaderHandover
impl Debug for LeaderHandover
Source§impl Default for LeaderHandover
impl Default for LeaderHandover
Source§fn default() -> LeaderHandover
fn default() -> LeaderHandover
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for LeaderHandover
impl RefUnwindSafe for LeaderHandover
impl Send for LeaderHandover
impl Sync for LeaderHandover
impl Unpin for LeaderHandover
impl UnsafeUnpin for LeaderHandover
impl UnwindSafe for LeaderHandover
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