123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271openCommonopenType_classmoduletypeMake_binable_without_uuid_spec=sigmoduleBinable:Binable.Minimal.Stypetvalto_binable:t->Binable.tvalof_binable:Binable.t->tendmoduletypeMake_binable1_without_uuid_spec=sigmoduleBinable:Binable.Minimal.S1type'atvalto_binable:'at->'aBinable.tvalof_binable:'aBinable.t->'atendmoduletypeMake_binable2_without_uuid_spec=sigmoduleBinable:Binable.Minimal.S2type('a,'b)tvalto_binable:('a,'b)t->('a,'b)Binable.tvalof_binable:('a,'b)Binable.t->('a,'b)tendmoduletypeMake_binable3_without_uuid_spec=sigmoduleBinable:Binable.Minimal.S3type('a,'b,'c)tvalto_binable:('a,'b,'c)t->('a,'b,'c)Binable.tvalof_binable:('a,'b,'c)Binable.t->('a,'b,'c)tendmoduletypeMake_binable_with_uuid_spec=sigincludeMake_binable_without_uuid_spec(** [caller_identity] is necessary to ensure different callers of
[Make_binable_with_uuid] are not shape compatible. *)valcaller_identity:Shape.Uuid.tendmoduletypeMake_binable1_with_uuid_spec=sigincludeMake_binable1_without_uuid_specvalcaller_identity:Shape.Uuid.tendmoduletypeMake_binable2_with_uuid_spec=sigincludeMake_binable2_without_uuid_specvalcaller_identity:Shape.Uuid.tendmoduletypeMake_binable3_with_uuid_spec=sigincludeMake_binable3_without_uuid_specvalcaller_identity:Shape.Uuid.tendmoduletypeMake_iterable_binable_spec=sigtypettypeel(** [caller_identity] is necessary to ensure different callers of
[Make_iterable_binable] are not shape compatible. *)valcaller_identity:Shape.Uuid.tvalmodule_name:stringoptionvallength:t->intvaliter:t->f:(el->unit)->unitvalinit:len:int->next:(unit->el)->tvalbin_size_el:elSize.sizervalbin_write_el:elWrite.writervalbin_read_el:elRead.readervalbin_shape_el:Shape.tendmoduletypeMake_iterable_binable1_spec=sigtype'attype'aelvalcaller_identity:Shape.Uuid.tvalmodule_name:stringoptionvallength:'at->intvaliter:'at->f:('ael->unit)->unitvalinit:len:int->next:(unit->'ael)->'atvalbin_size_el:('a,'ael)Size.sizer1valbin_write_el:('a,'ael)Write.writer1valbin_read_el:('a,'ael)Read.reader1valbin_shape_el:Shape.t->Shape.tendmoduletypeMake_iterable_binable2_spec=sigtype('a,'b)ttype('a,'b)elvalcaller_identity:Shape.Uuid.tvalmodule_name:stringoptionvallength:('a,'b)t->intvaliter:('a,'b)t->f:(('a,'b)el->unit)->unitvalinit:len:int->next:(unit->('a,'b)el)->('a,'b)tvalbin_size_el:('a,'b,('a,'b)el)Size.sizer2valbin_write_el:('a,'b,('a,'b)el)Write.writer2valbin_read_el:('a,'b,('a,'b)el)Read.reader2valbin_shape_el:Shape.t->Shape.t->Shape.tendmoduletypeMake_iterable_binable3_spec=sigtype('a,'b,'c)ttype('a,'b,'c)elvalcaller_identity:Shape.Uuid.tvalmodule_name:stringoptionvallength:('a,'b,'c)t->intvaliter:('a,'b,'c)t->f:(('a,'b,'c)el->unit)->unitvalinit:len:int->next:(unit->('a,'b,'c)el)->('a,'b,'c)tvalbin_size_el:('a,'b,'c,('a,'b,'c)el)Size.sizer3valbin_write_el:('a,'b,'c,('a,'b,'c)el)Write.writer3valbin_read_el:('a,'b,'c,('a,'b,'c)el)Read.reader3valbin_shape_el:Shape.t->Shape.t->Shape.t->Shape.tend(** Utility functions for user convenience *)moduletypeUtils=sig(** [size_header_length] is the standard number of bytes allocated for the size header
in size-prefixed bin-io payloads. This size-prefixed layout is used by the
[bin_dump] and [bin_read_stream] functions below, as well as:
- [Core.Bigstring.{read,write}_bin_prot]
- [Core.Unpack_buffer.unpack_bin_prot]
- [Async.{Reader,Writer}.{read,write}_bin_prot]
among others.
The size prefix is always 8 bytes at present. This is exposed so your program does
not have to know this fact too.
We do not use a variable length header because we want to know how many bytes to
read to get the size without having to peek into the payload. *)valsize_header_length:intvalbin_read_size_header:intRead.reader(** [bin_read_size_header] and [bin_write_size_header] are bin-prot serializers for the
size header described above. *)valbin_write_size_header:intWrite.writer(** [bin_dump ?header writer v] uses [writer] to first compute the size of
[v] in the binary protocol, then allocates a buffer of exactly this
size, and then writes out the value. If [header] is [true], the
size of the resulting binary string will be prefixed as a signed
64bit integer.
@return the buffer containing the written out value.
@param header default = [false]
@raise Failure if the size of the value changes during writing,
and any other exceptions that the binary writer in [writer] can raise.
*)valbin_dump:?header:bool->'awriter->'a->buf(** [bin_read_stream ?max_size ~read reader] reads binary protocol data
from a stream as generated by the [read] function, which places
data of a given length into a given buffer. Requires a header.
The [reader] type class will be used for conversion to OCaml-values.
@param max_size default = nothing
@raise Failure if the size of the value disagrees with the one
specified in the header, and any other exceptions that the binary
reader associated with [reader] can raise.
@raise Failure if the size reported in the data header is longer than
[max_size].
*)valbin_read_stream:?max_size:int->read:(buf->pos:int->len:int->unit)->'areader->'a(** Conversion of binable types *)moduleOf_minimal(S:Binable.Minimal.S):Binable.Swithtypet:=S.tmoduletypeMake_binable_with_uuid_spec=Make_binable_with_uuid_specmoduletypeMake_binable1_with_uuid_spec=Make_binable1_with_uuid_specmoduletypeMake_binable2_with_uuid_spec=Make_binable2_with_uuid_specmoduletypeMake_binable3_with_uuid_spec=Make_binable3_with_uuid_specmoduleMake_binable_with_uuid(Bin_spec:Make_binable_with_uuid_spec):Binable.Swithtypet:=Bin_spec.tmoduleMake_binable1_with_uuid(Bin_spec:Make_binable1_with_uuid_spec):Binable.S1withtype'at:='aBin_spec.tmoduleMake_binable2_with_uuid(Bin_spec:Make_binable2_with_uuid_spec):Binable.S2withtype('a,'b)t:=('a,'b)Bin_spec.tmoduleMake_binable3_with_uuid(Bin_spec:Make_binable3_with_uuid_spec):Binable.S3withtype('a,'b,'c)t:=('a,'b,'c)Bin_spec.tmoduletypeMake_binable_without_uuid_spec=Make_binable_without_uuid_specmoduletypeMake_binable1_without_uuid_spec=Make_binable1_without_uuid_specmoduletypeMake_binable2_without_uuid_spec=Make_binable2_without_uuid_specmoduletypeMake_binable3_without_uuid_spec=Make_binable3_without_uuid_specmoduleMake_binable_without_uuid(Bin_spec:Make_binable_without_uuid_spec):Binable.Swithtypet:=Bin_spec.t[@@alertlegacy"Use [Make_binable_with_uuid] if possible."]moduleMake_binable1_without_uuid(Bin_spec:Make_binable1_without_uuid_spec):Binable.S1withtype'at:='aBin_spec.t[@@alertlegacy"Use [Make_binable1_with_uuid] if possible."]moduleMake_binable2_without_uuid(Bin_spec:Make_binable2_without_uuid_spec):Binable.S2withtype('a,'b)t:=('a,'b)Bin_spec.t[@@alertlegacy"Use [Make_binable2_with_uuid] if possible."]moduleMake_binable3_without_uuid(Bin_spec:Make_binable3_without_uuid_spec):Binable.S3withtype('a,'b,'c)t:=('a,'b,'c)Bin_spec.t[@@alertlegacy"Use [Make_binable3_with_uuid] if possible."]moduleMake_binable=Make_binable_without_uuid[@@alert"-legacy"][@@deprecated"[since 2019-11] Use [Make_binable_with_uuid] if possible, or \
[Make_binable_without_uuid] otherwise."]moduleMake_binable1=Make_binable1_without_uuid[@@alert"-legacy"][@@deprecated"[since 2019-11] Use [Make_binable1_with_uuid] if possible, or \
[Make_binable1_without_uuid] otherwise."]moduleMake_binable2=Make_binable2_without_uuid[@@alert"-legacy"][@@deprecated"[since 2019-11] Use [Make_binable2_with_uuid] if possible, or \
[Make_binable2_without_uuid] otherwise."]moduleMake_binable3=Make_binable3_without_uuid[@@alert"-legacy"][@@deprecated"[since 2019-11] Use [Make_binable3_with_uuid] if possible, or \
[Make_binable3_without_uuid] otherwise."](** Conversion of iterable types *)moduletypeMake_iterable_binable_spec=Make_iterable_binable_specmoduletypeMake_iterable_binable1_spec=Make_iterable_binable1_specmoduletypeMake_iterable_binable2_spec=Make_iterable_binable2_specmoduletypeMake_iterable_binable3_spec=Make_iterable_binable3_specmoduleMake_iterable_binable(Iterable_spec:Make_iterable_binable_spec):Binable.Swithtypet:=Iterable_spec.tmoduleMake_iterable_binable1(Iterable_spec:Make_iterable_binable1_spec):Binable.S1withtype'at:='aIterable_spec.tmoduleMake_iterable_binable2(Iterable_spec:Make_iterable_binable2_spec):Binable.S2withtype('a,'b)t:=('a,'b)Iterable_spec.tmoduleMake_iterable_binable3(Iterable_spec:Make_iterable_binable3_spec):Binable.S3withtype('a,'b,'c)t:=('a,'b,'c)Iterable_spec.tend