package octez-libs
module Connections : sig ... end
module Message_cache :
Gossipsub_intf.MESSAGE_CACHE
with type Peer.t = Peer.t
and type 'a Peer.Map.t = 'a Peer.Map.t
and type Topic.t = Topic.t
and type Message_id.t = Message_id.t
and type Message.t = Message.t
and type Time.t = Time.t
type view = {
limits : limits;
parameters : parameters;
connections : Connections.t;
scores : Score.t Peer.Map.t;
ihave_per_heartbeat : int Peer.Map.t;
iwant_per_heartbeat : int Peer.Map.t;
mesh : Peer.Set.t Topic.Map.t;
fanout : fanout_peers Topic.Map.t;
backoff : Time.t Peer.Map.t Topic.Map.t;
message_cache : Message_cache.t;
rng : Random.State.t;
heartbeat_ticks : int64;
}
type connected_peers_filter =
| Direct
| Subscribed_to of Topic.t
| Score_above of {
threshold : Score.value;
}
When selecting a set of connected peers, one can specify some criteria to filter the result.
get_peers_in_topic_mesh topic state
returns the peers in the mesh of topic
.
val get_connected_peers :
?filters:connected_peers_filter list ->
view ->
Peer.t list
get_connected_peers ?filters view
returns the list of connected peers filtered by the given criteria.
get_our_topics state
returns the set of topics the local peer is subscribed to.
get_subscribed_topics peer state
returns the set of topics that are subscribed by peer
get_fanout_peers topic state
returns the fanout peers of topic
.
val get_peer_score : Peer.t -> view -> Score.value
get_peer_score peer view
returns the score of peer
.
get_peer_ihave_per_heartbeat peer view
returns the number of IHaves received from peer
since the last heartbeat.
get_peer_iwant_per_heartbeat peer view
returns the number of IWants sent to peer
since the last heartbeat.
get_peer_backoff topic peer view
returns the backoff time of peer
for topic
. Returns None
if the peer is not backoffed for topic
.
has_joined topic view
returns true if and only if the automaton is currently tracking messages for topic
. That is, the local peer has joined and hasn't left the topic
.
in_mesh peer topic view
returns true if and only if peer
is in the mesh of topic
.
is_direct peer view
returns true if and only if peer
is a direct peer.
is_outbound peer view
returns true if and only if peer
has an outbound connection.
val pp_connection : connection Fmt.t
val pp_connections : Connections.t Fmt.t
val pp_scores : Score.value Peer.Map.t Fmt.t
val pp_peer_map : 'a Fmt.t -> 'a Peer.Map.t Fmt.t
val pp_message_id_map : 'a Fmt.t -> 'a Message_id.Map.t Fmt.t
val pp_topic_map : 'a Fmt.t -> 'a Topic.Map.t Fmt.t
val pp_peer_set : Peer.Set.t Fmt.t
val pp_topic_set : Topic.Set.t Fmt.t