this repo has no description
1type node_id = Node_id of string [@@unboxed]
2
3val node_id_to_string : node_id -> string
4val node_id_of_string : string -> node_id
5val equal_node_id : node_id -> node_id -> bool
6val compare_node_id : node_id -> node_id -> int
7
8type incarnation = Incarnation of int [@@unboxed]
9
10val incarnation_to_int : incarnation -> int
11val incarnation_of_int : int -> incarnation
12val zero_incarnation : incarnation
13val compare_incarnation : incarnation -> incarnation -> int
14val incr_incarnation : incarnation -> incarnation
15
16type addr = Eio.Net.Sockaddr.datagram
17type node_info = { id : node_id; addr : addr; meta : string }
18
19val make_node_info : id:node_id -> addr:addr -> meta:string -> node_info
20
21type member_state = Alive | Suspect | Dead
22
23val member_state_to_string : member_state -> string
24
25type member_snapshot = {
26 node : node_info;
27 state : member_state;
28 incarnation : incarnation;
29 state_change : Mtime.span;
30}
31
32type protocol_msg =
33 | Ping of { seq : int; sender : node_info }
34 | Ping_req of { seq : int; target : node_id; sender : node_info }
35 | Ack of { seq : int; responder : node_info; payload : string option }
36 | Alive of { node : node_info; incarnation : incarnation }
37 | Suspect of {
38 node : node_id;
39 incarnation : incarnation;
40 suspector : node_id;
41 }
42 | Dead of { node : node_id; incarnation : incarnation; declarator : node_id }
43 | User_msg of { topic : string; payload : string; origin : node_id }
44
45type packet = {
46 cluster : string;
47 primary : protocol_msg;
48 piggyback : protocol_msg list;
49}
50
51type decode_error =
52 | Invalid_magic
53 | Unsupported_version of int
54 | Truncated_message
55 | Invalid_tag of int
56 | Decryption_failed
57
58val decode_error_to_string : decode_error -> string
59
60type send_error = Node_unreachable | Timeout | Connection_reset
61
62val send_error_to_string : send_error -> string
63
64type node_event =
65 | Join of node_info
66 | Leave of node_info
67 | Update of node_info
68 | Suspect_event of node_info
69 | Alive_event of node_info
70
71type config = {
72 bind_addr : string;
73 bind_port : int;
74 node_name : string option;
75 protocol_interval : float;
76 probe_timeout : float;
77 indirect_checks : int;
78 suspicion_mult : int;
79 suspicion_max_timeout : float;
80 retransmit_mult : int;
81 udp_buffer_size : int;
82 tcp_timeout : float;
83 send_buffer_count : int;
84 recv_buffer_count : int;
85 secret_key : string;
86 cluster_name : string;
87}
88
89val default_config : config
90
91type 'a env = {
92 stdenv : 'a;
93 sw : Eio.Switch.t;
94}
95 constraint
96 'a =
97 < clock : _ Eio.Time.clock
98 ; mono_clock : _ Eio.Time.Mono.t
99 ; net : _ Eio.Net.t
100 ; secure_random : _ Eio.Flow.source
101 ; .. >
102
103type stats = {
104 nodes_alive : int;
105 nodes_suspect : int;
106 nodes_dead : int;
107 msgs_sent : int;
108 msgs_received : int;
109 msgs_dropped : int;
110 queue_depth : int;
111 buffers_available : int;
112 buffers_total : int;
113}
114
115val empty_stats : stats