Module P2p_tac_lwt.Make
Functor building an implementation of TAC with Lwt given a Node_id
, Node
, gossip View
, Tac
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
Tac : P2p.S.GOSSIP with type node := Node.t and type view := View.t
Io : S.TAC_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 io
initializes a TAC instance- parameter me
this node
- parameter view
initial TAC view
- parameter xview
explicit view
- parameter view_len
max view length
- parameter xchg_len
number of entries to exchange at each period
- parameter period
gossip period, in seconds
- parameter io
network I/O implementation
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.