pub struct ObservationWindow { /* private fields */ }Expand description
Enriched observation horizon with temporal context.
Tracks not just what was observed (origin_hash, sequence) but when and how far away each entity is (staleness, estimated delay).
Implementations§
Source§impl ObservationWindow
impl ObservationWindow
Sourcepub fn from_horizon(horizon: ObservedHorizon, local_subnet: SubnetId) -> Self
pub fn from_horizon(horizon: ObservedHorizon, local_subnet: SubnetId) -> Self
Create from an existing horizon.
Sourcepub fn observe_with_context(
&mut self,
origin_hash: u64,
sequence: u64,
hop_count: u8,
source_subnet: SubnetId,
model: &PropagationModel,
)
pub fn observe_with_context( &mut self, origin_hash: u64, sequence: u64, hop_count: u8, source_subnet: SubnetId, model: &PropagationModel, )
Record an observation with propagation context.
Sourcepub fn observe(&mut self, origin_hash: u64, sequence: u64)
pub fn observe(&mut self, origin_hash: u64, sequence: u64)
Simple observation (no propagation context).
Sourcepub fn staleness(&self, origin_hash: u64) -> Option<Duration>
pub fn staleness(&self, origin_hash: u64) -> Option<Duration>
How long since an entity was last observed.
Sourcepub fn is_within_cone(&self, origin_hash: u64, max_delay_nanos: u64) -> bool
pub fn is_within_cone(&self, origin_hash: u64, max_delay_nanos: u64) -> bool
Whether an entity is within the observer’s causal cone (observed recently enough given propagation delay).
Sourcepub fn reachable_entities(&self, max_delay_nanos: u64) -> Vec<u64>
pub fn reachable_entities(&self, max_delay_nanos: u64) -> Vec<u64>
Entities observed within a given hop radius.
Sourcepub fn divergence_from(&self, other: &ObservationWindow) -> HorizonDivergence
pub fn divergence_from(&self, other: &ObservationWindow) -> HorizonDivergence
Quantify how different two observers’ views are.
Sourcepub fn horizon(&self) -> &ObservedHorizon
pub fn horizon(&self) -> &ObservedHorizon
Get the underlying horizon.
Sourcepub fn local_subnet(&self) -> SubnetId
pub fn local_subnet(&self) -> SubnetId
Get the local subnet.
Sourcepub fn entity_count(&self) -> usize
pub fn entity_count(&self) -> usize
Number of observed entities.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ObservationWindow
impl RefUnwindSafe for ObservationWindow
impl Send for ObservationWindow
impl Sync for ObservationWindow
impl Unpin for ObservationWindow
impl UnsafeUnpin for ObservationWindow
impl UnwindSafe for ObservationWindow
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