Dynamically Loadable Modules

The libmtev library supports loading dynamically loadable modules that can provide optional features to an appliction or change the behavior of exisitng code via hooks.

There are two types of modules in the core libmtev sytems "generics" and "loaders." Loaders know how to load generics. The only built-in module is the "C" loader which knows how to load architecture-appropriate shared objects.

There are several modules that ship with libmtev (though engineers can build more as a part of their application design). These modules are described in the modules section of the manual.

Modules are all configured under the top-level <modules> node in the configuration.

<?xml version="1.0" encoding="utf8" standalone="yes"?>
  <modules directory="../modules">
    <generic image="zipkin_fq" name="zipkin_fq" require_env="FQ">
    <generic image="lua_mtev" name="lua_general">

The <modules> node takes an optional directory attribute that specified where dynamic modules should be found on the filesystem. If omitted, the directory in which modules were installed as a part of your libmtev install will be used. Typically, this attribute is omitted unless you are developing new modules. The attribute acts as a search path and both ':' and ';' can be used as separators between directory entries. If the module cannot be loaded from any of the specified directories, the loader will attempt a fallback to the installation's default module directory.

Like other parts of the sytem <config> blocks are ancestrally merged.

The <generic> stanzas instruct the system to load a module. The above config loads the zipkin_fq module from the zipkin_fq binary image (zipkin_fq.so on ELF systems and zipkin_fq.bundle on mach-o systems like Mac OS X) with no configuration if an only if the FQ environment variable is set. It also loads the lua_general module from the lua_mtev binary image with a configuration.

Generic Options

  • require_env

    This optionally requires conditions around an environment variable. See require_env.

  • image

    The name of the shared object (or bundle on Mac OS X) that will by dynamically loaded into the system.

  • name

    The name of the symbol that will be used to identify the module or loader within the image.

Loader Modules

Loader modules know how to load other types of modules. The only loader that ships with libmtev is the C loader. However new loaders can be implemented by libmtev consumers.

Generic Modules

Generic modules can change the way the system behaves by interfacing with various hooks within the software stack.

results matching ""

    No results matching ""