pub struct MeshNodeFSM { /* private fields */ }Expand description
Top-level state machine for a mesh node.
Owns the local Identity, every per-peer HandshakeFSM, and the
coarse FSMState. MeshNodeFSM::process is the single entry point:
feed it an Input, get back a Vec<Output>. No I/O happens here —
outputs are commands the driver must execute.
Implementations§
Source§impl MeshNodeFSM
impl MeshNodeFSM
pub fn new() -> Self
pub fn with_identity(identity: Identity) -> Self
pub fn state(&self) -> FSMState
pub fn id(&self) -> &PeerID
pub fn is_connected(&self, peer: &PeerID) -> bool
Sourcepub fn channel_open_for_msg<Msg: UserMsgPayload>(
&self,
peer: &PeerID,
msg: &MsgPayload<Msg>,
) -> bool
pub fn channel_open_for_msg<Msg: UserMsgPayload>( &self, peer: &PeerID, msg: &MsgPayload<Msg>, ) -> bool
Returns true if peer is allowed to deliver msg to us right now.
pub fn connected_peers(&self) -> HashSet<PeerID>
pub fn connected_number(&self) -> usize
pub fn handle_init_handshake<Msg: UserMsgPayload>( &mut self, with: PeerID, mode: HandshakeMode, strategy: HandshakeStrategy, ) -> Result<Vec<Output<Msg>>>
pub fn handle_init_open_offer<Msg: UserMsgPayload>( &mut self, ) -> Result<Vec<Output<Msg>>>
pub fn handle_open_offer_created<Msg: UserMsgPayload>( &mut self, sdp: String, ) -> Result<Vec<Output<Msg>>>
pub fn handle_send<Msg: UserMsgPayload>( &mut self, peer_to: PeerID, data: MsgPayload<Msg>, ) -> Result<Vec<Output<Msg>>>
pub fn handle_broadcast<Msg: UserMsgPayload>( &mut self, data: MsgPayload<Msg>, ) -> Result<Vec<Output<Msg>>>
pub fn process<Msg: UserMsgPayload>( &mut self, input: Input<Msg>, ) -> Result<Vec<Output<Msg>>>
pub fn identity(&self) -> &Identity
Sourcepub fn connections_snapshot(
&self,
) -> Vec<(PeerID, HandshakeState, HandshakeMode)>
pub fn connections_snapshot( &self, ) -> Vec<(PeerID, HandshakeState, HandshakeMode)>
Debug: snapshot of every connection’s (peer, state, mode).
Sourcepub fn pending_handshakes_len(&self) -> usize
pub fn pending_handshakes_len(&self) -> usize
Debug: number of contexts in pending_handshakes.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MeshNodeFSM
impl RefUnwindSafe for MeshNodeFSM
impl Send for MeshNodeFSM
impl Sync for MeshNodeFSM
impl Unpin for MeshNodeFSM
impl UnsafeUnpin for MeshNodeFSM
impl UnwindSafe for MeshNodeFSM
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more