pub struct ChainFreshness { /* private fields */ }Expand description
Shared liveness of the node’s chain reads. Cloned into the blacklist watcher (which stamps it) and the serve and probe handlers (which read it); every clone shares one cell.
Implementations§
Source§impl ChainFreshness
impl ChainFreshness
Sourcepub fn new(grace: Duration) -> Self
pub fn new(grace: Duration) -> Self
A freshness handle with the given grace window, not yet stamped (so it reads stale until the boot enumeration or the first successful tick stamps it).
Sourcepub fn stamp(&self)
pub fn stamp(&self)
Record that a chain read just succeeded (a successful blacklist poll tick, or the clean boot enumeration). Stamps the current wall clock.
Sourcepub fn is_stale(&self) -> bool
pub fn is_stale(&self) -> bool
Has the node been unable to reach the chain for longer than the grace
window? A 0 cell is stale by definition — either never stamped, or
stamped from a pre-epoch (or unreadable) clock, which the wall-clock
reader also reports as 0; both fold into this one fail-closed branch,
because a node with no confirmed-fresh compliance state has nothing sound
to serve against.
Trait Implementations§
Source§impl Clone for ChainFreshness
impl Clone for ChainFreshness
Auto Trait Implementations§
impl Freeze for ChainFreshness
impl RefUnwindSafe for ChainFreshness
impl Send for ChainFreshness
impl Sync for ChainFreshness
impl Unpin for ChainFreshness
impl UnsafeUnpin for ChainFreshness
impl UnwindSafe for ChainFreshness
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,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request