Module Cyclon_lwt

CYCLON: Inexpensive Membership Management for Unstructured P2P Overlays

Cyclon_lwt

type 'data t
val init : Cyclon.View.key -> 'data -> 'data Cyclon.node Cyclon.View.t -> int -> int -> float -> ('data t -> Cyclon.View.key -> 'data -> 'data Cyclon.node Cyclon.View.t -> 'data Cyclon.node Cyclon.View.t Lwt.t) -> ('data t -> Cyclon.View.key -> 'data -> 'data Cyclon.node Cyclon.View.t -> 'data Cyclon.node Cyclon.View.t -> 'data Cyclon.node Cyclon.View.t Lwt.t) -> ('data t -> Cyclon.View.key -> 'data -> 'data Cyclon.node Cyclon.View.t -> unit Lwt.t) -> 'data t

init my_nid my_ndata view view_len xchg_len period send_cb recv_cb view_cb initializes a CYCLON instance with the following configuration:

  • my_nid - ID of this node
  • my_ndata - data associated with my_nid in view
  • view - map of neighbour entries with node ID as key
  • view_len - max view length
  • xchg_len - number of entries to exchange at each period
  • period - gossip period, in seconds
  • send_cb nid ndata xchg - send xchg entries to node (nid, ndata)
  • recv_cb my_nid my_ndata view recvd - called after receiving entries during an exchange; allows rewriting recvd entries with the returned value, thus allows using a stream sampler to provide uniformly random nodes instead of the possibly biased exchanged nodes
  • view_cb my_nid my_ndata view - called after the view has been updated
val view : 'data t -> 'data Cyclon.node Cyclon.View.t

view t retrieve current view

val run : 'data t -> unit Lwt.t

run t send_cb recv_cb view_cb run initiator: pick a random node from view to gossip with every period seconds *

val recv : 'data t -> Cyclon.View.key -> 'data -> 'data Cyclon.node Cyclon.View.t -> 'data Cyclon.node Cyclon.View.t Lwt.t

recv t rnid rndata recvd send_cb recv_cb receives a gossip message from a node (rnid, rndata) and sends a response; runs recv_cb with the received entries, and returns updated view