pub struct LeadershipHandle {
pub events: Receiver<Option<LeadershipEvent>>,
/* private fields */
}Expand description
Handle returned by LeaderElector::start().
One-shot per LeaderElector instance — create a new instance to restart.
Fields§
§events: Receiver<Option<LeadershipEvent>>Subscribe to leadership state changes.
Implementations§
Source§impl LeadershipHandle
impl LeadershipHandle
Sourcepub fn new(
events: Receiver<Option<LeadershipEvent>>,
is_leader: Arc<AtomicBool>,
cancel: CancellationToken,
terminated: Receiver<()>,
) -> Self
pub fn new( events: Receiver<Option<LeadershipEvent>>, is_leader: Arc<AtomicBool>, cancel: CancellationToken, terminated: Receiver<()>, ) -> Self
Public constructor — required by camel-platform-kubernetes which lives in a separate crate
and cannot use struct literal syntax for fields that are private.
pub fn is_leader(&self) -> bool
Sourcepub async fn step_down(self) -> Result<(), PlatformError>
pub async fn step_down(self) -> Result<(), PlatformError>
Signal step-down AND await full teardown:
lease release + loop termination + StoppedLeading delivered.
Auto Trait Implementations§
impl Freeze for LeadershipHandle
impl !RefUnwindSafe for LeadershipHandle
impl Send for LeadershipHandle
impl Sync for LeadershipHandle
impl Unpin for LeadershipHandle
impl UnsafeUnpin for LeadershipHandle
impl !UnwindSafe for LeadershipHandle
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