exception Bigsubstring_allocator_got_invalid_requested_size of int
val bigsubstring_allocator : ?initial_size:int -> unit -> Core.Std.Int.t -> Core.Std.Bigsubstring.t
module type Name = sig .. end
type t
include Core.Std.Hashable with type t := t
include Core.Std.Binable with type t := t
include Core.Std.Stringable with type t := t
include Core.Std.Comparable with type t := t
type 'a marshal_fun = 'a -> Core.Std.Bigsubstring.t option
type 'a unmarshal_fun = Core.Std.Bigsubstring.t -> 'a option
val protocol_version : [ `Prod | `Test ] ref
module Version : sig .. end
type t
val min : t -> t -> t
val of_int : int -> t
val to_int : t -> int
val add : t -> int -> t
include Core.Std.Hashable with type t := t
val t_of_sexp : Sexplib.Sexp.t -> t
val sexp_of_t : t -> Sexplib.Sexp.t
val bin_t : t Core.Std.Bin_prot.Type_class.t
val bin_read_t : t Core.Std.Bin_prot.Read.reader
val __bin_read_t__ : (int -> t) Core.Std.Bin_prot.Read.reader
val bin_reader_t : t Core.Std.Bin_prot.Type_class.reader
val bin_size_t : t Core.Std.Bin_prot.Size.sizer
val bin_write_t : t Core.Std.Bin_prot.Write.writer
val bin_writer_t : t Core.Std.Bin_prot.Type_class.writer
module type Versions = sig .. end
val low_version : Version.t
val prod_version : Version.t
val test_version : Version.t
module type Datumable = sig .. end
This module describes the type of a given direction of message flow. For example it might describe the type of messages from the client to the server.
type datum
include Versions
val lookup_marshal_fun : Version.t -> (datum marshal_fun, exn) Core.Std.Result.t
lookup_marshal_fun v This function takes a version v, and returns a function that will downgrade (if necessary) the current version to v and then write it to a bigsubstring. It is perfectly fine if one message becomes zero or more messages as a result of downgrading, this is why the marshal fun returns a list. The contents of these buffers will be copied immediatly, so it is safe to reuse the same bigstring for multiple marshals.
val lookup_unmarshal_fun : Version.t -> (datum unmarshal_fun, exn) Core.Std.Result.t
lookup_unmarshal_fun v This function takes a version v, and returns a function that unmarshals a message and upgrades it, returning zero or more messages as a result of the upgrade. The bigsubstring is only guaranteed to contain valid data until the unmarshal function returns, after which it may be overwritten immediatly.
module type Datum = sig .. end
type t
include Datumable with type datum = t
module type Mode = sig .. end
This module may be used to implement modes for clients/servers. A common scheme is to have two modes, Test, and Production, and to want to maintain the invariant that clients in mode Test may not talk to servers in mode Production, and that clients in mode Production may not talk to servers in mode Test. Versioned connection will check that the mode of the client is the same as the mode of the server.

If you don't care about modes, just use Dont_care_about_mode.

