NodeStack

Struct NodeStack 

Source
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: Instant

Implementations§

Source§

impl<'a, R: Radio> NodeStack<'a, R>
where R::Error: Debug,

Source

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.

Source

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.

Source

pub fn now_ms(&self) -> u64

Source

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.

Source

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> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

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> Same for T

Source§

type Output = T

Should always be Self
§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.
Source§

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