Skip to main content

FreshnessGate

Struct FreshnessGate 

Source
pub struct FreshnessGate { /* private fields */ }
Expand description

Tracks the freshness of one offloaded result stream.

Freshness is anchored on the local monotonic time the result arrived, not on the result’s own (remote) timestamp. This is deliberate and load-bearing: the drone and the compute node are not clock-synced, so a node whose clock is skewed ahead, whose detector then hangs (the socket staying up, so no link drop fires), would keep a frozen stream reading fresh forever if age were measured from the remote timestamp; the aircraft would follow a frozen target. Measuring “time since a result last arrived, on the drone’s own monotonic clock” catches exactly that stall. The now_ms passed to record and state MUST come from the same local monotonic clock; the remote result timestamp is for telemetry, never for this gate.

Implementations§

Source§

impl FreshnessGate

Source

pub fn new(budget_ms: i64) -> Self

A gate with the stream’s freshness budget_ms (e.g. a target-age or a pose-age budget). A negative budget is clamped to 0 (a misconfiguration must not flip the fail-safe direction). Starts Lost (no result yet); the link starts up.

Source

pub fn record(&mut self, now_ms: i64)

Record that a result arrived. now_ms is the local monotonic time of arrival (NOT the result’s own timestamp), see the type docs.

Set the link state (a drop trips the gate to Lost regardless of the last result’s age).

Source

pub fn state(&self, now_ms: i64) -> GateState

The gate state at the local monotonic time now_ms.

Source

pub fn is_usable(&self, now_ms: i64) -> bool

Whether a behaviour may act on this stream at now_ms.

Trait Implementations§

Source§

impl Clone for FreshnessGate

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FreshnessGate

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.