type t
val current : unit -> t
val (=) : t -> t -> bool
include Core.Std.Binable with type t := t
include Core.Std.Sexpable with type t := t
module Dont_care_about_mode : sig .. end
type t = 
|Dont_care_about_mode
val __t_of_sexp__ : Sexplib.Sexp.t -> t
val t_of_sexp : Sexplib.Sexp.t -> t
val sexp_of_t : t -> Sexplib.Sexp.t
val bin_size_t : 'a -> int
val bin_write_t : Core.Std.Bin_prot.Common.buf ->
pos:Core.Std.Bin_prot.Common.pos -> t -> Core.Std.Bin_prot.Common.pos
val bin_writer_t : t Core.Std.Bin_prot.Type_class.writer
val __bin_read_t__ : 'a -> pos_ref:Core.Std.Bin_prot.Common.pos ref -> 'b -> 'c
val bin_read_t : Core.Std.Bin_prot.Common.buf -> pos_ref:Core.Std.Bin_prot.Common.pos_ref -> t
val bin_reader_t : t Core.Std.Bin_prot.Type_class.reader
val bin_t : t Core.Std.Bin_prot.Type_class.t
val current : unit -> t
val (=) : t -> t -> bool
module Read_result : sig .. end
type ('name, 'data) t = {
from : 'name;
ip : string;
time_received : Core.Std.Time.t;
time_sent : Core.Std.Time.t;
data : 'data;
}
val __t_of_sexp__ : 'name 'data.
  (Sexplib.Sexp.t -> 'name) ->
  (Sexplib.Sexp.t -> 'data) -> Sexplib.Sexp.t -> ('name, 'data) t
val t_of_sexp : 'name 'data.
  (Sexplib.Sexp.t -> 'name) ->
  (Sexplib.Sexp.t -> 'data) -> Sexplib.Sexp.t -> ('name, 'data) t
val sexp_of_t : 'name 'data.
  ('name -> Sexplib.Sexp.t) ->
  ('data -> Sexplib.Sexp.t) -> ('name, 'data) t -> Sexplib.Sexp.t
val bin_size_t : ('a -> int) -> ('b -> int) -> ('a, 'b) t -> int
val bin_write_t : (Bin_prot.Common.buf -> pos:'a -> 'b -> Bin_prot.Common.pos) ->
(Bin_prot.Common.buf -> pos:Core_kernel.Std.Bin_prot.Common.pos -> 'c -> 'd) ->
Bin_prot.Common.buf -> pos:'a -> ('b, 'c) t -> 'd
val bin_writer_t : 'a Core.Std.Bin_prot.Type_class.writer ->
'b Core.Std.Bin_prot.Type_class.writer ->
('a, 'b) t Core.Std.Bin_prot.Type_class.writer
val __bin_read_t__ : 'a -> 'b -> 'c -> pos_ref:Core.Std.Bin_prot.Common.pos ref -> 'd -> 'e
val bin_read_t : (Bin_prot.Common.buf -> pos_ref:Bin_prot.Common.pos_ref -> 'a) ->
(Bin_prot.Common.buf -> pos_ref:Bin_prot.Common.pos_ref -> 'b) ->
Bin_prot.Common.buf -> pos_ref:Bin_prot.Common.pos_ref -> ('a, 'b) t
val bin_reader_t : 'a Core.Std.Bin_prot.Type_class.reader ->
'b Core.Std.Bin_prot.Type_class.reader ->
('a, 'b) t Core.Std.Bin_prot.Type_class.reader
val bin_t : 'a Core.Std.Bin_prot.Type_class.t ->
'b Core.Std.Bin_prot.Type_class.t ->
('a, 'b) t Core.Std.Bin_prot.Type_class.t
module Server_msg : sig .. end
module Control : sig .. end
type 'name t = 
|Unauthorized of string
|Duplicate of 'name
|Wrong_mode of 'name
|Too_many_clients of string
|Almost_full of int
|Connect of 'name
|Disconnect of 'name * Core.Std.Sexp.t
|Parse_error of 'name * string
|Protocol_error of string
val bin_size_t : ('a -> int) -> 'a t -> int
val bin_write_t : (Core.Std.Bin_prot.Common.buf ->
 pos:Core.Std.Bin_prot.Common.pos -> 'a -> Bin_prot.Common.pos) ->
Core.Std.Bin_prot.Common.buf ->
pos:Core.Std.Bin_prot.Common.pos -> 'a t -> Bin_prot.Common.pos
val bin_writer_t : 'a Core.Std.Bin_prot.Type_class.writer ->
'a t Core.Std.Bin_prot.Type_class.writer
val __bin_read_t__ : 'a -> 'b -> pos_ref:Core.Std.Bin_prot.Common.pos ref -> 'c -> 'd
val bin_read_t : (Core.Std.Bin_prot.Common.buf ->
 pos_ref:Core.Std.Bin_prot.Common.pos_ref -> 'a) ->
Core.Std.Bin_prot.Common.buf ->
pos_ref:Core.Std.Bin_prot.Common.pos_ref -> 'a t
val bin_reader_t : 'a Core.Std.Bin_prot.Type_class.reader ->
'a t Core.Std.Bin_prot.Type_class.reader
val bin_t : 'a Core.Std.Bin_prot.Type_class.t -> 'a t Core.Std.Bin_prot.Type_class.t
val __t_of_sexp__ : 'name. (Sexplib.Sexp.t -> 'name) -> Sexplib.Sexp.t -> 'name t
val t_of_sexp : 'name. (Sexplib.Sexp.t -> 'name) -> Sexplib.Sexp.t -> 'name t
val sexp_of_t : 'name. ('name -> Sexplib.Sexp.t) -> 'name t -> Sexplib.Sexp.t
type ('name, 'data) t = 
|Control of 'name Control.t
|Data of ('name, 'data) Read_result.t
module Client_msg : sig .. end
module Control : sig .. end
type 'name t = 
|Connecting
|Connect of 'name
|Disconnect of 'name * Core.Std.Sexp.t
|Parse_error of 'name * string
|Protocol_error of string
val bin_size_t : ('a -> int) -> 'a t -> int
val bin_write_t : (Core.Std.Bin_prot.Common.buf ->
 pos:Core.Std.Bin_prot.Common.pos -> 'a -> Core.Std.Bin_prot.Common.pos) ->
Core.Std.Bin_prot.Common.buf ->
pos:Core.Std.Bin_prot.Common.pos -> 'a t -> Core.Std.Bin_prot.Common.pos
val bin_writer_t : 'a Core.Std.Bin_prot.Type_class.writer ->
'a t Core.Std.Bin_prot.Type_class.writer
val __bin_read_t__ : 'a -> 'b -> pos_ref:Core.Std.Bin_prot.Common.pos ref -> 'c -> 'd
val bin_read_t : (Core.Std.Bin_prot.Common.buf ->
 pos_ref:Core.Std.Bin_prot.Common.pos_ref -> 'a) ->
Core.Std.Bin_prot.Common.buf ->
pos_ref:Core.Std.Bin_prot.Common.pos_ref -> 'a t
val bin_reader_t : 'a Core.Std.Bin_prot.Type_class.reader ->
'a t Core.Std.Bin_prot.Type_class.reader
val bin_t : 'a Core.Std.Bin_prot.Type_class.t -> 'a t Core.Std.Bin_prot.Type_class.t
val __t_of_sexp__ : 'name. (Sexplib.Sexp.t -> 'name) -> Sexplib.Sexp.t -> 'name t
val t_of_sexp : 'name. (Sexplib.Sexp.t -> 'name) -> Sexplib.Sexp.t -> 'name t
val sexp_of_t : 'name. ('name -> Sexplib.Sexp.t) -> 'name t -> Sexplib.Sexp.t
type ('name, 'data) t = 
|Control of 'name Control.t
|Data of ('name, 'data) Read_result.t
val __t_of_sexp__ : 'name 'data.
  (Sexplib.Sexp.t -> 'name) ->
  (Sexplib.Sexp.t -> 'data) -> Sexplib.Sexp.t -> ('name, 'data) t
val t_of_sexp : 'name 'data.
  (Sexplib.Sexp.t -> 'name) ->
  (Sexplib.Sexp.t -> 'data) -> Sexplib.Sexp.t -> ('name, 'data) t
val sexp_of_t : 'name 'data.
  ('name -> Sexplib.Sexp.t) ->
  ('data -> Sexplib.Sexp.t) -> ('name, 'data) t -> Sexplib.Sexp.t
val bin_size_t : ('a -> int) -> ('b -> int) -> ('a, 'b) t -> int
val bin_write_t : (Bin_prot.Common.buf ->
 pos:Core.Std.Bin_prot.Common.pos -> 'a -> Bin_prot.Common.pos) ->
(Bin_prot.Common.buf ->
 pos:Core_kernel.Std.Bin_prot.Common.pos ->
 'b -> Core.Std.Bin_prot.Common.pos) ->
Core.Std.Bin_prot.Common.buf ->
pos:Core.Std.Bin_prot.Common.pos ->
('a, 'b) t -> Core.Std.Bin_prot.Common.pos
val bin_writer_t : 'a Core.Std.Bin_prot.Type_class.writer ->
'b Core.Std.Bin_prot.Type_class.writer ->
('a, 'b) t Core.Std.Bin_prot.Type_class.writer
val __bin_read_t__ : 'a -> 'b -> 'c -> pos_ref:Core.Std.Bin_prot.Common.pos ref -> 'd -> 'e
val bin_read_t : (Bin_prot.Common.buf -> pos_ref:Bin_prot.Common.pos_ref -> 'a) ->
(Bin_prot.Common.buf -> pos_ref:Bin_prot.Common.pos_ref -> 'b) ->
Core.Std.Bin_prot.Common.buf ->
pos_ref:Core.Std.Bin_prot.Common.pos_ref -> ('a, 'b) t
val bin_reader_t : 'a Core.Std.Bin_prot.Type_class.reader ->
'b Core.Std.Bin_prot.Type_class.reader ->
('a, 'b) t Core.Std.Bin_prot.Type_class.reader
val bin_t : 'a Core.Std.Bin_prot.Type_class.t ->
'b Core.Std.Bin_prot.Type_class.t ->
('a, 'b) t Core.Std.Bin_prot.Type_class.t
module type Arg = sig .. end
module Send : Datum
module Recv : Datum
module Remote_name : Name
module My_name : Name
module Mode : Mode
module type S = sig .. end
include Arg
type logfun = [ `Recv of Recv.t | `Send of Send.t ] ->
Remote_name.t -> time_sent_received:Core.Std.Time.t -> unit
module Server : sig .. end
type t
include Core.Std.Invariant.S with type t := t
val create : ?logfun:logfun ->
?now:(unit -> Core.Std.Time.t) ->
?enforce_unique_remote_name:bool ->
?is_client_ip_authorized:(string -> bool) ->
?warn_when_free_connections_lte_pct:float ->
?max_clients:int -> listen_port:int -> My_name.t -> t Import.Deferred.t
create a new server, and start listening
val port : t -> int
get the port that the server is listening on
val close : t -> Remote_name.t -> unit
close t client close connection to client if it exists. This does not prevent the same client from connecting again later.
val listen : t -> (Remote_name.t, Recv.t) Server_msg.t Import.Stream.t
listen t listen to the stream of messages and errors coming from clients
val listen_ignore_errors : ?stop:unit Import.Deferred.t -> t -> Recv.t Import.Stream.t
listen_ignore_errors t like listen, but omit error conditions and metadata. When listen_ignore_errors is called it installs a filter on the stream that never goes away (unless t is destroyed, or you provide a stop).
val send : t ->
Remote_name.t ->
Send.t -> [ `Dropped | `Sent of Core.Std.Time.t ] Import.Deferred.t
send t client msg send msg to client. Returns a deferred that will become determined when the message has been sent. In the case of an error, the message will be dropped, and the deferred will be filled with `Dropped (meaning the message was never handed to the OS), otherwise it will be filled with with `Sent tm where tm is the time (according to Time.now) that the message was handed to the operating system. It is possible that the deferred will never become determined, for example in the case that the other side hangs, but does not drop the connection.
val send_ignore_errors : t -> Remote_name.t -> Send.t -> unit
send_ignore_errors t client msg Just like send, but does not report results. Your message will probably be sent successfully sometime after you call this function. If you receive a Disconnect error on the listen channel in close time proximity to making this call then your message was likely dropped.
val send_to_all : t -> Send.t -> [ `Dropped | `Partial_success | `Sent ] Import.Deferred.t
send_to_all t msg send the same message to all connected clients.
val send_to_all_ignore_errors : t -> Send.t -> unit
send_to_all_ignore_errors t msg Just like send_to_all but with no error reporting.
val send_to_some : t ->
Send.t ->
Remote_name.t list ->
[ `Dropped | `Partial_success | `Sent ] Import.Deferred.t
send_to_some t msg names send the same message to multiple connected clients.
val send_to_some_ignore_errors : t -> Send.t -> Remote_name.t list -> unit
send_to_some_ignore_errors t msg Just like send_to_some but with no error reporting.
val client_send_version : t -> Remote_name.t -> Version.t option
val flushed : t ->
cutoff:unit Import.Deferred.t ->
([ `Flushed of Remote_name.t list ] * [ `Not_flushed of Remote_name.t list ])
Import.Deferred.t
val shutdown : t -> unit Import.Deferred.t
module Client : sig .. end
type t
val create : ?logfun:logfun ->
?now:(unit -> Core.Std.Time.t) ->
?check_remote_name:bool ->
ip:string ->
port:int ->
expected_remote_name:Remote_name.t -> My_name.t -> t Import.Deferred.t
create a new (initially disconnected) client
val connect : t -> unit Import.Deferred.t
connect t If the connection is not currently established, initiate one. Returns a deferred that becomes determined when the connection is established.
val close_connection : t -> unit
If a connection is currently established, close it. Also, if we're trying to connect, give up.
val listen : t -> (Remote_name.t, Recv.t) Client_msg.t Import.Stream.t
listen t Returns a stream of messages from the server and errors
val listen_ignore_errors : ?stop:unit Import.Deferred.t -> t -> Recv.t Import.Stream.t
listen_ignore_errors t like listen, but with no errors or meta data. When listen_ignore_errors is called it installs a filter on the stream that never goes away (unless t is destroyed or you provide a stop), so you should not call it many times throwing away the result. If you need to do this use listen.
val send : t -> Send.t -> [ `Dropped | `Sent of Core.Std.Time.t ] Import.Deferred.t
send t msg send a message to the server. If the connection is not currently established, initiate one. Returns a deferred that is filled in with either the time the message was handed to the OS, or `Dropped. `Dropped means that there was an error, and the message will not be sent.
val send_ignore_errors : t -> Send.t -> unit
send_ignore_errors t exactly like send but with no error reporting.
val state : t -> [ `Connected | `Connecting | `Disconnected ]
state t Returns the state of the connection
val last_connect_error : t -> exn option
last_connect_error t returns the error (if any) that happened on the last connection attempt.
val flushed : t -> [ `Flushed | `Pending of Core.Std.Time.t Import.Deferred.t ]
module Make : 
functor (Z : Arg) -> S with module Remote_name = Z.Remote_name and module My_name = Z.My_name and module Recv = Z.Recv and module Send = Z.Send
module Datumable_of_binable : sig .. end
Helpers to make your types Datumable if they are binable. Works with up to 5 versions (easily extensible to more)
module type T = sig .. end
type t
module type T_bin = sig .. end
type t
val bin_t : t Core.Std.Bin_prot.Type_class.t
val bin_read_t : t Core.Std.Bin_prot.Read.reader
val __bin_read_t__ : (int -> t) Core.Std.Bin_prot.Read.reader
val bin_reader_t : t Core.Std.Bin_prot.Type_class.reader
val bin_size_t : t Core.Std.Bin_prot.Size.sizer
val bin_write_t : t Core.Std.Bin_prot.Write.writer
val bin_writer_t : t Core.Std.Bin_prot.Type_class.writer
module V : 
functor (V : T) ->
functor (T : T) -> sig .. end
module type S = sig .. end
val of_v : V.t -> T.t option
val to_v : T.t -> V.t option
module Make_datumable5 : 
functor (Versions : Versions) ->
functor (T : T) ->
functor (V1 : T_bin) ->
functor (V2 : T_bin) ->
functor (V3 : T_bin) ->
functor (V4 : T_bin) ->
functor (V5 : T_bin) ->
functor (V1_cvt : V(V1)(T)) ->
functor (V2_cvt : V(V2)(T)) ->
functor (V3_cvt : V(V3)(T)) ->
functor (V4_cvt : V(V4)(T)) ->
functor (V5_cvt : V(V5)(T)) -> Datumable with type datum = T.t
module type Pre_versions = sig .. end
val low_version : Version.t
val prod_version : Version.t
module Five_versions : 
functor (Versions : Pre_versions) ->
functor (T : T) ->
functor (V1 : T_bin) ->
functor (V2 : T_bin) ->
functor (V3 : T_bin) ->
functor (V4 : T_bin) ->
functor (V5 : T_bin) ->
functor (V1_cvt : V(V1)(T)) ->
functor (V2_cvt : V(V2)(T)) ->
functor (V3_cvt : V(V3)(T)) ->
functor (V4_cvt : V(V4)(T)) ->
functor (V5_cvt : V(V5)(T)) -> Datumable with type datum = T.t
module Four_versions : 
functor (Versions : Pre_versions) ->
functor (T : T) ->
functor (V1 : T_bin) ->
functor (V2 : T_bin) ->
functor (V3 : T_bin) ->
functor (V4 : T_bin) ->
functor (V1_cvt : V(V1)(T)) ->
functor (V2_cvt : V(V2)(T)) ->
functor (V3_cvt : V(V3)(T)) ->
functor (V4_cvt : V(V4)(T)) -> Datumable with type datum = T.t
module Three_versions : 
functor (Versions : Pre_versions) ->
functor (T : T) ->
functor (V1 : T_bin) ->
functor (V2 : T_bin) ->
functor (V3 : T_bin) ->
functor (V1_cvt : V(V1)(T)) ->
functor (V2_cvt : V(V2)(T)) ->
functor (V3_cvt : V(V3)(T)) -> Datumable with type datum = T.t
module Two_versions : 
functor (Versions : Pre_versions) ->
functor (T : T) ->
functor (V1 : T_bin) ->
functor (V2 : T_bin) ->
functor (V1_cvt : V(V1)(T)) ->
functor (V2_cvt : V(V2)(T)) -> Datumable with type datum = T.t
module One_version : 
functor (Versions : Pre_versions) ->
functor (T : T) ->
functor (V1 : T_bin) ->
functor (V1_cvt : V(V1)(T)) -> Datumable with type datum = T.t