mirage-kv

MirageOS signatures for key/value devices
IN THIS PACKAGE
Module Mirage_kv . Key

Structured keys

type t

The type for structured keys.

val empty : t

empty is the empty key. It refers to the top-level dictionary.

val v : string -> t

v s is the string s as a key. A key "/foo/bar" is decomposed into the segments "foo" and "bar". The initial "/" is always ignored so "foo/bar" and "/foo/bar" are equal.

val add : t -> string -> t

add t s is the concatenated key t/s. Raise Invalid_argument if s contains "/".

val (/) : t -> string -> t

t / x is add t x.

val append : t -> t -> t

append x y is the concatenated key x/y.

val (//) : t -> t -> t

x // y is append x y.

val segments : t -> string list

segments t is t's list of segments.

val basename : t -> string

basename t is the last segment of t. basename empty is the empty string "".

val parent : t -> t

parent t is the key without the last segment. parent empty is empty.

For any t, the invariant have parent t / basename t is t.

val compare : t -> t -> int

The comparison function for keys.

val equal : t -> t -> bool

The equality function for keys.

val pp : t Fmt.t

The pretty printer for keys.

val to_string : t -> string

to_string t is the string representation of t. "/" is used as separator between segements and it always starts with "/".