package octez-internal-libs

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

Module Control_file.VolumeSource

Abstraction for an irmin-pack control file.

It is parameterized with Io, a file system abstraction (e.g. unix, mirage, eio_linux).

None of the functions raise exceptions.

Parameters

module Io : Io.S

Signature

module Io = Io
Sourcetype t
Sourceval create_rw : path:string -> tmp_path:string option -> overwrite:bool -> Irmin_pack_unix__.Control_file_intf.Payload.Volume.V5.t -> (t, [> Io.create_error | Io.write_error ]) Stdlib.result

Create a rw instance of t by creating a control file.

type open_error := [
  1. | `Corrupted_control_file of string
  2. | `Io_misc of Io.misc_error
  3. | `No_such_file_or_directory of string
  4. | `Not_a_file
  5. | `Closed
  6. | `Unknown_major_pack_version of string
]
Sourceval open_ : path:string -> tmp_path:string option -> readonly:bool -> (t, [> open_error ]) Stdlib.result

Create a rw instance of t by reading an existing file at path. tmp_path will be used by RW instances when updating it's content, it is not required for RO instances or RW instances which will never be updated.

Sourceval close : t -> (unit, [> Io.close_error ]) Stdlib.result
Sourceval read_payload : path:string -> (Irmin_pack_unix__.Control_file_intf.Payload.Volume.V5.t, [> open_error | Io.close_error ]) Stdlib.result

read_payload ~path reads the payload at path. It is a convenient way to read the payload without needing to call open_, payload, close.

Sourceval read_raw_payload : path:string -> (Irmin_pack_unix__.Control_file_intf.Payload.Volume.raw_payload, [> open_error | Io.close_error ]) Stdlib.result
Sourceval payload : t -> Irmin_pack_unix__.Control_file_intf.Payload.Volume.V5.t

payload t is the payload in t.

That function doesn't perform IO.

RW mode

payload t is the payload, as it was written to the file system.

RO mode

payload t is the payload, as it was seen during open_ or during the most recent reload.

type reload_error := [
  1. | `Rw_not_allowed
  2. | open_error
  3. | Io.close_error
]
Sourceval reload : t -> (unit, [> reload_error ]) Stdlib.result

RW mode

Always returns an error.

RO mode

Reread the file on disk.

If the file changed since the last read, the payload in t is updated to match the content of the file.

type move_error := [
  1. | `Sys_error of string
]
type set_error := [
  1. | `No_tmp_path_provided
  2. | Io.create_error
  3. | Io.write_error
  4. | move_error
  5. | Io.close_error
]
Sourceval set_payload : t -> Irmin_pack_unix__.Control_file_intf.Payload.Volume.V5.t -> (unit, [> set_error ]) Stdlib.result

RW mode

Write a new payload on disk.

RO mode

Always returns an error.

Sourceval readonly : t -> bool
Sourceval fsync : t -> (unit, [> Io.write_error ]) Stdlib.result

RW mode

Tell the OS to fush its internal buffers.

RO mode

Always returns Error `Ro_not_allowed.

OCaml

Innovation. Community. Security.