package mirage

  1. Overview
  2. Docs

This class can be inherited to define a configurable with an API similar to foreign.

In particular, it allows dynamic packages. Here is an example:

let main = impl @@ object
    inherit [_] foreign
        "Unikernel.Main" (console @-> job)
    method packages = Key.(if_ is_xen)
        [package ~sublibs:["xen"] "vchan"]
        [package ~sublibs:["lwt"] "vchan"]
  end
method ty : 'ty typ

ty is the module type of the configurable.

method name : string

name is the unique variable name holding the runtime state of the configurable.

method module_name : string

module_name is the name of the module implementing the configurable.

method packages : package list value

packages is the list of OPAM packages which needs to be installed before compiling the configurable.

method connect : Info.t -> string -> string list -> string

connect info mod args is the code to execute in order to initialize the state associated with the module mod (usually calling mod.connect) with the arguments args, in the context of the project information info.

method configure : Info.t -> (unit, Rresult.R.msg) result

configure info is the code to execute in order to configure the device. During the configuration phase, the specficied packages might not yet be there. The code might involve generating more OCaml code, running shell scripts, etc.

method build : Info.t -> (unit, Rresult.R.msg) result

build info is the code to execute in order to build the device. During the build phase, you can rely that all packages are installed (via opam). The code might involve generating more OCaml code (crunching directories), running shell scripts, etc.

method clean : Info.t -> (unit, Rresult.R.msg) result

clean info is the code to clean-up what has been generated by build and configure.

method keys : key list

keys is the list of command-line keys to set-up the configurable.

method deps : abstract_impl list

deps is the list of abstract implementations that must be initialized before calling connect.

OCaml

Innovation. Community. Security.