package octez-libs

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type connection = {
  1. topics : Topic.Set.t;
  2. direct : bool;
  3. outbound : bool;
}
type fanout_peers = {
  1. peers : Peer.Set.t;
  2. last_published_time : Time.t;
}
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 = {
  1. limits : limits;
  2. parameters : parameters;
  3. connections : Connections.t;
  4. scores : Score.t Peer.Map.t;
  5. ihave_per_heartbeat : int Peer.Map.t;
  6. iwant_per_heartbeat : int Peer.Map.t;
  7. mesh : Peer.Set.t Topic.Map.t;
  8. fanout : fanout_peers Topic.Map.t;
  9. backoff : Time.t Peer.Map.t Topic.Map.t;
  10. message_cache : Message_cache.t;
  11. rng : Stdlib.Random.State.t;
  12. heartbeat_ticks : int64;
}
type connected_peers_filter =
  1. | Direct
  2. | Subscribed_to of Topic.t
  3. | Score_above of {
    1. threshold : Score.value;
    }

When selecting a set of connected peers, one can specify some criteria to filter the result.

val view : state -> view
val get_peers_in_topic_mesh : Topic.t -> view -> Peer.t list

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.

val get_our_topics : view -> Topic.t list

get_our_topics state returns the set of topics the local peer is subscribed to.

val get_subscribed_topics : Peer.t -> view -> Topic.t list

get_subscribed_topics peer state returns the set of topics that are subscribed by peer

val get_fanout_peers : Topic.t -> view -> Peer.t list

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.

val get_peer_ihave_per_heartbeat : Peer.t -> view -> int

get_peer_ihave_per_heartbeat peer view returns the number of IHaves received from peer since the last heartbeat.

val get_peer_iwant_per_heartbeat : Peer.t -> view -> int

get_peer_iwant_per_heartbeat peer view returns the number of IWants sent to peer since the last heartbeat.

val get_peer_backoff : Topic.t -> Peer.t -> view -> Time.t option

get_peer_backoff topic peer view returns the backoff time of peer for topic. Returns None if the peer is not backoffed for topic.

val limits : view -> limits
val has_joined : Topic.t -> view -> bool

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.

val in_mesh : Topic.t -> Peer.t -> view -> bool

in_mesh peer topic view returns true if and only if peer is in the mesh of topic.

val is_direct : Peer.t -> view -> bool

is_direct peer view returns true if and only if peer is a direct peer.

val is_outbound : Peer.t -> view -> bool

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
OCaml

Innovation. Community. Security.