module Versioned_typed_tcp: Versioned_typed_tcp
val __pa_ounit_275876e34cf609db118f3d84b799a790 : string
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'a
marshal_fun ='a -> Core.Std.Bigsubstring.t option
type'a
unmarshal_fun =Core.Std.Bigsubstring.t -> 'a option
val protocol_version : [ `Prod | `Test ] Pervasives.ref
module Version:sig
..end
module type Versions =sig
..end
module type Datumable =sig
..end
module type Datum =sig
..end
module type Mode =sig
..end
module Dont_care_about_mode:sig
..end
module Read_result:sig
..end
module Server_msg:sig
..end
module Client_msg:sig
..end
module type Arg =sig
..end
module type S =sig
..end
module Make:
module Datumable_of_binable:sig
..end
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.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.
If you don't care about modes, just use Dont_care_about_mode.
create a new server, and start listening
defualt: Scheduler.cycle_start
remote names must be unique
warn_when_free_connections_lte_pct
. If the number of free connections falls
below this percentage of max connections an Almost_full event will be generated.
The default is 5%. It is required that 0.0 <=
warn_when_free_connections_lte_pct <= 1.0
max connected clients. default 500
get the port that the server is listening on
close t client
close connection to client
if it
exists. This does not prevent the same client from connecting
again later.
listen t
listen to the stream of messages and errors coming from clients
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
).
send t client msg
send msg
to client
.
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.
send_to_all t msg
send the same message to all connected clients.
sent successfuly to all clients
not sent successfully to any client
sent to some clients
send_to_all_ignore_errors t msg
Just like send_to_all
but with no error
reporting.
send_to_some t msg names
send the same message to multiple connected clients.
sent successfuly to all clients
not sent successfully to any client
sent to some clients
send_to_some_ignore_errors t msg
Just like send_to_some
but with no error
reporting.
create a new (initially disconnected) client
defualt: Scheduler.cycle_start
remote name must match expected remote name.
connect t
If the connection is not currently established, initiate one.
If a connection is currently established, close it. Also, if we're trying to
connect, give up.
listen 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.
send t msg
send a message to the server. If the connection is
not currently established, initiate one.
send_ignore_errors t
exactly like send
but with no error reporting.
state t
last_connect_error t
returns the error (if any) that happened on the
last connection attempt.
sent successfuly to all clients
not sent successfully to any client
sent to some clients
sent successfuly to all clients
not sent successfully to any client
sent to some clients
Helpers to make your types Datumable if they are binable. Works with up
to 5 versions (easily extensible to more)