0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-17 23:40:57 +01:00

modules/vm: Add a post-write pre-notify hook site.

This commit is contained in:
Jason Volk 2019-03-09 12:08:05 -08:00
parent 58159d3ee6
commit 79eed85397
2 changed files with 23 additions and 10 deletions

View file

@ -113,17 +113,17 @@ enum ircd::m::vm::fault
/// Evaluation Options
struct ircd::m::vm::opts
{
/// Make writes to database
bool write {true};
/// Make fetches or false to bypass fetch stage.
bool fetch {true};
/// Call eval hooks or false to bypass this stage.
bool eval {true};
/// Apply effects of this event or false to bypass this stage.
bool effects {true};
/// Make writes to database
bool write {true};
/// Call post hooks or false to bypass post-write / pre-notify effects.
bool post {true};
/// Broadcast to clients/servers. When true, individual notify options
/// that follow are considered. When false, no notifications occur.
@ -135,6 +135,9 @@ struct ircd::m::vm::opts
/// Broadcast to federation servers (/federation/send/).
bool notify_servers {true};
/// Apply effects of this event or false to bypass this stage.
bool effects {true};
/// False to allow a dirty conforms report (not recommended).
bool conforming {true};

View file

@ -25,11 +25,12 @@ namespace ircd::m::vm
static void init();
static void fini();
extern hook::site<eval &> commit_hook; ///< Called when this server issues event
extern hook::site<eval &> fetch_hook; ///< Called to resolve dependencies
extern hook::site<eval &> eval_hook; ///< Called when evaluating event
extern hook::site<eval &> notify_hook; ///< Called to broadcast successful eval
extern hook::site<eval &> effect_hook; ///< Called to apply effects of eval
extern hook::site<eval &> commit_hook; ///< Called when this server issues event
extern hook::site<eval &> fetch_hook; ///< Called to resolve dependencies
extern hook::site<eval &> eval_hook; ///< Called when evaluating event
extern hook::site<eval &> post_hook; ///< Called to apply effects pre-notify
extern hook::site<eval &> notify_hook; ///< Called to broadcast successful eval
extern hook::site<eval &> effect_hook; ///< Called to apply effects post-notify
extern conf::item<bool> log_accept_debug;
extern conf::item<bool> log_accept_info;
@ -74,6 +75,12 @@ ircd::m::vm::eval_hook
{ "name", "vm.eval" }
};
decltype(ircd::m::vm::post_hook)
ircd::m::vm::post_hook
{
{ "name", "vm.post" }
};
decltype(ircd::m::vm::notify_hook)
ircd::m::vm::notify_hook
{
@ -491,6 +498,9 @@ try
if(ret != fault::ACCEPT)
return ret;
if(opts.post)
post_hook(event, eval);
if(opts.notify)
notify_hook(event, eval);