Executables

mk

mk is intended to be the primary command line interface for client interactions with mKTL. The command line arguments describe its usage:

usage: mk [-h] [-s STORE] [--serial] [--no-wait] [--formatted] [--unformatted]
          [--terse] [--timestamp] [--no-timestamp] [-u UNITS]
          {get,set,watch,describe,discover,list} [requests ...]

This is the mKTL command line interface. The real work is done in the
mktl Python library; this executable parses command-line flags, invokes
mktl routines to handle any/all requests, and otherwise waits until all
requests are complete. Note that the default is to execute all requests
in parallel.

positional arguments:
  {get,set,watch,describe,discover,list}
                        Request type
  requests              Whitespace-separated sequence of requests. For a get,
                        watch, or describe request, this is a sequence of
                        keys; for a set request, this is a sequence of
                        key=value statements; for a list request this is a
                        sequence of stores; for a discover request this is a
                        sequence of broker addresses.

options:
  -h, --help            show this help message and exit
  -s, --store STORE     Name of an mKTL store to prefix to all subsequent
                        keys.
  --serial              Process all requests serially. The default is to
                        process requests in parallel.
  --no-wait             Do not wait until all set requests are complete before
                        exiting. The default is to wait. --no-wait is not
                        compatible with --serial.
  --formatted           Show the formatted value for get requests, and
                        interpret the provided value as formatted for set
                        requests. This is the default behavior.
  --unformatted         Show the unformatted value for get requests, and
                        interpret the provided value as unformatted for set
                        requests. The default is to use the formatted value.
  --terse               For get and set requests, only output the requested
                        value and no other metadata.
  --timestamp           Include the timestamp with the output of 'get'
                        requests. The default is to include the timestamp for
                        'watch' requests, and omit it from 'get' requests.
  --no-timestamp        Omit the timestamp from the output of 'watch'
                        requests. The default is to include the timestamp for
                        'watch' requests, and omit it from 'get' requests.
  -u, --units UNITS     Use the requested units for getting or setting tem
                        values. Note that this option is applied to all
                        requests, and is not practical when interacting with
                        multiple items.

Example usage:

    mk get rosebud.model rosebud.length
    mk get -s rosebud model length height color
    mk set rosebud.speed=50
    mk set -s rosebud speed=50 passengers=2 --no-wait
    mk watch rosebud.model rosebud.length
    mk watch -s rosebud model length height color
    mk list -s rosebud
    mk list rosebud redflyer

mkd

The mkd executable provides a command-line interface to invoke a persistent daemon executing a mktl.Daemon subclass to implement application-specific functionality. The mkd executable is intended to be the common point of entry for any Python-based mKTL daemon.

The command line arguments describe its usage:

usage: mkd [-h] [-m MODULE] [-s SUBCLASS] [-c CONFIGURATION] [-a APPCONFIG]
           [-o]
           store alias

This is a generic mKTL daemon. The real work is done in the subclass of
mktl.Daemon (if any); this executable parses command-line flags, invokes
a mktl.Daemon instance to handle any/all requests, and otherwise waits
until the program is terminated.

The store name and configuration alias must be specified in order for
this daemon to function correctly; all other arguments are optional.

positional arguments:
  store                 Name of this mKTL store.
  alias                 Unique alias for the mKTL configuration associated
                        with this specific daemon; this is an arbitrary
                        string, and must be unique for this daemon within this
                        store.

options:
  -h, --help            show this help message and exit
  -m, --module MODULE   Module to import which contains the mktl.Daemon
                        subclass to invoke.
  -s, --subclass SUBCLASS
                        Specific mktl.Daemon subclass to invoke; this is the
                        bare class name (Daemon), not a fully qualified class
                        name (mktl.Daemon).
  -c, --configuration CONFIGURATION
                        File containing daemon-specific mKTL configuration of
                        items; if specified, the contents of this file will
                        supplant any cached daemon-specific configuration for
                        this store+alias.
  -a, --appconfig APPCONFIG
                        Custom configuration file location, not used directly
                        by mKTL, but made available to the mktl.Daemon
                        subclass. How this directive is used is entirely up to
                        the application-specific subclass code.
  -o, --override        Request that the local network clear any cached
                        configuration conflicting with what this daemon will
                        announce. The override will only be permitted if the
                        conflicting daemons are all offline.

For example, to run mkd for the store 'rosebud', using the existing
on-disk configuration identified as 'innocence', first using the default
caching implementation, and then with a custom Kane.Sled subclass of
mktl.Daemon, one might invoke:

    mkd rosebud innocence
    mkd rosebud innocence --module Kane --subclass Sled

mkbrokerd

The mkbrokerd persistent daemon is a discovery aid, listening for UDP broadcasts on a well-known port number so that clients can be directed to a specific mKTL daemon handling requests for a specific store, or fraction of a store. While having a mkbrokerd daemon running is not a strict requirement it is a key component of automated discovery of mKTL stores on a local network.