$darkmode
Elektra 0.11.0
|
The kdbOpen()
function accepts a KeySet * contract
parameter. This parameter allows you to extend and configure the KDB within your application without permanently changing files on disk.
The contract consists of Keys below system:/elektra/contract/<type>
, where <type>
is one of a set of predefined contract types. Currently, the types globalkeyset
and mountglobal
are supported.
To insert data into the global KeySet during kdbOpen
, you can add keys below system:/elektra/contract/globalkeyset
. All these keys will be renamed and copied into the global KeySet that is passed to all plugins.
Specifically, the subset below system:/elektra/contract/globalkeyset
is moved to system:/elektra
and then inserted into the global KeySet.
You can also mount a global plugin with a contract. To do this, add a key system:/elektra/contract/mountglobal/<plugin>
where <plugin>
is the name of the plugin you want to mount. The keys below system:/elektra/contract/mountglobal/<plugin>
will be moved to user:/
and used as the config for <plugin>
.
There are a few pre-defined contracts that can be accessed via helper functions.
To mount and configure the gopts
plugin you can use elektraGOptsContract
. There is also elektraGOptsContractFromStrings
, but its use is discouraged unless you really need it. It mainly exists for use from various bindings.
To set the I/O binding to be used in a KDB instance, use elektraIoContract
.
To set up notifications use the elektraNotificationContract
function. It automatically sets up the internalnotification
plugin.
If you also need to set up notification transport plugins, you should manually add the relevant system:/elektra/contract/mountglobal/<plugin>
keys and the required config below.