package octez-shell-libs

  1. Overview
  2. Docs
Octez shell libraries

Install

Dune Dependency

Authors

Maintainers

Sources

tezos-octez-v20.1.tag.bz2
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65

doc/octez-shell-libs.p2p/Tezos_p2p/P2p_conn/index.html

Module Tezos_p2p.P2p_connSource

Type of a connection to a peer, parametrized by the type of messages exchanged as well as meta-information associated to a peer and a connection. It wraps a P2p_socket.t, adding meta-information and data-structures describing a more fine-grained logical state of the connection. It also set up an answering worker that responds to the messages P2p_message.t using the callback functions of a P2p_answerer.t.

Sourcetype ('msg, 'peer, 'conn) t
Sourceval create : conn:('msg P2p_message.t, 'conn) P2p_socket.t -> point_info:('msg, 'peer, 'conn) t P2p_point_state.Info.t option -> peer_info:(('msg, 'peer, 'conn) t, 'peer, 'conn) P2p_peer_state.Info.t -> messages:(int * 'msg) Tezos_stdlib.Lwt_pipe.Maybe_bounded.t -> canceler:Lwt_canceler.t -> greylister:(unit -> unit) -> callback:'msg P2p_answerer.t -> disable_peer_discovery:bool -> Tezos_base.TzPervasives.Network_version.t -> ('msg, 'peer, 'conn) t
Sourceval peer_id : ('msg, 'peer, 'conn) t -> Tezos_base.TzPervasives.P2p_peer.Id.t
Sourceval private_node : ('msg, 'peer, 'conn) t -> bool

private_node t returns 'true' if the node associated to this connection is in private mode

Sourceval trusted_node : ('msg, 'peer, 'conn) t -> bool

trusted_node t returns 'true' if the node associated to this connection is trusted

Sourceval info : ('msg, 'peer, 'conn) t -> 'conn Tezos_base.TzPervasives.P2p_connection.Info.t
Sourceval local_metadata : ('msg, 'peer, 'conn) t -> 'conn
Sourceval remote_metadata : ('msg, 'peer, 'conn) t -> 'conn
Sourceval stat : ('msg, 'peer, 'conn) t -> Tezos_base.TzPervasives.P2p_stat.t

stat t is a snapshot of current bandwidth usage for t.

Sourceval read : ('msg, 'peer, 'conn) t -> 'msg Tezos_base.TzPervasives.tzresult Lwt.t

read t returns a message popped from t's app message queue, or fails with Connection_closed.

Sourceval is_readable : ('msg, 'peer, 'conn) t -> unit Tezos_base.TzPervasives.tzresult Lwt.t

is_readable t returns when there is at least one message ready to be read.

Sourceval write_bootstrap : ('msg, 'peer, 'conn) t -> bool Tezos_base.TzPervasives.tzresult
Sourceval write : ('msg, 'peer, 'conn) t -> 'msg -> unit Tezos_base.TzPervasives.tzresult Lwt.t

write t msg is P2p_socket.write t' msg where t' is the internal P2p_socket.t inside t.

Sourceval write_sync : ('msg, 'peer, 'conn) t -> 'msg -> unit Tezos_base.TzPervasives.tzresult Lwt.t

write_sync t msg is P2p_socket.write_sync t' msg where t' is the internal P2p_socket.t inside t.

Sourceval write_now : ('msg, 'peer, 'conn) t -> 'msg -> bool Tezos_base.TzPervasives.tzresult

write_now t msg is P2p_socket.write_now t' msg where t' is the internal P2p_socket.t inside t.

Sourceval encode : ('msg, 'peer, 'conn) t -> 'msg -> 'msg P2p_message.t P2p_socket.encoded_message Tezos_base.TzPervasives.tzresult

encode t messsage encodes a message to be used with write_encoded_now. It is particularly useful to avoid encoding several times the same message.

Sourceval write_encoded_now : ('msg, 'peer, 'conn) t -> 'msg P2p_message.t P2p_socket.encoded_message -> bool Tezos_base.TzPervasives.tzresult

write_encoded_now t msg is P2p_socket.write_now t' msg where t' is the internal P2p_socket.t inside t and msg has been pre-encoded using encode. msg will be overwritten and should not be used after this invocation.

Sourceval equal_sock : ('msg, 'peer, 'conn) t -> ('msg, 'peer, 'conn) t -> bool
Sourceval disconnect : ?wait:bool -> reason:P2p_disconnection_reason.t -> ('msg, 'peer, 'conn) t -> unit Lwt.t
Sourceval disconnect_reason : ('msg, 'peer, 'conn) t -> P2p_disconnection_reason.t option
Sourceval close : reason:P2p_disconnection_reason.t -> ('msg, 'peer, 'conn) t -> unit Lwt.t
Sourceval negotiated_version : ('msg, 'peer, 'conn) t -> Tezos_base.TzPervasives.Network_version.t

Returns the network version that will be used for this connection. This network version is the best version compatible with the versions supported by ours and the remote peer.

OCaml

Innovation. Community. Security.