Up

Module type S = Async_rpc_kernel.Transport_intf.Writer

Signature

type t
val sexp_of_t : t -> Sexplib.Sexp.t
val close : t -> unit Async_kernel.Std.Deferred.t
val is_closed : t -> bool
val monitor : t -> Async_kernel.Std.Monitor.t
val bytes_to_write : t -> int
val stopped : t -> unit Async_kernel.Std.Deferred.t

Becomes determined when it is no longer possible to send message using this writer, for instance when the writer is closed or the consumer leaves.

The result of this function is cached by Rpc.Transport

val flushed : t -> unit Async_kernel.Std.Deferred.t

flushed t returns a deferred that must become determined when all prior sent messages are delivered.

It must be OK to call flushed t after t has been closed.

val ready_to_write : t -> unit Async_kernel.Std.Deferred.t

ready_to_write t becomes determined when it is a good time to send messages again. Async RPC calls this function after sending a batch of messages, to avoid flooding the transport.

Using let ready_to_write = flushed is an acceptable implementation.

All the following functions send exactly one message.

They must raise once the writer is closed.

val send_bin_prot_and_bigstring : t -> 'a Core_kernel.Std.Bin_prot.Type_class.writer -> 'a -> buf:Core_kernel.Std.Bigstring.t -> pos:int -> len:int -> unit Transport_intf.Send_result.t
val send_bin_prot_and_bigstring_non_copying : t -> 'a Core_kernel.Std.Bin_prot.Type_class.writer -> 'a -> buf:Core_kernel.Std.Bigstring.t -> pos:int -> len:int -> unit Async_kernel.Std.Deferred.t Transport_intf.Send_result.t

Same as send_bin_prot_and_bigstring but the bigstring can't be modified until the returned deferred becomes determined. This can be used to avoid copying the bigstring.