package irmin-pack

  1. Overview
  2. Docs
Irmin backend which stores values in a pack file

Install

Dune Dependency

Authors

Maintainers

Sources

irmin-3.5.1.tbz
sha256=cd788a8d3f4a3dd18dc160a153d4aec91eaf6b0fb41ad41464d26c79c304a98e
sha512=4f97862678d35e0b4aa814a1df51d6f8c59bcf5b611c73f0a475f9b5386ca42a4a18e65ce80fc425ddad93fcdacfcb563c52f6423777610a0bc567902f4db088

doc/irmin-pack.unix/Irmin_pack_unix/Pack_store/Make/argument-1-Fm/Suffix/index.html

Module Fm.Suffix

Abstraction for a chunked suffix. It is functionally equivalent to Append_only_file but with a chunked implementation that is parameterized by

  • start_idx for create_rw to know the starting file name, and
  • start_idx and chunk_num for the open functions to know the starting file name and how many files there are.
module Io = Io
module Errs : Io_errors.S

Abstraction for irmin-pack's append only files (i.e. suffix and dict).

type t
type create_error = Io.create_error
type open_error = [
  1. | Io.open_error
  2. | `Closed
  3. | `Invalid_argument
  4. | `Inconsistent_store
  5. | `Read_out_of_bounds
]
type add_new_error = [
  1. | open_error
  2. | Io.close_error
  3. | `Pending_flush
  4. | `File_exists of string
  5. | `Multiple_empty_chunks
]
val create_rw : root:string -> start_idx:int -> overwrite:bool -> auto_flush_threshold:int -> auto_flush_procedure:Ao.auto_flush_procedure -> (t, [> create_error ]) result
val open_rw : root:string -> appendable_chunk_poff:Optint.Int63.t -> start_idx:int -> chunk_num:int -> dead_header_size:int -> auto_flush_threshold:int -> auto_flush_procedure:Ao.auto_flush_procedure -> (t, [> open_error ]) result
val open_ro : root:string -> appendable_chunk_poff:Optint.Int63.t -> dead_header_size:int -> start_idx:int -> chunk_num:int -> (t, [> open_error ]) result
val add_chunk : auto_flush_threshold:int -> auto_flush_procedure:Ao.auto_flush_procedure -> t -> (unit, [> add_new_error ]) result
val start_idx : t -> int
val chunk_num : t -> int
val close : t -> (unit, [> Io.close_error | `Pending_flush ]) result
val empty_buffer : t -> bool
val flush : t -> (unit, [> Io.write_error ]) result
val fsync : t -> (unit, [> Io.write_error ]) result
val appendable_chunk_poff : t -> Optint.Int63.t

appendable_chunk_poff t is the number of bytes of the chunk file that is currently appendable. It does not perform IO.

RW mode

It also counts the bytes not flushed yet.

RO mode

This information originates from the latest reload of the control file. Calling refresh_appendable_chunk_poff t updates appendable_chunk_poff.

val refresh_appendable_chunk_poff : t -> Optint.Int63.t -> (unit, [> `Rw_not_allowed ]) result

Ingest the new end offset of the appendable chunk file. Typically happens in RO mode when the control file has been re-read.

RW mode

Always returns Error `Rw_not_allowed.

val end_soff : t -> Optint.Int63.t

end_soff t is the end offset for the chunked suffix. The valid range of offsets is 0 <= off < end_soff. Therefore, end_soff also represents the length of the chunked suffix.

val read_exn : t -> off:Optint.Int63.t -> len:int -> bytes -> unit
val append_exn : t -> string -> unit
val readonly : t -> bool
val auto_flush_threshold : t -> int option
val fold_chunks : (acc:'a -> idx:int -> start_suffix_off:Optint.Int63.t -> end_suffix_off:Optint.Int63.t -> is_appendable:bool -> 'a) -> 'a -> t -> 'a
OCaml

Innovation. Community. Security.