#[non_exhaustive]pub enum DeviceError {
SduTooLarge {
got: usize,
max: u16,
},
UnknownLane(LaneKey),
TxUnavailable,
Closed,
Device(String),
}Expand description
Why a medium refused or failed an SDU.
#[non_exhaustive]: both consumers on the data path already match with a
catch-all (sched.rs’s retry arm, lanes.rs’s receive loop), so this costs
nothing today and leaves room for the variants a real device will need. The
alternative is discovering later that adding one is a breaking change to a
crate whose whole job is to be implemented from outside.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
SduTooLarge
The SDU is larger than the medium can carry.
Invariant I4: the driver never splits a batch to make it fit. An SDU that
does not fit is a configuration error — Zenoh’s batch_size was set
above what this medium can carry — and it is reported, loudly, as one.
UnknownLane(LaneKey)
No such lane is configured on this medium.
The medium is up but cannot transmit right now, and says so rather than waiting.
For hardware whose API refuses instead of blocking — a half-duplex medium mid-reception, on a device that reports rather than queues.
A contact window is still not an instance of this. A satellite
terminal out of coverage blocks, because that is what a
store-and-forward service does. See
docs/measurements/contact-windows.md.
What returning it costs, exactly: on a reliable lane the scheduler
holds the batch and offers it again with a backoff, for as long as the
medium keeps refusing (#40) — so this trades a stall for a delay, never
for lost data, and the stall reaches Zenoh as ordinary backpressure. On
a best-effort lane the batch is dropped and counted, which is what
best-effort means. Either way the refusal appears on
DriverMetrics::tx_failed.
Earlier versions of this note warned that the scheduler dropped the batch on both lane classes. It did, silently, and that was #40.
Closed
The medium is gone: closed, unplugged, or failed.
Device(String)
Anything hardware-specific, in the backend’s own words.
Handled exactly as DeviceError::TxUnavailable: held and retried on
a reliable lane, dropped and counted on a best-effort one. Return it
for a failure the medium expects to survive — +CME ERROR, an SPI
timeout, an MO status of “no network”. A device that is gone should
say DeviceError::Closed instead, which stops the driver rather
than retrying into it.
The string reaches the management plane verbatim. sched::transmit
raises a DeviceEvent carrying it, the driver’s event stream carries
that, and it is published as events/modem/device_fault/<ulid> with the
text in detail (#51). Write it for an operator, not for a log grep:
it is the only place a device speaks in its own words.
Trait Implementations§
Source§impl Debug for DeviceError
impl Debug for DeviceError
Source§impl Display for DeviceError
impl Display for DeviceError
Source§impl Error for DeviceError
impl Error for DeviceError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()