pub enum Command {
Show 14 variants
Inbound(Inbound),
Event(Event),
FetchResponse {
from: NodeId,
body: Bytes,
},
VoteResponse {
from: NodeId,
body: Bytes,
},
FetchSnapshotResponse {
from: NodeId,
body: Bytes,
},
Timer(TimerTick),
SubmitChange {
records: Vec<MetadataRecord>,
expected_image: Option<Arc<MetadataImage>>,
reply: Sender<Result<SubmitChangeResult, RaftError>>,
},
SubmitDelegationTokenMutations {
mutations: Vec<DelegationTokenMutation>,
reply: Sender<Result<SubmitChangeResult, RaftError>>,
},
Reconfigure {
change: VoterChange,
reply: Sender<Result<ReconfigOutcome, RaftError>>,
},
TriggerSnapshot {
reply: Sender<Result<(), RaftError>>,
},
QuorumStateSnapshot {
reply: Sender<QuorumStateSnapshot>,
},
MetadataFetch {
fetch_offset: i64,
max_size: ByteSize,
replica: Option<ReplicaKey>,
reply: Sender<MetadataFetchSlice>,
},
Shutdown,
Halt,
}Expand description
Everything that arrives on the engine’s mpsc and drives one turn of the loop.
Variants§
Inbound(Inbound)
An inbound peer RPC with a oneshot to reply on.
Event(Event)
Injects a core Event directly. This is the test and driver entry
point.
FetchResponse
A Fetch RESPONSE the follower received from the leader. A Fetch
response carries log records. The follower must truncate, append, and
apply those records BEFORE it feeds the ReceiveFetchResponse event to
the core, so this response gets its own command.
Fields
body: BytesThe raw encoded wire::PeerResponse::Fetch
body.
VoteResponse
A Vote RESPONSE a nominee received from a voter. Beside the grant it
names the voter’s epoch, the leader it knows and that leader’s
endpoint, which the engine acts on before the core counts the grant,
as Kafka’s maybeHandleCommonResponse does.
FetchSnapshotResponse
A FetchSnapshot RESPONSE the follower received from the leader. It
carries snapshot bytes that the follower reassembles before it resumes.
This mirrors the dedicated command path of FetchResponse.
Timer(TimerTick)
An election, fetch, or heartbeat timer fired. The loop maps it to the right core event after it reads the liveness state. A fetch tick re-polls instead of electing, unless the leader has been missed enough times.
SubmitChange
Handle op: append and commit a metadata batch as the leader. It replies once the batch is committed and applied, or it replies with a rejection.
Fields
records: Vec<MetadataRecord>expected_image: Option<Arc<MetadataImage>>reply: Sender<Result<SubmitChangeResult, RaftError>>SubmitDelegationTokenMutations
Handle op: compare and mutate delegation-token state in one engine turn.
Reconfigure
Handle op: append a KIP-853 control batch and optionally wait for it to commit under the new voter set.
TriggerSnapshot
Handle op: snapshot the current image to a checkpoint.
QuorumStateSnapshot
Handle op: read a structured snapshot of consensus state for
DescribeQuorum.
Fields
reply: Sender<QuorumStateSnapshot>MetadataFetch
Handle op: read a committed __cluster_metadata slice for an observer’s
API_KEY_METADATA_FETCH (1004), encoded as Kafka record batches.
Fields
max_size: ByteSizereplica: Option<ReplicaKey>The observer that asked, when it is a replica. A leader tracks its progress under this key.
reply: Sender<MetadataFetchSlice>Shutdown
Stop the loop gracefully: a leader resigns and the loop runs on, within a bound, until the quorum has elected a successor.
Halt
Stop the loop at once, handing nothing over, as a halted process does.
Implementations§
Auto Trait Implementations§
impl !Freeze for Command
impl !RefUnwindSafe for Command
impl !UnwindSafe for Command
impl Send for Command
impl Sync for Command
impl Unpin for Command
impl UnsafeUnpin for Command
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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);