Enum PollInput

Source
pub enum PollInput {
    Unknown,
    Observation {
        owner: ParticipantId,
        rank: Rank,
        lease_duration: Duration,
        elapsed: Duration,
    },
    Leadership {
        rank: Rank,
        lease_duration: Duration,
        elapsed: Duration,
    },
}
Expand description

What the polling caller claims about the durable state, with the time elapsed since its anchor measured on the caller’s own monotonic clock.

The recipe holds no time: it only compares the claimed tuple with durable state and elapsed with the claimed lease_duration. Local callers build it with LocalState::input. A transport service relaying a remote caller builds it from the request and must authenticate that caller.

Honest elapsed reporting is a protocol precondition: the exact-tuple check only rejects stale or mismatched callers. A caller, even an authenticated one, that inflates elapsed for the exact current tuple can take over early. A service that does not trust its callers must enforce timing itself.

Variants§

§

Unknown

The caller has not adopted any poll result. It follows any durable owner.

§

Observation

An exact durable owner record the caller observed and is not authorized to renew.

Only an exact match of owner, rank, and lease_duration with durable state, with elapsed at least lease_duration, permits a takeover (or a reacquisition when owner is the polling participant).

Fields

§rank: Rank
§lease_duration: Duration
§elapsed: Duration
§

Leadership

The durable owner record the polling participant claims to hold.

The owner is the participant passed to super::LeaderElection::poll. It renews only on an exact durable match with elapsed strictly below lease_duration.

Fields

§rank: Rank
§lease_duration: Duration
§elapsed: Duration

Trait Implementations§

Source§

impl Clone for PollInput

Source§

fn clone(&self) -> PollInput

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PollInput

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for PollInput

Source§

fn eq(&self, other: &PollInput) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for PollInput

Source§

impl StructuralPartialEq for PollInput

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.