pub struct ElectionManager { /* private fields */ }Expand description
Leader election manager for multiple groups
Implementations§
Source§impl ElectionManager
impl ElectionManager
Sourcepub fn new(node_id: String, config: ElectionConfig) -> Self
pub fn new(node_id: String, config: ElectionConfig) -> Self
Create a new election manager
Sourcepub fn get_or_create_election(
&self,
group_id: &str,
event_tx: Option<Sender<ElectionEvent>>,
) -> Arc<LeaderElection>
pub fn get_or_create_election( &self, group_id: &str, event_tx: Option<Sender<ElectionEvent>>, ) -> Arc<LeaderElection>
Get or create election for a group
Sourcepub fn get_election(&self, group_id: &str) -> Option<Arc<LeaderElection>>
pub fn get_election(&self, group_id: &str) -> Option<Arc<LeaderElection>>
Get election for a group
Sourcepub fn fencing_token(&self, group_id: &str) -> Option<u64>
pub fn fencing_token(&self, group_id: &str) -> Option<u64>
Get fencing token for a group
Sourcepub fn led_groups(&self) -> Vec<String>
pub fn led_groups(&self) -> Vec<String>
Get all groups where this node is leader
Auto Trait Implementations§
impl Freeze for ElectionManager
impl !RefUnwindSafe for ElectionManager
impl Send for ElectionManager
impl Sync for ElectionManager
impl Unpin for ElectionManager
impl UnsafeUnpin for ElectionManager
impl !UnwindSafe for ElectionManager
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
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 more