pub struct ReplicaProgress {
pub fetch_offset: i64,
pub last_fetch: SimInstant,
pub last_caught_up: SimInstant,
pub last_fetch_leader_log_end: i64,
}Expand description
Per-replica replication progress that a leader tracks: a voter’s for the HWM
and any replica’s for DescribeQuorum and the AddRaftVoter catch-up check.
A zero instant means the leader has not recorded that event, as Kafka’s -1 timestamps do.
Fields§
§fetch_offset: i64Highest offset the follower has acknowledged, that is, its fetch offset.
last_fetch: SimInstantLogical instant the leader received the most recent Fetch from this follower.
last_caught_up: SimInstantLogical instant this follower was known to be caught up with the leader’s log end.
last_fetch_leader_log_end: i64The leader’s log end offset when this follower last fetched: the offset the next fetch has to reach for the follower to count as having kept pace with the appends in between.
Implementations§
Source§impl ReplicaProgress
impl ReplicaProgress
Sourcepub fn record_fetch(
&mut self,
now: SimInstant,
fetch_offset: i64,
leader_log_end: i64,
)
pub fn record_fetch( &mut self, now: SimInstant, fetch_offset: i64, leader_log_end: i64, )
Record a valid fetch at fetch_offset while the leader’s log ended at
leader_log_end, as Kafka’s ReplicaState.updateFollowerState does.
A fetch at or past the leader’s log end is caught up now. A fetch short
of it still counts as caught up as of the previous fetch when it reaches
the log end that fetch saw, so a follower that keeps pace under
continuous appends does not look stale. The caught-up time is settled
before last_fetch moves, because the second case reads the old one.
Sourcepub fn is_caught_up(&self, now: SimInstant) -> bool
pub fn is_caught_up(&self, now: SimInstant) -> bool
Kafka’s LeaderState.isReplicaCaughtUp: the replica has been caught up
at some point and fetched within the last hour.
Sourcepub fn fetched_within_caught_up_window(&self, now: SimInstant) -> bool
pub fn fetched_within_caught_up_window(&self, now: SimInstant) -> bool
Whether the replica fetched within the hour that
Self::is_caught_up allows. A replica that has been quiet for longer
can never count as caught up until it fetches again, so a leader may
forget its progress.
Trait Implementations§
Source§impl Clone for ReplicaProgress
impl Clone for ReplicaProgress
Source§fn clone(&self) -> ReplicaProgress
fn clone(&self) -> ReplicaProgress
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ReplicaProgress
impl Debug for ReplicaProgress
Source§impl Default for ReplicaProgress
impl Default for ReplicaProgress
Source§fn default() -> ReplicaProgress
fn default() -> ReplicaProgress
impl Eq for ReplicaProgress
Source§impl Hash for ReplicaProgress
impl Hash for ReplicaProgress
Source§impl PartialEq for ReplicaProgress
impl PartialEq for ReplicaProgress
impl StructuralPartialEq for ReplicaProgress
Auto Trait Implementations§
impl Freeze for ReplicaProgress
impl RefUnwindSafe for ReplicaProgress
impl Send for ReplicaProgress
impl Sync for ReplicaProgress
impl Unpin for ReplicaProgress
impl UnsafeUnpin for ReplicaProgress
impl UnwindSafe for ReplicaProgress
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);