Module Async_rpc_kernel__.Rpc.Pipe_rpc.Direct_stream_writer.Group

Group of direct writers. Groups are optimized for sending the same message to multiple clients at once.

type 'a direct_stream_writer
type 'a t
module Buffer : sig ... end

A group internally holds a buffer to serialize messages only once. This buffer will grow automatically to accomodate bigger messages.

val create : ?⁠buffer:Buffer.t ‑> unit ‑> _ t
val flushed : _ t ‑> unit Async_kernel.Deferred.t

flushed t is determined when the underlying writer for each member of t is flushed.

val add_exn : 'a t ‑> 'a direct_stream_writer ‑> unit

Add a direct stream writer to the group. Raises if the writer is closed or already part of the group, or if its bin-prot writer is different than an existing group member's. When the writer is closed, it is automatically removed from the group.

val remove : 'a t ‑> 'a direct_stream_writer ‑> unit

Remove a writer from a group. Note that writers are automatically removed from all groups when they are closed, so you only need to call this if you want to remove a writer without closing it.

val write : 'a t ‑> 'a ‑> unit Async_kernel.Deferred.t

Write a message on all direct writers in the group. Contrary to Direct_stream_writer.write, this cannot return `Closed as elements of the group are removed immediately when they are closed.

write t x is the same as write_without_pushback t x; flushed t.

val write_without_pushback : 'a t ‑> 'a ‑> unit
val to_list : 'a t ‑> 'a direct_stream_writer list
val length : _ t ‑> int
module Expert : sig ... end