package async
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=fef9ebe342ea59d7804f6292b7891ad664a8ba8d4174a1b202db91363a9c71ab
md5=fbfc7059179bc9ddd5dc1411e7d2e815
doc/async.async_rpc/Async_rpc/Rpc/Low_latency_transport/Writer/index.html
Module Low_latency_transport.Writer
include module type of struct include Async_rpc_kernel.Rpc.Transport.Writer end
module type S = Async_rpc_kernel.Rpc.Transport.Writer.S
include S
val sexp_of_t : t -> Ppx_sexp_conv_lib.Sexp.t
val close : t -> unit Async_kernel.Deferred.t
val is_closed : t -> bool
val monitor : t -> Async_kernel.Monitor.t
val bytes_to_write : t -> int
val stopped : t -> unit Async_kernel.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.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.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.
val send_bin_prot :
t ->
'a Core_kernel.Bin_prot.Type_class.writer ->
'a ->
unit Async_rpc_kernel__.Transport_intf.Send_result.t
val send_bin_prot_and_bigstring :
t ->
'a Core_kernel.Bin_prot.Type_class.writer ->
'a ->
buf:Core_kernel.Bigstring.t ->
pos:int ->
len:int ->
unit Async_rpc_kernel__.Transport_intf.Send_result.t
val send_bin_prot_and_bigstring_non_copying :
t ->
'a Core_kernel.Bin_prot.Type_class.writer ->
'a ->
buf:Core_kernel.Bigstring.t ->
pos:int ->
len:int ->
unit Async_kernel.Deferred.t Async_rpc_kernel__.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.
val can_send : t -> bool
can_send t = not (is_closed t || Deferred.is_determined (stopped t))
val transfer :
t ->
?max_num_values_per_read:int ->
'a Async_kernel.Pipe.Reader.t ->
('a -> unit) ->
unit Async_kernel.Deferred.t
This function is similar to Async_unix.Writer.transfer
, except that it doesn't wait on Pipe.upstream_flushed
when the writer is closed.
val create : ?config:Config.t -> max_message_size:int -> Async_unix.Fd.t -> t