Library
Module
Module type
Parameter
Class
Class type
Configuration keys.
Mirage keys.
Release v3.8.1
module Arg = Mirage_key.Arg
include Functoria.KEY with module Arg := Arg
type 'a value = 'a Functoria_key.value
The type for configure-time and run-time values. Values are either pure
or obtained by composing other values. Values might have data dependencies, which form an (implicit) directed and acyclic graph that need to be evaluated.
val pure : 'a -> 'a value
pure x
is a value without any dependency.
f $ v
is is the value resulting from the application of f
'value to v
's value. $
is the usual app operator for applicative functor.
val default : 'a value -> 'a
default v
returns the default value for v
.
type 'a key = 'a Functoria_key.key
The type for configuration keys. Keys are used to retrieve the cross-stage values they are holding (by indexing contents in the autogenerated Bootgen_var
module) but also to parameterize the choice of module implementation.
create n a
is the key named n
whose contents is determined by parsing the command-line argument a
.
type t = Functoria_key.t
The type for abstract keys.
module Set = Mirage_key.Set
Set
implements sets over t
elements.
val hash : t -> int
hash
is the hash function for untyped keys.
val is_runtime : t -> bool
is_runtime k
is true if k
's stage is `Run
or `Both
.
val is_configure : t -> bool
is_configure k
is true if k
's stage is `Configure
or `Both
.
filter_stage s ks
is ks
but with only keys available at stage s
.
module Alias = Mirage_key.Alias
Alias allows to define virtual keys in terms of other keys at configuration time only.
val name : t -> string
name t
is the string given as t
's name when t
was created.
type context = Functoria_key.context
The type for values holding parsing context.
val empty_context : context
val context :
?stage:Arg.stage ->
with_required:bool ->
Set.t ->
context Cmdliner.Term.t
context ~with_required ks
is a Cmdliner
term that evaluates into a parsing context for command-line arguments. If with_required
is false, it will only produce optional keys.
mem c v
is true
iff all the dependencies of v
have been evaluated.
eval c v
evaluates v
in c
's context, using default values if necessary.
pps c fmt ks
prints the keys ks
using the context c
to get their value.
val ocaml_name : t -> string
ocaml_name k
is the ocaml name of k
.
serialize_call fmt k
outputs Key_gen.n ()
to fmt
, where n
is k
's OCaml name.
-t TARGET
: Key setting the configuration mode for the current project. Is one of "unix"
, "macosx"
, "xen"
, "qubes"
, "virtio"
, "hvt"
, "muen"
, "genode"
or "spt"
.
val warn_error : bool key
--warn-error
. Enable -warn-error for OCaml sources. Set to false
by default, but might might enabled by default in later releases.
val target_debug : bool key
-g
. Enables target-specific support for debugging.
val no_depext : bool key
--no-depext
. Disables opam depext in depend target of generated Makefile.
val tracing_size : int -> int key
--tracing-size
: Key setting the tracing ring buffer size.
The OCaml runtime is usually configurable via the OCAMLRUNPARAM
environment variable. We provide boot parameters covering these options.
val backtrace : bool key
--backtrace
: Output a backtrace if an uncaught exception terminated the unikernel.
val randomize_hashtables : bool key
--randomize-hashtables
: Randomize all hash tables.
The OCaml garbage collector can be configured, as described in detail in GC control.
The following keys allow boot time configuration.
val allocation_policy : [ `Next_fit | `First_fit | `Best_fit ] key
val minor_heap_size : int option key
val major_heap_increment : int option key
val space_overhead : int option key
val max_space_overhead : int option key
val gc_verbosity : int option key
val gc_window_size : int option key
val custom_major_ratio : int option key
val custom_minor_ratio : int option key
val custom_minor_max_size : int option key
Some keys have a group
optional argument. This group argument allows to give several keys a prefix.
For example, if we have two ip
stacks, one external and one internal, We can use the group
option to name them in
and out
. This way, the available keys will be --in-ip
and --out-ip
.
If a key has another, non-optional argument. It is the default value.
Keys are always named the same as their command line option.
val kv_ro :
?group:string ->
unit ->
[ `Archive | `Crunch | `Direct | `Fat ] key
The type of key value store. Is one of "archive"
, "crunch"
, "direct"
, or "fat"
.
val block :
?group:string ->
unit ->
[ `XenstoreId | `BlockFile | `Ramdisk ] key
Block device keys
val prng : [ `Stdlib | `Nocrypto ] key
The type of pseudo random number generator to use by default.
val dhcp : ?group:string -> unit -> bool key
Enable dhcp. Is either true
or false
.
val net : ?group:string -> unit -> [ `Direct | `Socket ] option key
The type of stack. Is either "direct"
or "socket"
.
val interface : ?group:string -> string -> string key
A network interface.
module V4 = Mirage_key.V4
Ipv4 keys.
module V6 = Mirage_key.V6
Ipv6 keys.
val resolver : ?default:Ipaddr.V4.t -> unit -> Ipaddr.V4.t key
The address of the DNS resolver to use.
val resolver_port : ?default:int -> unit -> int key
The port of the DNS resolver.
val syslog : Ipaddr.V4.t option -> Ipaddr.V4.t option key
The address to send syslog frames to.
val syslog_port : int option -> int option key
The port to send syslog frames to.
val syslog_hostname : string -> string key
The hostname to use in syslog frames.
val logs : Mirage_runtime.log_threshold list key