pub struct NodeStack<'a, R: Radio> {
pub host: Host<MacHandle<'a, TokioPlatform<R, TokioFileCounterStore, TokioFileKeyValueStore>, IDENTITIES, PEERS, CHANNELS, ACKS, TX, FRAME, DUP>>,
pub node: LocalNode<MacHandle<'a, TokioPlatform<R, TokioFileCounterStore, TokioFileKeyValueStore>, IDENTITIES, PEERS, CHANNELS, ACKS, TX, FRAME, DUP>>,
pub handle: MacHandle<'a, TokioPlatform<R, TokioFileCounterStore, TokioFileKeyValueStore>, IDENTITIES, PEERS, CHANNELS, ACKS, TX, FRAME, DUP>,
started: Instant,
}Expand description
The tool as a node: a host MAC over the borrowed radio, one local node standing for the administrator identity, and the pump that keeps both moving.
Fields§
§host: Host<MacHandle<'a, TokioPlatform<R, TokioFileCounterStore, TokioFileKeyValueStore>, IDENTITIES, PEERS, CHANNELS, ACKS, TX, FRAME, DUP>>§node: LocalNode<MacHandle<'a, TokioPlatform<R, TokioFileCounterStore, TokioFileKeyValueStore>, IDENTITIES, PEERS, CHANNELS, ACKS, TX, FRAME, DUP>>§handle: MacHandle<'a, TokioPlatform<R, TokioFileCounterStore, TokioFileKeyValueStore>, IDENTITIES, PEERS, CHANNELS, ACKS, TX, FRAME, DUP>§started: InstantImplementations§
Source§impl<'a, R: Radio> NodeStack<'a, R>
impl<'a, R: Radio> NodeStack<'a, R>
Sourcepub async fn build(
mac: &'a AsyncRefCell<Mac<TokioPlatform<R, TokioFileCounterStore, TokioFileKeyValueStore>, IDENTITIES, PEERS, CHANNELS, ACKS, TX, FRAME, DUP>>,
identity: SoftwareIdentity,
) -> Result<(Self, PublicKey)>
pub async fn build( mac: &'a AsyncRefCell<Mac<TokioPlatform<R, TokioFileCounterStore, TokioFileKeyValueStore>, IDENTITIES, PEERS, CHANNELS, ACKS, TX, FRAME, DUP>>, identity: SoftwareIdentity, ) -> Result<(Self, PublicKey)>
Register identity on the borrowed MAC and stand a node up on it,
returning the stack and the administrator’s public key.
Sourcepub fn started(&self) -> Instant
pub fn started(&self) -> Instant
When this stack came up. The exchange engine’s deadlines are
expressed against Self::now_ms, which counts from here.
pub fn now_ms(&self) -> u64
Sourcepub async fn pump_until(&mut self, deadline: Instant) -> Result<()>
pub async fn pump_until(&mut self, deadline: Instant) -> Result<()>
Drive the MAC until it has nothing to do or deadline arrives.
A quiet radio produces no MAC wake, so the timeouts that retire an unanswered acknowledgment need their own nudge afterwards.
Sourcepub async fn exchange(
&mut self,
manager: &mut NodeManager<MacHandle<'a, TokioPlatform<R, TokioFileCounterStore, TokioFileKeyValueStore>, IDENTITIES, PEERS, CHANNELS, ACKS, TX, FRAME, DUP>>,
request: &[u8],
give_up: Instant,
) -> Result<Outcome>
pub async fn exchange( &mut self, manager: &mut NodeManager<MacHandle<'a, TokioPlatform<R, TokioFileCounterStore, TokioFileKeyValueStore>, IDENTITIES, PEERS, CHANNELS, ACKS, TX, FRAME, DUP>>, request: &[u8], give_up: Instant, ) -> Result<Outcome>
Carry one exchange to its end, pumping the host in between, giving
up at give_up.
Auto Trait Implementations§
impl<'a, R> Freeze for NodeStack<'a, R>
impl<'a, R> !RefUnwindSafe for NodeStack<'a, R>
impl<'a, R> !Send for NodeStack<'a, R>
impl<'a, R> !Sync for NodeStack<'a, R>
impl<'a, R> Unpin for NodeStack<'a, R>
impl<'a, R> !UnwindSafe for NodeStack<'a, R>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more