pub struct LocalNode<M: MacBackend> { /* private fields */ }Expand description
Per-identity application handle.
LocalNode owns its channel membership set via shared interior state.
Different LocalNode instances (for different identities) may join
different channel sets.
Implementations§
Source§impl<M: MacBackend> LocalNode<M>
impl<M: MacBackend> LocalNode<M>
Sourcepub fn identity_id(&self) -> LocalIdentityId
pub fn identity_id(&self) -> LocalIdentityId
The identity slot this node operates on.
Sourcepub fn peer(&self, key: PublicKey) -> Result<PeerConnection<Self>, NodeError<M>>
pub fn peer(&self, key: PublicKey) -> Result<PeerConnection<Self>, NodeError<M>>
Create a peer connection (registers peer in MAC if new).
pub fn on_receive<F>(&self, handler: F) -> Subscription
pub fn on_node_discovered<F>(&self, handler: F) -> Subscription
pub fn on_beacon<F>(&self, handler: F) -> Subscription
pub fn on_mac_command<F>(&self, handler: F) -> Subscription
pub fn on_ack_received<F>(&self, handler: F) -> Subscription
pub fn on_ack_timeout<F>(&self, handler: F) -> Subscription
pub fn on_pfs_established<F>(&self, handler: F) -> Subscription
pub fn on_pfs_ended<F>(&self, handler: F) -> Subscription
pub async fn request_pfs( &self, peer: &PublicKey, duration_minutes: u16, options: &SendOptions, ) -> Result<SendProgressTicket, NodeError<M>>
pub async fn end_pfs( &self, peer: &PublicKey, options: &SendOptions, ) -> Result<(), NodeError<M>>
pub fn pfs_status(&self, peer: &PublicKey) -> Result<PfsStatus, NodeError<M>>
Sourcepub fn join(&self, channel: &Channel) -> Result<BoundChannel<M>, NodeError<M>>
pub fn join(&self, channel: &Channel) -> Result<BoundChannel<M>, NodeError<M>>
Join a channel. Registers the channel key in the MAC if this is the first node to join it. Returns the bound channel handle.
Sourcepub fn leave(&self, channel: &Channel) -> Result<(), NodeError<M>>
pub fn leave(&self, channel: &Channel) -> Result<(), NodeError<M>>
Leave a channel. Marks the membership entry inactive and bumps that entry’s generation counter.
Sourcepub fn bound_channel(&self, channel: &Channel) -> Option<BoundChannel<M>>
pub fn bound_channel(&self, channel: &Channel) -> Option<BoundChannel<M>>
Get a handle to an already-joined channel.
Sourcepub fn bound_channels(&self) -> Vec<BoundChannel<M>>
pub fn bound_channels(&self) -> Vec<BoundChannel<M>>
List all joined channels.
Trait Implementations§
Source§impl<M: MacBackend> Transport for LocalNode<M>
impl<M: MacBackend> Transport for LocalNode<M>
type Error = NodeError<M>
Source§async fn send(
&self,
to: &PublicKey,
payload: &[u8],
options: &SendOptions,
) -> Result<SendProgressTicket, Self::Error>
async fn send( &self, to: &PublicKey, payload: &[u8], options: &SendOptions, ) -> Result<SendProgressTicket, Self::Error>
Send a payload to a specific destination. Read more
Source§async fn send_all(
&self,
payload: &[u8],
options: &SendOptions,
) -> Result<SendProgressTicket, Self::Error>
async fn send_all( &self, payload: &[u8], options: &SendOptions, ) -> Result<SendProgressTicket, Self::Error>
Send a payload to all reachable nodes in this transport’s scope. Read more
Auto Trait Implementations§
impl<M> Freeze for LocalNode<M>where
M: Freeze,
impl<M> !RefUnwindSafe for LocalNode<M>
impl<M> !Send for LocalNode<M>
impl<M> !Sync for LocalNode<M>
impl<M> Unpin for LocalNode<M>where
M: Unpin,
impl<M> !UnwindSafe for LocalNode<M>
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
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)