type node_id = Node_id of string [@@unboxed] val node_id_to_string : node_id -> string val node_id_of_string : string -> node_id val equal_node_id : node_id -> node_id -> bool val compare_node_id : node_id -> node_id -> int type incarnation = Incarnation of int [@@unboxed] val incarnation_to_int : incarnation -> int val incarnation_of_int : int -> incarnation val zero_incarnation : incarnation val compare_incarnation : incarnation -> incarnation -> int val incr_incarnation : incarnation -> incarnation type addr = Eio.Net.Sockaddr.datagram type node_info = { id : node_id; addr : addr; meta : string } val make_node_info : id:node_id -> addr:addr -> meta:string -> node_info type member_state = Alive | Suspect | Dead val member_state_to_string : member_state -> string type member_snapshot = { node : node_info; state : member_state; incarnation : incarnation; state_change : Mtime.span; } type protocol_msg = | Ping of { seq : int; sender : node_info } | Ping_req of { seq : int; target : node_id; sender : node_info } | Ack of { seq : int; responder : node_info; payload : string option } | Alive of { node : node_info; incarnation : incarnation } | Suspect of { node : node_id; incarnation : incarnation; suspector : node_id; } | Dead of { node : node_id; incarnation : incarnation; declarator : node_id } | User_msg of { topic : string; payload : string; origin : node_id } type packet = { cluster : string; primary : protocol_msg; piggyback : protocol_msg list; } type decode_error = | Invalid_magic | Unsupported_version of int | Truncated_message | Invalid_tag of int | Decryption_failed val decode_error_to_string : decode_error -> string type send_error = Node_unreachable | Timeout | Connection_reset val send_error_to_string : send_error -> string type node_event = | Join of node_info | Leave of node_info | Update of node_info | Suspect_event of node_info | Alive_event of node_info type config = { bind_addr : string; bind_port : int; node_name : string option; protocol_interval : float; probe_timeout : float; indirect_checks : int; suspicion_mult : int; suspicion_max_timeout : float; retransmit_mult : int; udp_buffer_size : int; tcp_timeout : float; send_buffer_count : int; recv_buffer_count : int; secret_key : string; cluster_name : string; } val default_config : config type 'a env = { stdenv : 'a; sw : Eio.Switch.t; } constraint 'a = < clock : _ Eio.Time.clock ; mono_clock : _ Eio.Time.Mono.t ; net : _ Eio.Net.t ; secure_random : _ Eio.Flow.source ; .. > type stats = { nodes_alive : int; nodes_suspect : int; nodes_dead : int; msgs_sent : int; msgs_received : int; msgs_dropped : int; queue_depth : int; buffers_available : int; buffers_total : int; } val empty_stats : stats