package irmin-mirage-git

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

Functor to create a MirageOS' KV_RO store from a Git repository. The key "/HEAD" always shows the current HEAD.

Parameters

module G : Irmin_git.G

Signature

include Mirage_kv.RO

Read-only key-value stores

type nonrec error = private [>
  1. | Mirage_kv.error
]

The type for errors.

val pp_error : error Fmt.t

pp_error is the pretty-printer for errors.

type t

The type representing the internal state of the key-value store.

val disconnect : t -> unit Lwt.t

Disconnect from the key-value store. While this might take some time to complete, it can never result in an error.

type key = Mirage_kv.Key.t

The type for keys.

val exists : t -> key -> ([ `Value | `Dictionary ] option, error) result Lwt.t

exists t k is Some `Value if k is bound to a value in t, Some `Dictionary if k is a prefix of a valid key in t and None if no key with that prefix exists in t.

exists answers two questions: does the key exist and is it referring to a value or a dictionary.

An error occurs when the underlying storage layer fails.

val get : t -> key -> (string, error) result Lwt.t

get t k is the value bound to k in t.

The result is Error (`Value_expected k) if k refers to a dictionary in t.

val list : t -> key -> ((string * [ `Value | `Dictionary ]) list, error) result Lwt.t

list t k is the list of entries and their types in the dictionary referenced by k in t.

The result is Error (`Dictionary_expected k) if k refers to a value in t.

val last_modified : t -> key -> (int * int64, error) result Lwt.t

last_modified t k is the last time the value bound to k in t has been modified.

The modification time (d, ps) is a span for the signed POSIX picosecond span d * 86_400e12 + ps. d is a signed number of POSIX days and ps a number of picoseconds in the range [0;86_399_999_999_999_999L].

When the value bound to k is a dictionary, the modification time is the latest modification of all entries in that dictionary. This behaviour is only one level deep and not recursive.

val digest : t -> key -> (string, error) result Lwt.t

digest t k is the unique digest of the value bound to k in t.

When the value bound to k is a dictionary, the digest is a unique and deterministic digest of its entries.

val connect : ?depth:int -> ?branch:string -> ?root:key -> ?ctx:Mimic.ctx -> ?headers:(string * string) list -> G.t -> string -> t Lwt.t

connect ?depth ?branch ?path g uri clones the given uri into g repository, using the given branch, depth and '/'-separated sub-path. By default, branch is main, depth is 1 and path is empty, ie. reads will be relative to the root of the repository.

OCaml

Innovation. Community. Security.