Module PocketMeshPeer.PeersConnections
Manages P2P connections and their state.
type t
;type connectionState
;Opaque variant type used internally to represent the current connection state. Use
classifyConnectionState
to get something to pattern-match on.
type taggedConnectionState
=
Simplified representation of P2P connection state ideal for pattern-matching.
let classifyConnectionState: connectionState => taggedConnectionState;
Converts opaque internal representation of the P2P connection state into the simplified type suitable for pattern-matching.
let getPeerConnectionState: Peer.Id.t => t => option(connectionState);
getPeerConnectionState(p, t)
returns state of P2P connection for a peer with IDp
or returnsNone
if there is no initiative to connect top
.
let fold: ('acc => Peer.Id.t => taggedConnectionState => 'acc) => 'acc => t => 'acc;
fold(f, acc, t)
can be used to iterate through all peers with P2P connection initiative and accumulate a value with a starting value ofacc
.