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 async fn peer(
&self,
key: PublicKey,
) -> Result<PeerConnection<Self>, NodeError<M>>
pub async 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) -> Subscriptionwhere
F: FnMut(PublicKey, &OwnedMacCommand) + 'static,
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) -> Subscriptionwhere
F: FnMut(PublicKey) + 'static,
pub fn on_pfs_ended<F>(&self, handler: F) -> Subscriptionwhere
F: FnMut(PublicKey) + 'static,
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 async fn pfs_status( &self, peer: &PublicKey, ) -> Result<PfsStatus, NodeError<M>>
Sourcepub async fn join(
&self,
channel: &Channel,
) -> Result<BoundChannel<M>, NodeError<M>>
pub async 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§
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)