| 1 | (************************************************************************) |
| 2 | (* * The Rocq Prover / The Rocq Development Team *) |
| 3 | (* v * Copyright INRIA, CNRS and contributors *) |
| 4 | (* <O___,, * (see version control and CREDITS file for authors & dates) *) |
| 5 | (* \VV/ **************************************************************) |
| 6 | (* // * This file is distributed under the terms of the *) |
| 7 | (* * GNU Lesser General Public License Version 2.1 *) |
| 8 | (* * (see LICENSE file for the text of the license) *) |
| 9 | (************************************************************************) |
| 10 | |
| 11 | val magic_number : int32 |
| 12 | |
| 13 | type 'a segment = private { |
| 14 | name : string; |
| 15 | pos : int64; |
| 16 | len : int64; |
| 17 | hash : Digest.t; |
| 18 | } |
| 19 | |
| 20 | type 'a id = private { id : string } |
| 21 | (** Private to ensure the phantom tag is injective *) |
| 22 | |
| 23 | type in_handle |
| 24 | type out_handle |
| 25 | |
| 26 | val make_id : string -> 'a id |
| 27 | |
| 28 | val open_in : file:string -> in_handle |
| 29 | val close_in : in_handle -> unit |
| 30 | val marshal_in_segment : in_handle -> segment:'a id -> 'a * Digest.t |
| 31 | val get_segment : in_handle -> segment:'a id -> 'a segment |
| 32 | val segments : in_handle -> Obj.t segment CString.Map.t |
| 33 | |
| 34 | val open_out : file:string -> out_handle |
| 35 | val close_out : out_handle -> unit |
| 36 | val marshal_out_segment : out_handle -> segment:'a id -> 'a -> unit |
| 37 | val marshal_out_binary : out_handle -> segment:'a id -> out_channel * (unit -> unit) |
| 38 | (** [marshal_out_binary oh segment] is a low level, stateful, API returning |
| 39 | [oc, stop]. Once called no other API can be used on the same [oh] and only |
| 40 | [Stdlib.output_*] APIs should be used on [oc]. [stop ()] must be invoked in |
| 41 | order to signal that all data was written to [oc] (which should not be used |
| 42 | afterwards). Only after calling [stop] the other API can be used on [oh]. *) |