Struct LeaderEpoch
pub struct LeaderEpoch(pub i32);Expand description
A partition leader epoch. KIP-320 wire type: int32.
This is a monotonic per-partition counter, and every leader change
increments it. It fences stale leaders and it bounds follower log
truncation. -1, the UNKNOWN_LEADER_EPOCH sentinel, is a valid wire value
and round-trips as the inner i32. The type is ordered, so epochs compare
directly. Advance to the next epoch with LeaderEpoch::next.
Note: the deterministic consensus core, krabka-kraft-core, tracks its own
always-non-negative epoch as a u32, krabka_kraft_core::types::Epoch.
krabka-raft converts to and from this wire type at the controller
boundary.
Tuple Fields§
§0: i32Implementations§
§impl LeaderEpoch
impl LeaderEpoch
pub const UNKNOWN: LeaderEpoch
pub const UNKNOWN: LeaderEpoch
KIP-320 UNKNOWN_LEADER_EPOCH (-1): the leader epoch is unknown or
unset. Examples are an older client, and a partition with no elected
leader yet.
pub const INITIAL: LeaderEpoch
pub const INITIAL: LeaderEpoch
The epoch a partition’s first leader starts at (0).
pub const fn next(self) -> LeaderEpoch
pub const fn next(self) -> LeaderEpoch
The next epoch after this one. A leader change increments the epoch by one.
Trait Implementations§
§impl Clone for LeaderEpoch
impl Clone for LeaderEpoch
§fn clone(&self) -> LeaderEpoch
fn clone(&self) -> LeaderEpoch
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for LeaderEpoch
§impl Debug for LeaderEpoch
impl Debug for LeaderEpoch
§impl Default for LeaderEpoch
impl Default for LeaderEpoch
§fn default() -> LeaderEpoch
fn default() -> LeaderEpoch
§impl<'de> Deserialize<'de> for LeaderEpoch
impl<'de> Deserialize<'de> for LeaderEpoch
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<LeaderEpoch, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<LeaderEpoch, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl Display for LeaderEpoch
impl Display for LeaderEpoch
impl Eq for LeaderEpoch
§impl From<i32> for LeaderEpoch
impl From<i32> for LeaderEpoch
§fn from(value: i32) -> LeaderEpoch
fn from(value: i32) -> LeaderEpoch
§impl Hash for LeaderEpoch
impl Hash for LeaderEpoch
§impl Ord for LeaderEpoch
impl Ord for LeaderEpoch
§fn cmp(&self, other: &LeaderEpoch) -> Ordering
fn cmp(&self, other: &LeaderEpoch) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
§impl PartialEq for LeaderEpoch
impl PartialEq for LeaderEpoch
§impl PartialEq<i32> for LeaderEpoch
impl PartialEq<i32> for LeaderEpoch
§impl PartialOrd for LeaderEpoch
impl PartialOrd for LeaderEpoch
§impl PartialOrd<i32> for LeaderEpoch
impl PartialOrd<i32> for LeaderEpoch
§impl Serialize for LeaderEpoch
impl Serialize for LeaderEpoch
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for LeaderEpoch
Auto Trait Implementations§
impl Freeze for LeaderEpoch
impl RefUnwindSafe for LeaderEpoch
impl Send for LeaderEpoch
impl Sync for LeaderEpoch
impl Unpin for LeaderEpoch
impl UnsafeUnpin for LeaderEpoch
impl UnwindSafe for LeaderEpoch
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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);