pub enum Event {
ElectionTimeout,
FetchTimeout,
CheckQuorumTimeout,
ReceiveVoteRequest {
from: NodeId,
cluster_id: Option<Uuid>,
voter_id: NodeId,
voter_directory_id: Uuid,
candidate_epoch: Epoch,
candidate: NodeId,
candidate_directory_id: Uuid,
candidate_log_end: LogEnd,
pre_vote: bool,
},
ReceiveVoteResponse {
from: NodeId,
epoch: Epoch,
vote_granted: bool,
},
ReceiveBeginQuorumEpoch {
leader_id: NodeId,
leader_epoch: Epoch,
},
ReceiveEndQuorumEpoch {
leader_id: NodeId,
leader_epoch: Epoch,
successor_rank: SuccessorRank,
},
ReceiveFetch {
from: NodeId,
fetch_epoch: Epoch,
fetch_offset: i64,
},
ReceiveFetchSnapshot {
from: NodeId,
},
ReceiveFetchResponse {
leader_id: NodeId,
leader_epoch: Epoch,
diverging: Option<LogOffsetMetadata>,
},
ReceiveLeaderlessEpoch {
epoch: Epoch,
},
}Variants§
ElectionTimeout
The election timer fired.
FetchTimeout
The fetch timer fired.
The follower or observer lost contact with the leader.
CheckQuorumTimeout
The leader’s check-quorum timer fired.
A majority of the voters has not fetched within the check-quorum window, so this leader has lost the quorum and resigns (KAFKA-15489).
ReceiveVoteRequest
A peer asks us for our vote.
Fields
ReceiveVoteResponse
A peer answered our Vote.
The wire does NOT carry the round, that is, pre-vote against real vote.
The candidate infers the round from its own Prospective or Candidate
role and epoch (KIP-996). This matches Kafka’s field-less
VoteResponse.
ReceiveBeginQuorumEpoch
A leader announces its epoch to us.
ReceiveEndQuorumEpoch
A resigning leader tells us to start an election.
Fields
successor_rank: SuccessorRankWhere this replica stands in the leader’s preferred candidates.
ReceiveFetch
Leader side: a follower fetched at this position.
ReceiveFetchSnapshot
Leader side: a follower asked us for a byte window of a snapshot.
KIP-630 catch-up carries no fetch offset the leader can score, but it is still contact from that voter, and Kafka counts it toward check-quorum exactly as it counts a Fetch.
ReceiveFetchResponse
Follower side: the leader answered our Fetch.
Fields
diverging: Option<LogOffsetMetadata>Holds a value when the leader signalled log divergence.
ReceiveLeaderlessEpoch
A Fetch or Vote response came from a newer epoch that names no leader yet.
Kafka’s KafkaRaftClient.maybeTransition moves the replica to
Unattached in that epoch, and an observer then looks for the leader at
once.
Trait Implementations§
impl Copy for Event
impl Eq for Event
Source§impl Ord for Event
impl Ord for Event
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Event
impl PartialOrd for Event
impl StructuralPartialEq for Event
Auto Trait Implementations§
impl Freeze for Event
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnsafeUnpin for Event
impl UnwindSafe for Event
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<F> FnGhost for F
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);