ligo/src/node/shell/tezos_p2p.mli

85 lines
2.2 KiB
OCaml
Raw Normal View History

open P2p
type net
(** A faked p2p layer, which do not initiate any connection
nor open any listening socket *)
val faked_network : net
(** Main network initialisation function *)
val create : config:config -> limits:limits -> net Lwt.t
(** A maintenance operation : try and reach the ideal number of peers *)
val maintain : net -> unit Lwt.t
2017-01-14 13:14:17 +01:00
(** Voluntarily drop some connections and replace them by new buddies *)
val roll : net -> unit Lwt.t
(** Close all connections properly *)
val shutdown : net -> unit Lwt.t
(** A connection to a peer *)
2017-01-14 13:14:17 +01:00
type connection
2017-01-14 13:14:17 +01:00
(** Access the domain of active connections *)
val connections : net -> connection list
2017-01-14 13:14:17 +01:00
(** Return the active connection with identity [gid] *)
val find_connection : net -> Gid.t -> connection option
2017-01-14 13:14:17 +01:00
(** Access the info of an active connection. *)
val connection_info : net -> connection -> Connection_info.t
(** Accessors for meta information about a global identifier *)
2016-11-15 01:52:39 +01:00
type metadata = unit
2017-01-14 13:14:17 +01:00
val get_metadata : net -> Gid.t -> metadata option
val set_metadata : net -> Gid.t -> metadata -> unit
type net_id = Store.net_id
type msg =
| Discover_blocks of net_id * Block_hash.t list (* Block locator *)
| Block_inventory of net_id * Block_hash.t list
| Get_blocks of Block_hash.t list
| Block of MBytes.t
| Current_operations of net_id
| Operation_inventory of net_id * Operation_hash.t list
| Get_operations of Operation_hash.t list
| Operation of MBytes.t
| Get_protocols of Protocol_hash.t list
| Protocol of MBytes.t
2017-01-14 13:14:17 +01:00
(** Wait for a payload from any connection in the network *)
val recv : net -> (connection * msg) Lwt.t
2017-01-14 13:14:17 +01:00
(** [send net conn msg] is a thread that returns when [msg] has been
2016-11-28 22:18:00 +01:00
successfully enqueued in the send queue. *)
2017-01-14 13:14:17 +01:00
val send : net -> connection -> msg -> unit Lwt.t
2017-01-14 13:14:17 +01:00
(** [try_send net conn msg] is [true] if [msg] has been added to the
2016-11-28 22:18:00 +01:00
send queue for [peer], [false] otherwise *)
2017-01-14 13:14:17 +01:00
val try_send : net -> connection -> msg -> bool
(** Send a payload to all peers *)
val broadcast : net -> msg -> unit
2017-01-14 13:14:17 +01:00
(**/**)
module Raw : sig
type 'a t =
| Bootstrap
| Advertise of Point.t list
2017-01-14 13:14:17 +01:00
| Message of 'a
| Disconnect
type message = msg t
val encoding: message Data_encoding.t
val supported_versions: Version.t list
2017-01-14 13:14:17 +01:00
end