Module P2p_vicinity_lwt.Make
Functor building an implementation of Vicinity with Lwt given a Node_id
, Node
, gossip View
, Vicinity
implementation, and an Io
event handler module.
Parameters
Node_id : P2p.S.NODE_ID
Node : P2p.S.NODE with type nid := Node_id.t
View : P2p.S.VIEW with type nid := Node_id.t and type node := Node.t
Vicinity : P2p.S.GOSSIP with type node := Node.t and type view := View.t
Io : S.VICINITY_IO with type nid := Node_id.t and type node := Node.t and type view := View.t
Signature
val init : me:node -> view:view -> view_len:int -> xchg_len:int -> period:float -> io:io -> t
init node view view_len xchg_len period
initializes a VICINITY instance with the following configuration:my_node
- this nodeview
- initial viewview_len
- max view lengthxchg_len
- number of entries to exchange at each periodperiod
- gossip period, in seconds
val run : ?stop:unit Lwt.t -> t -> unit Lwt.t
run t
runs initiator thread: picks a random node fromview
to gossip with everyperiod
seconds.If
?stop
is provided, this initiator thread returns as soon as thestop
thread is fulfilled.
val shutdown : t -> unit
shutdown t
stops initiator thread.In case
run
was called with astop
argument, thestop
thread is cancelled, otherwise it is fulfilled.