package irmin

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

Module Private.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. There are a few built-in converters.

Sourcetype 'a parser = string -> ('a, [ `Msg of string ]) result

The type for configuration converter parsers.

Sourcetype 'a printer = 'a Fmt.t

The type for configuration converter printers.

Sourcetype 'a converter = 'a parser * 'a printer

The type for configuration converters.

Sourceval parser : 'a converter -> 'a parser

parser c is c's parser.

Sourceval printer : 'a converter -> 'a printer

converter c is c's printer.

Keys

Sourcetype 'a key

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

Sourceval key : ?docs:string -> ?docv:string -> ?doc:string -> string -> 'a converter -> 'a -> 'a key

key ~docs ~docv ~doc name conv default is a configuration key named name that maps to value default by default. 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.

Warning. No two keys should share the same name as this may lead to difficulties in the UI.

Sourceval name : 'a key -> string

The key name.

Sourceval conv : 'a key -> 'a converter

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 : string option key

Default --root=ROOT argument.

Configurations

Sourcetype t

The type for configurations.

Sourceval empty : t

empty is the empty configuration.

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

singleton 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.

Built-in value converters

Sourceval bool : bool converter

bool converts values with bool_of_string.

Sourceval int : int converter

int converts values with int_of_string.

Sourceval string : string converter

string converts values with the identity function.

uri converts values with Uri.of_string.

Sourceval some : 'a converter -> 'a option converter

string converts values with the identity function.

OCaml

Innovation. Community. Security.