Module ObjFile
type 'a segment
= private
{
name : string;
pos : int64;
len : int64;
hash : Stdlib.Digest.t;
}
type 'a id
= private
{
id : string;
}
Private to ensure the phantom tag is injective
val make_id : string -> 'a id
val open_in : file:string -> in_handle
val close_in : in_handle -> unit
val marshal_in_segment : in_handle -> segment:'a id -> 'a * Stdlib.Digest.t
val get_segment : in_handle -> segment:'a id -> 'a segment
val segments : in_handle -> Stdlib.Obj.t segment CString.Map.t
val open_out : file:string -> out_handle
val close_out : out_handle -> unit
val marshal_out_segment : out_handle -> segment:'a id -> 'a -> unit
val marshal_out_binary : out_handle -> segment:'a id -> Stdlib.out_channel * (unit -> unit)
marshal_out_binary oh segment
is a low level, stateful, API returningoc, stop
. Once called no other API can be used on the sameoh
and onlyStdlib.output_*
APIs should be used onoc
.stop ()
must be invoked in order to signal that all data was written tooc
(which should not be used afterwards). Only after callingstop
the other API can be used onoh
.