package irmin-pack

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Parameters

module Fm : File_manager.S with module Io = Io.Unix

Signature

module Fm = Fm
module Mapping_file : Mapping_file.S with module Io = Fm.Io
type t
type accessor

An accessor designates a valid readable area in one of the pack files.

Accessors are meant to be used from within the Irmin_pack_unix implementation. Their validity is only checked at creation time, so they are not meant to be kept for a long time. (e.g. if kept over a GC finalisation, an accessor could no longer point to a valid area because the GC changes the domain of valid readable areas)

val v : root:string -> Fm.t -> (t, [> Fm.Errs.t ]) Stdlib.result
val create_accessor_exn : t -> off:Optint.Int63.t -> len:int -> accessor

create_accessor_exn returns an accessor if off and len designate a readable area of the pack files, otherwise it raises one of Errors.Pack_error `Read_out_of_bounds, Errors.Pack_error (`Invalid_prefix_read _) and Errors.Pack_error (`Invalid_read_of_gced_object _).

val create_accessor_from_range_exn : t -> off:Optint.Int63.t -> min_len:int -> max_len:int -> accessor

create_accessor_from_maxlen_exn is similar to create_accessor_exn except that the precise length of the span will be decided during the call.

val shrink_accessor_exn : accessor -> new_len:int -> accessor

shrink_accessor_exn a ~new_len is a where the length is smaller than in a.

val read_exn : t -> accessor -> bytes -> unit

read_exn either reads in the prefix or the suffix file, depending on accessor.

val end_offset : t -> Optint.Int63.t

end_offset is the end offsets of the pack entries, counting that the prefix doesn't start at 0. It counts the entries not yet flushed from the prefix.

val offset_of_suffix_off : t -> Optint.Int63.t -> Optint.Int63.t

offset_of_suffix_off t suffix_off converts a suffix offset into a (global) offset.

val read_in_prefix_and_suffix_exn : t -> off:Optint.Int63.t -> len:int -> bytes -> unit

Simlar to read_exn but if off + len is greater than the end of the prefix, it will read the remaining in the prefix.

OCaml

Innovation. Community. Security.