package octez-internal-libs

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

Module Backend.ConfSource

Backend configuration.

A backend configuration is a set of keys mapping to typed values. Backends define their own keys.

Configuration converters

A configuration converter transforms a string value to an OCaml value and vice-versa.

Keys

Sourcetype 'a key

The type for configuration keys whose lookup value is 'a.

Sourcetype k =
  1. | K : 'a key -> k
Sourcemodule Spec : sig ... end
Sourceval key : ?docs:string -> ?docv:string -> ?doc:string -> ?allow_duplicate:bool -> spec:Spec.t -> string -> 'a Type.t -> 'a -> 'a key

key ~docs ~docv ~doc ~spec name conv default is a configuration key named name that maps to value default by default. It will be associated with the config grouping spec. conv is used to convert key values provided by end users.

docs is the title of a documentation section under which the key is documented. doc is a short documentation string for the key, this should be a single sentence or paragraph starting with a capital letter and ending with a dot. docv is a meta-variable for representing the values of the key (e.g. "BOOL" for a boolean).

  • raises Invalid_argument

    if the key name is not made of a sequence of ASCII lowercase letter, digit, dash or underscore.

  • raises Invalid_argument

    if allow_duplicate is false (the default) and name has already been used to create a key

Sourceval name : 'a key -> string

The key name.

Sourceval ty : 'a key -> 'a Type.t

tc k is k's converter.

Sourceval default : 'a key -> 'a

default k is k's default value.

Sourceval doc : 'a key -> string option

doc k is k's documentation string (if any).

Sourceval docv : 'a key -> string option

docv k is k's value documentation meta-variable (if any).

Sourceval docs : 'a key -> string option

docs k is k's documentation section (if any).

Sourceval root : Spec.t -> string key

Default --root=ROOT argument.

Configurations

Sourcetype t

The type for configurations.

Sourceval pp : t Fmt.t

pp is the pretty printer for configuration values.

Sourceval equal : t -> t -> bool

equal is the equality for configuration values. Two values are equal if they have the same pp representation.

Sourceval spec : t -> Spec.t

spec c is the specification associated with c

Sourceval empty : Spec.t -> t

empty spec is an empty configuration.

Sourceval singleton : Spec.t -> 'a key -> 'a -> t

singleton spec k v is the configuration where k maps to v.

Sourceval is_empty : t -> bool

is_empty c is true iff c is empty.

Sourceval mem : t -> 'a key -> bool

mem c k is true iff k has a mapping in c.

Sourceval add : t -> 'a key -> 'a -> t

add c k v is c with k mapping to v.

Sourceval rem : t -> 'a key -> t

rem c k is c with k unbound.

Sourceval union : t -> t -> t

union r s is the union of the configurations r and s.

Sourceval find : t -> 'a key -> 'a option

find c k is k's mapping in c, if any.

Sourceval get : t -> 'a key -> 'a

get c k is k's mapping in c.

Raises. Not_found if k is not bound in d.

Sourceval keys : t -> k Seq.t

keys c is a sequence of all keys present in c

Sourceval with_spec : t -> Spec.t -> t

with_spec t s is the config t with spec s

Sourceval verify : t -> t

verify t is an identity function that ensures all keys match the spec

Raises. Invalid_argument if t contains invalid keys

Built-in value converters

uri converts values with Uri.of_string.

Sourceval find_root : t -> string option

find_root c is root's mapping in c, if any.

OCaml

Innovation. Community. Security.