package tar-mirage

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

Construct a read-only key-value store from an existing block device containing tar-format data.

Parameters

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 get_partial : t -> key -> offset:Optint.Int63.t -> length:int -> (string, error) result Lwt.t

get_partial t k ~offset ~length is the length bytes wide value bound at offset of k in t.

If the size of k is less than offset, get_partial returns an empty string. If the size of k is less than offset+length, get_partial returns a short string. The result is Error (`Value_expected k) if k refers to a dictionary in t.

val list : t -> key -> ((key * [ `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 returned keys are all absolute (i.e. Key.add k entry).

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

val last_modified : t -> key -> (Ptime.t, error) result Lwt.t

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

When the value bound to k is a dictionary, the implementation is free to decide how to compute a last modified timestamp, or return Error (`Value_expected _).

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 implementation is allowed to return Error (`Value_expected _). Otherwise, the digest is a unique and deterministic digest of its entries.

val size : t -> key -> (Optint.Int63.t, error) result Lwt.t

size t k is the size of k in t.

val connect : BLOCK.t -> t Lwt.t

connect block

  • raises Invalid_argument

    if block has a sector size that is not a positive multiple of 512.

OCaml

Innovation. Community. Security.