mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
plugin: Introduce plugin type to allow singleton and chaining
The newly introduced type is used to determine what the call semantics of the
hook are. We have `single` corresponding to the old behavior, as well as
`chain` which allows multiple plugins to register for the hook, and they are
then called sequentially (if all plugins return `{"result": "continue"}`) or
exit the chain if the hook event was handled.
This commit is contained in:
committed by
Rusty Russell
parent
30580731a6
commit
9a2a09efd6
@@ -130,7 +130,8 @@ void plugin_hook_call_(struct lightningd *ld, const struct plugin_hook *hook,
|
||||
* annoying, and to make it clear that it's totally synchronous. */
|
||||
|
||||
/* Special synchronous hook for db */
|
||||
static struct plugin_hook db_write_hook = { "db_write", NULL, NULL, NULL };
|
||||
static struct plugin_hook db_write_hook = {"db_write", PLUGIN_HOOK_SINGLE, NULL,
|
||||
NULL, NULL};
|
||||
AUTODATA(hooks, &db_write_hook);
|
||||
|
||||
static void db_hook_response(const char *buffer, const jsmntok_t *toks,
|
||||
|
||||
Reference in New Issue
Block a user