package octez-shell-libs
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=dbc3b675aee59c2c574e5d0a771193a2ecfca31e7a5bc5aed66598080596ce1c
sha512=b97ed762b9d24744305c358af0d20f394376b64bfdd758dd4a81775326caf445caa57c4f6445da3dd6468ff492de18e4c14af6f374dfcbb7e4d64b7b720e5e2a
doc/octez-shell-libs.p2p_test_common/Tezos_p2p_test_common/Node/index.html
Module Tezos_p2p_test_common.Node
Source
Simple p2p message used by the nodes.
Ping
is a none-message used by nodes in simple communication tests.BigPing
is used to add arbitrary long data (similar to mempools sent in the actual network) to test bandwidth and chunks splitting.
type t = {
iteration : int ref;
channel : (unit, unit) Process.Channel.t;
connect_handler : (message, metadata, metadata) Tezos_p2p.P2p_connect_handler.t;
pool : (message, metadata, metadata) Tezos_p2p.P2p_pool.t;
watcher : Tezos_base.TzPervasives.P2p_connection.P2p_event.t Lwt_watcher.input;
trigger : Tezos_p2p.P2p_trigger.t;
points : Tezos_base.TzPervasives.P2p_point.Id.t list;
trusted_points : Tezos_base.TzPervasives.P2p_point.Id.t list;
}
t
is a simple p2p nodes.
sync node
join node
to a synchronization barrier.
val gen_points :
int ->
Tezos_base.TzPervasives.P2p_addr.t ->
(Tezos_base.TzPervasives.P2p_point.Id.t * Unix.file_descr) list
gen_points npoints addr
generates npoints
points using the given addr
and an unused port given by the operating system by binding a fresh socket to the port 0
.
These sockets are left open and returned by the function with the generated point, so that the operating system cannot reuse this port while the socket is opened.
The returned sockets are also configured with option SO_REUSEPORT
so that user can bind its own socket using the generated point when desired. When a socket has finally been bounded to the given port, the user must close the socket to avoid file descriptor leaks.
val detach_nodes :
?timeout:float ->
?prefix:(int -> string) ->
?min_connections:(int -> int) ->
?max_connections:(int -> int) ->
?max_incoming_connections:(int -> int) ->
?p2p_versions:(int -> Tezos_base.TzPervasives.P2p_version.t list) ->
?msg_config:(int -> message Tezos_p2p.P2p_params.message_config) ->
?trusted:
(int ->
Tezos_base.TzPervasives.P2p_point.Id.t list ->
Tezos_base.TzPervasives.P2p_point.Id.t list) ->
(int -> t -> unit Tezos_base.TzPervasives.tzresult Lwt.t) ->
(Tezos_base.TzPervasives.P2p_point.Id.t * Unix.file_descr) list ->
unit Tezos_base.TzPervasives.tzresult Lwt.t
detach_nodes f points
creates a network with one node for each points
. f
is the behavior of each node. If the network is alive after ?timeout
seconds, if any is provided, the Timeout
error is returned. ?prefix
associates a prefix used for logs to each nodes
. ?min_connections
, ?max_connections
, ?max_incoming_connections
, ?p2p_versions
and ?msg_config
are used to configure the connect handler of each nodes. ?trusted
is used to configure the pool of each nodes.
With each point of points
a file descriptor generated by the system that holds the point should be given. This file descriptor will be properly closed by this function. See gen_points
for more details.