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
impl FreshnessGate
Sourcepub fn new(budget_ms: i64) -> Self
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.
Sourcepub fn record(&mut self, now_ms: i64)
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.
Sourcepub fn set_link(&mut self, up: bool)
pub fn set_link(&mut self, up: bool)
Set the link state (a drop trips the gate to Lost regardless of the
last result’s age).