pub trait FreshnessClock: Send + Sync {
// Required method
fn now(&self) -> u64;
// Provided method
fn advance(&self, _now: u64) { ... }
}Expand description
Source of the current clock value used throughout the freshness model.
Implementations return a monotone-ish u64 in their own units. The two
built-ins are BlockClock (block number, the default) and WallClock
(unix seconds).
Required Methods§
Provided Methods§
Sourcefn advance(&self, _now: u64)
fn advance(&self, _now: u64)
Advance the clock to now.
Called by FreshnessController::on_new_block so the natural API drives
the clock forward. The default is a no-op (for clocks like WallClock
that advance on their own); BlockClock overrides it to set the block.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".