pub struct TimeDriftCheck { /* private fields */ }Expand description
Health check for monitoring time drift.
This check monitors the time drift between the local node and the network consensus time. Excessive time drift can cause synchronization issues, event ordering problems, and state divergence.
§Status Determination
Healthy: |time_drift| < max_drift_msDegraded: |time_drift| >= max_drift_ms
§Example
use elara_runtime::health::{TimeDriftCheck, HealthCheck};
use elara_runtime::node::Node;
use std::sync::Arc;
let node = Arc::new(Node::new());
let check = TimeDriftCheck::new(node, 100); // 100ms max drift
let result = check.check();Implementations§
Source§impl TimeDriftCheck
impl TimeDriftCheck
Sourcepub fn new(node: Arc<Node>, max_drift_ms: i64) -> Self
pub fn new(node: Arc<Node>, max_drift_ms: i64) -> Self
Creates a new TimeDriftCheck.
§Arguments
node- Arc reference to the Node to monitormax_drift_ms- Maximum acceptable time drift in milliseconds
§Example
use elara_runtime::health::TimeDriftCheck;
use elara_runtime::node::Node;
use std::sync::Arc;
let node = Arc::new(Node::new());
let check = TimeDriftCheck::new(node, 100);Sourcepub fn max_drift_ms(&self) -> i64
pub fn max_drift_ms(&self) -> i64
Returns the configured maximum drift threshold in milliseconds.
Trait Implementations§
Source§impl HealthCheck for TimeDriftCheck
impl HealthCheck for TimeDriftCheck
Auto Trait Implementations§
impl Freeze for TimeDriftCheck
impl RefUnwindSafe for TimeDriftCheck
impl Send for TimeDriftCheck
impl Sync for TimeDriftCheck
impl Unpin for TimeDriftCheck
impl UnsafeUnpin for TimeDriftCheck
impl UnwindSafe for TimeDriftCheck
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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>
Wrap the input message
T in a tonic::Request