Swim.Types
swim · API reference
type node_id =
| Node_id of stringval node_id_to_string : node_id -> stringval node_id_of_string : string -> node_idval equal_node_id : node_id -> node_id -> boolval compare_node_id : node_id -> node_id -> inttype incarnation =
| Incarnation of intval incarnation_to_int : incarnation -> intval incarnation_of_int : int -> incarnationval zero_incarnation : incarnationval compare_incarnation : incarnation -> incarnation -> intval incr_incarnation : incarnation -> incarnationtype addr = Eio.Net.Sockaddr.datagramtype node_info = {
id : node_id;
addr : addr;
meta : string;
}val make_node_info : id:node_id -> addr:addr -> meta:string -> node_infotype member_state =
| Alive
| Suspect
| Dead
| Leftval member_state_to_string : member_state -> stringval member_state_to_int : member_state -> intval member_state_of_int : int -> member_statetype member_snapshot = {
node : node_info;
state : member_state;
incarnation : incarnation;
state_change : Mtime.span;
}type protocol_msg =
| Ping of {
seq : int;
target : node_id;
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
| Msgpack_error of string
| Invalid_crcval decode_error_to_string : decode_error -> stringtype send_error =
| Node_unreachable
| Timeout
| Connection_resetval send_error_to_string : send_error -> stringtype node_event =
| Join of node_info
| Leave of node_info
| Update of node_info
| Suspect_event of node_info
| Alive_event of node_infotype config = {
bind_addr : string;
bind_port : int;
node_name : string option;
protocol_interval : float;
push_pull_interval : float; (* Seconds between periodic full state exchanges with a random member (anti-entropy; heals divergence missed by the bounded gossip budget). 0 disables. *)
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;
label : string;
encryption_enabled : bool;
gossip_verify_incoming : bool;
gossip_verify_outgoing : bool;
max_gossip_queue_depth : int;
}val default_config : configtype '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 : statsmodule Wire : sig ... endval ip_to_bytes : Eio.Net.Ipaddr.v4v6 -> stringval ip_of_bytes : string -> Eio.Net.Ipaddr.v4v6val default_vsn : int listval node_info_to_wire :
node_info ->
source_node:string ->
string * int * string * stringval node_info_of_wire :
name:string ->
addr:string ->
port:int ->
meta:string ->
node_infoval msg_to_wire :
self_name:string ->
self_port:int ->
protocol_msg ->
Wire.protocol_msgval msg_of_wire : default_port:int -> Wire.protocol_msg -> protocol_msg option