pub struct DeviceEngine<const PAYLOAD: usize, const ENTRIES: usize = CACHE_ENTRIES> { /* private fields */ }Expand description
The device half of the Node Management binding.
PAYLOAD is the largest response payload the transport can carry,
which is also the size of each retained entry. ENTRIES is how many
administrators keep a retained response.
Implementations§
Source§impl<const PAYLOAD: usize, const ENTRIES: usize> DeviceEngine<PAYLOAD, ENTRIES>
impl<const PAYLOAD: usize, const ENTRIES: usize> DeviceEngine<PAYLOAD, ENTRIES>
Sourcepub fn new(nonce: u16) -> Self
pub fn new(nonce: u16) -> Self
Build an engine. nonce is drawn once per boot from the
cryptographic RNG: it is what stops a cursor issued before a
reboot from being honored after one, when the generation counter
has started over.
Sourcepub fn begin<'p>(
&mut self,
from: &PublicKey,
payload: &'p [u8],
generation: u16,
now_ms: u64,
out: &mut [u8],
) -> Ingress<'p>
pub fn begin<'p>( &mut self, from: &PublicKey, payload: &'p [u8], generation: u16, now_ms: u64, out: &mut [u8], ) -> Ingress<'p>
Read an arriving Node Management Request payload, the payload type byte already stripped.
generation is the device-domain version: every change to it
invalidates the cursors issued before it. now_ms orders the
retained entries for eviction.
Sourcepub fn complete(
&mut self,
produced: Produced<'_>,
out: &mut [u8],
) -> Result<Option<usize>, CompleteError>
pub fn complete( &mut self, produced: Produced<'_>, out: &mut [u8], ) -> Result<Option<usize>, CompleteError>
Wrap what the dispatch produced, retain it, and write the
response payload into out.
Returns the payload’s length, or None for a reset-class command,
which is answered by no payload at all.
Sourcepub fn forget_retained(&mut self)
pub fn forget_retained(&mut self)
Forget every retained response, as a reset does.