Module P2p_cyclon_lwt.Make

Functor building an implementation of Cyclon with Lwt given a Node_id, Node, gossip View, Cyclon implementation, and an Io event handler module.

Parameters

Signature

type t
type nid
type node
type view
type io
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 io initializes a CYCLON instance with the following configuration:

  • me - this node
  • view - initial view
  • view_len - max view length
  • xchg_len - number of entries to exchange at each period
  • period - gossip period, in seconds
  • io
val run : ?⁠stop:unit Lwt.t -> t -> unit Lwt.t

run t runs initiator thread: picks a random node from view to gossip with every period seconds.

If ?stop is provided, this initiator thread returns as soon as the stop thread is fulfilled.

val shutdown : t -> unit

shutdown t stops initiator thread.

In case run was called with a stop argument, the stop thread is cancelled, otherwise it is fulfilled.

val respond : t -> node -> view -> view Lwt.t

respond t src recvd merges received entries from a node and sends response

val view : t -> view

view t returns current view