pub enum PollOutcome {
Leader {
rank: Rank,
transition: PollTransition,
},
Follower {
owner: ParticipantId,
rank: Rank,
lease_duration: Duration,
},
}Expand description
The role and fencing rank prepared by one poll transaction attempt.
The rank may protect work staged in the same transaction, but it authorizes
no committed or external work until the enclosing
Database::run succeeds.
Variants§
Leader
The transaction staged this caller as owner with a fresh fencing rank.
PollTransition classifies how that staged ownership was reached.
Follower
A durable owner was observed, but no leadership transition was staged.
The fields form the exact record used to produce the next
LocalState::Observation.
Implementations§
Source§impl PollOutcome
impl PollOutcome
Sourcepub fn rank(&self) -> Rank
pub fn rank(&self) -> Rank
Returns the observed or newly staged durable revision as a fencing rank.
Only Self::is_leader outcomes provide a new rank that can protect
work staged by this poll transaction.
Sourcepub fn transition(&self) -> PollTransition
pub fn transition(&self) -> PollTransition
Returns the transition classification for this attempt.
PollOutcome::Follower always reports PollTransition::Followed.
Sourcepub fn is_takeover(&self) -> bool
pub fn is_takeover(&self) -> bool
Returns whether this attempt staged replacement of a foreign owner.
Sourcepub fn is_reacquisition(&self) -> bool
pub fn is_reacquisition(&self) -> bool
Returns whether this attempt staged reacquisition of this participant’s expired record.
Sourcepub fn owner(&self) -> Option<&ParticipantId>
pub fn owner(&self) -> Option<&ParticipantId>
Returns the observed owner when this attempt produced follower state.
The owner is an observation, not an authorization for the caller.
Sourcepub fn lease_duration(&self) -> Option<Duration>
pub fn lease_duration(&self) -> Option<Duration>
Returns the observed persisted lease duration when following.
This duration is relevant to a later poll only with the matching
Observation adopted by PollResult::into_next_state.
Trait Implementations§
Source§impl Clone for PollOutcome
impl Clone for PollOutcome
Source§fn clone(&self) -> PollOutcome
fn clone(&self) -> PollOutcome
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more