hooks: document current hooks
@@ -17,6 +17,48 @@ For example, the `gopts` hook only requires the `get` function. A plugin that wa
Other hooks (e.g. `spec`) require multiple exported functions.
+### `gopts` hook
+
+Currently hard-coded to search for a plugin named `gopts`.
+
+The following function **must** be exported:
+- `get`
+ - Signature: `(Plugin * handle, KeySet * returned, Key * parentKey)`
+ - Called in `kdbGet` after the storage phase, after `notification/send` hook but before the `spec` hook.
+ - TODO: Describe what the function should do
+
+### `spec` hook
+
+Currently hard-coded to search for a plugin named `spec`.
+
+The following functions **must** be exported:
+- `copy`
+ - Signature: `(Plugin * handle, KeySet * returned, Key * parentKey, bool isKdbGet)`
+ - Called in:
+ - `kdbGet`: after the storage phase, after `notification/send` and `gopts` hook.
+ - `kdbSet`: right after the backends are initialized
+ - Should copy all the spec meta keys into the keyset
+
+- `remove`
+ - Signature: `(Plugin * handle, KeySet * returned, Key * parentKey)`
+ - Called in `kdbSet` right after the prestorage phase
+ - Should remove all the spec meta keys from the keyset
+
+### `notification/send` hook
+
+We look within the array `system:/elektra/hook/notification/send/plugins` for the plugins that shall be loaded.
+The name of the plugin **must** be the value of the keys directly below this,
+e.g. `system:/elektra/hook/notification/send/plugins/#0 (= dbus)`.
+
+The following functions **may** be exported (optional):
+- `get`:
+ - Signature: `(Plugin * handle, KeySet * returned, Key * parentKey)`
+ - Called in `kdbGet` after the storage phase.
+
+- `set`:
+ - Signature: `(Plugin * handle, KeySet * returned, Key * parentKey)`
+ - Called in `kdbSet` after the storage phase.
+
## Lifecycle
1. Hooks are initilized within `kdbOpen` after the contract has been processed. This includes loading the plugins.
