123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201(** A Streamable.State_rpc is just like a State_rpc except the state and updates are
streamed out gradually rather than sent in one big [bin_io] blob. *)open!Coreopen!Async_kernelopen!ImportmoduletypeS=sigvalname:stringvalversion:inttypequery[@@derivingbin_io]typestatemoduleState:Main.S_rpcwithtypet=statetypeupdatemoduleUpdate:Main.S_rpcwithtypet=updatevalclient_pushes_back:boolendmoduletypeState_rpc=sigmoduletypeS=Stype('q,'s,'u)tvaldescription:_t->Rpc.Description.tvaldispatch:('q,'s,'u)t->Rpc.Connection.t->'q->('s*'uPipe.Reader.t)Deferred.Or_error.tvaldispatch':('q,'s,'u)t->Rpc.Connection.t->'q->('s*'uPipe.Reader.t)Or_error.tDeferred.Or_error.tvalimplement:?on_exception:Rpc.On_exception.t(** default: [On_exception.continue] **)->('q,'s,'u)t->('conn_state->'q->('s*'uPipe.Reader.t)Deferred.Or_error.t)->'conn_stateRpc.Implementation.tvalbin_query_shape:_t->Bin_prot.Shape.tvalbin_state_shape:_t->Bin_prot.Shape.tvalbin_update_shape:_t->Bin_prot.Shape.tmoduleDirect_writer:sigtype('state_part,'update_part)t(** Write a part of the initial state. Returns [`Closed] if [t] is closed.
Will raise if the initial state has already been finalised.
*)valwrite_state_without_pushback_exn:('state_part,_)t->'state_part->[`Ok|`Closed](** Finalise the initial state, indicating there are no more parts.
Returns [`Closed] if [t] is closed.
Will raise if the initial state has already been finalised.
*)valfinalise_state_without_pushback_exn:_t->[`Ok|`Closed]valis_state_finalised:_t->boolvalstate_finalised:_t->unitDeferred.t(** Write a part of an update. Returns [`Closed] if [t] is closed.
Will raise if the initial state has not yet been finalised.
*)valwrite_update_without_pushback_exn:(_,'update_part)t->'update_part->[`Ok|`Closed](** Finalise the current update. Returns [`Closed] if [t] is closed.
Will raise if the initial state has not yet been finalised.
*)valfinalise_update_without_pushback_exn:_t->[`Ok|`Closed]valclose:_t->unitvalclosed:_t->unitDeferred.tvalflushed:_t->unitDeferred.tvalis_closed:_t->bool(** [Expert] allows the serialisation of parts to occur separately from the writing
of parts. While you are able to write any bigstring to the pipe rpc with this
interface, you should only write state parts until you finalise the state, and
then after that you should only write update parts. *)moduleExpert:sigvalcreate_state_part:state_bin_writer:'state_partBin_prot.Type_class.writer->'state_part->Bigstring.tvalfinalise_state_message:Bigstring.tlazy_tvalcreate_update_part:update_bin_writer:'update_partBin_prot.Type_class.writer->'update_part->Bigstring.tvalfinalise_update_message:Bigstring.tlazy_tvalwrite_without_pushback:?pos:int->?len:int->_t->Bigstring.t->[`Closed|`Ok]endmoduleGroup:sigtype('state_part,'update_part)direct_writer:=('state_part,'update_part)ttype('state_part,'update_part)tvalcreate:?buffer:Rpc.Pipe_rpc.Direct_stream_writer.Group.Buffer.t->?send_last_value_on_add:bool->unit->_t(** [flushed_or_closed t] is determined when the underlying writer for each member of [t] is
flushed or closed.
*)valflushed_or_closed:_t->unitDeferred.t(** Add a direct writer to the group. Raises if the writer has not finalised its initial state,
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.
*)valadd_exn:('state_part,'update_part)t->('state_part,'update_part)direct_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.
*)valremove:('state_part,'update_part)t->('state_part,'update_part)direct_writer->unit(** Write an update part on all direct writers in the group. Contrary to
[Direct_writer.write_without_pushback],
this cannot return [`Closed] as elements of the
group are removed immediately when they are closed, and it cannot raise
due to initial state not being finalised as this is checked when adding
to the group.
*)valwrite_update_without_pushback:(_,'update_part)t->'update_part->unit(** Finalise the current update on all direct writers in the group. *)valfinalise_update_without_pushback:_t->unit(** The number of clients currently. *)vallength:_t->int(** Close all of the added clients.
You can use [flushed_or_closed] to then wait for the closing to complete.
*)valclose_all:('state_part,'update_part)t->unitendendmoduleMake(X:S):sigvalrpc:(X.query,X.state,X.update)t(** [implement'] is like [implement rpc] except that it allows the server
to control the conversion from the [state] and [update]s to parts. *)valimplement':?on_exception:Rpc.On_exception.t(** default: [On_exception.continue] **)->('conn_state->X.query->(X.State.Intermediate.Part.tPipe.Reader.t*X.Update.Intermediate.Part.tPipe.Reader.tPipe.Reader.t)Deferred.Or_error.t)->'conn_stateRpc.Implementation.tvalimplement_direct:?on_exception:Rpc.On_exception.t(** default: [On_exception.continue] **)->('conn_state->X.query->(X.State.Intermediate.Part.t,X.Update.Intermediate.Part.t)Direct_writer.t->unitDeferred.Or_error.t)->'conn_stateRpc.Implementation.tendend