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_IDNode : P2p.S.NODE with type nid := Node_id.tView : P2p.S.VIEW with type nid := Node_id.t and type node := Node.tVicinity : P2p.S.GOSSIP with type node := Node.t and type view := View.tIo : 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 -> tinit node view view_len xchg_len periodinitializes 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.trun truns initiator thread: picks a random node fromviewto gossip with everyperiodseconds.If
?stopis provided, this initiator thread returns as soon as thestopthread is fulfilled.
val shutdown : t -> unitshutdown tstops initiator thread.In case
runwas called with astopargument, thestopthread is cancelled, otherwise it is fulfilled.