aboutsummaryrefslogtreecommitdiff
path: root/lib/system.mli
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2020-03-29 18:02:46 +0200
committerPierre-Marie Pédrot2020-04-26 14:24:48 +0200
commit75e394770b534994830f6d80e649734275de5006 (patch)
tree375b3fd6e78384d13ad7027876ace4bb6af04015 /lib/system.mli
parent6c15158c5ab1693868356e4b2433c7eb7b8ec3f2 (diff)
Implement a name-based representation for vo files.
See CEP#44 for futher details.
Diffstat (limited to 'lib/system.mli')
-rw-r--r--lib/system.mli36
1 files changed, 29 insertions, 7 deletions
diff --git a/lib/system.mli b/lib/system.mli
index 00701379bd..7e02b76203 100644
--- a/lib/system.mli
+++ b/lib/system.mli
@@ -68,8 +68,9 @@ val file_exists_respecting_case : string -> string -> bool
when the check fails, with the full file name and expected/observed magic
numbers. *)
-type magic_number_error = {filename: string; actual: int; expected: int}
+type magic_number_error = {filename: string; actual: int32; expected: int32}
exception Bad_magic_number of magic_number_error
+exception Bad_version_number of magic_number_error
val raw_extern_state : int -> string -> out_channel
@@ -87,14 +88,35 @@ val with_magic_number_check : ('a -> 'b) -> 'a -> 'b
val marshal_out : out_channel -> 'a -> unit
val marshal_in : string -> in_channel -> 'a
-(** Clones of Digest.output and Digest.input (with nice error message) *)
+module ObjFile :
+sig
-val digest_out : out_channel -> Digest.t -> unit
-val digest_in : string -> in_channel -> Digest.t
+val magic_number : int32
-val marshal_out_segment : string -> out_channel -> 'a -> unit
-val marshal_in_segment : string -> in_channel -> 'a * int * Digest.t
-val skip_in_segment : string -> in_channel -> int * Digest.t
+type segment = {
+ name : string;
+ pos : int64;
+ len : int64;
+ hash : Digest.t;
+}
+
+type in_handle
+type out_handle
+
+val open_in : file:string -> in_handle
+val close_in : in_handle -> unit
+val marshal_in_segment : in_handle -> segment:string -> 'a * Digest.t
+val get_segment : in_handle -> segment:string -> segment
+val segments : in_handle -> segment CString.Map.t
+
+val open_out : file:string -> out_handle
+val close_out : out_handle -> unit
+val marshal_out_segment : out_handle -> segment:string -> 'a -> unit
+val marshal_out_binary : out_handle -> segment:string -> out_channel * (unit -> unit)
+(** Low-level API. This function returns a channel and a closure. The channel
+ should only be written to, and once done, the closure should be invoked. *)
+
+end
(** {6 Time stamps.} *)