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:
parent
58159d3ee6
commit
79eed85397
2 changed files with 23 additions and 10 deletions
|
@ -113,17 +113,17 @@ enum ircd::m::vm::fault
|
||||||
/// Evaluation Options
|
/// Evaluation Options
|
||||||
struct ircd::m::vm::opts
|
struct ircd::m::vm::opts
|
||||||
{
|
{
|
||||||
/// Make writes to database
|
|
||||||
bool write {true};
|
|
||||||
|
|
||||||
/// Make fetches or false to bypass fetch stage.
|
/// Make fetches or false to bypass fetch stage.
|
||||||
bool fetch {true};
|
bool fetch {true};
|
||||||
|
|
||||||
/// Call eval hooks or false to bypass this stage.
|
/// Call eval hooks or false to bypass this stage.
|
||||||
bool eval {true};
|
bool eval {true};
|
||||||
|
|
||||||
/// Apply effects of this event or false to bypass this stage.
|
/// Make writes to database
|
||||||
bool effects {true};
|
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
|
/// Broadcast to clients/servers. When true, individual notify options
|
||||||
/// that follow are considered. When false, no notifications occur.
|
/// that follow are considered. When false, no notifications occur.
|
||||||
|
@ -135,6 +135,9 @@ struct ircd::m::vm::opts
|
||||||
/// Broadcast to federation servers (/federation/send/).
|
/// Broadcast to federation servers (/federation/send/).
|
||||||
bool notify_servers {true};
|
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).
|
/// False to allow a dirty conforms report (not recommended).
|
||||||
bool conforming {true};
|
bool conforming {true};
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,9 @@ namespace ircd::m::vm
|
||||||
extern hook::site<eval &> commit_hook; ///< Called when this server issues event
|
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 &> fetch_hook; ///< Called to resolve dependencies
|
||||||
extern hook::site<eval &> eval_hook; ///< Called when evaluating event
|
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 &> notify_hook; ///< Called to broadcast successful eval
|
||||||
extern hook::site<eval &> effect_hook; ///< Called to apply effects of 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_debug;
|
||||||
extern conf::item<bool> log_accept_info;
|
extern conf::item<bool> log_accept_info;
|
||||||
|
@ -74,6 +75,12 @@ ircd::m::vm::eval_hook
|
||||||
{ "name", "vm.eval" }
|
{ "name", "vm.eval" }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
decltype(ircd::m::vm::post_hook)
|
||||||
|
ircd::m::vm::post_hook
|
||||||
|
{
|
||||||
|
{ "name", "vm.post" }
|
||||||
|
};
|
||||||
|
|
||||||
decltype(ircd::m::vm::notify_hook)
|
decltype(ircd::m::vm::notify_hook)
|
||||||
ircd::m::vm::notify_hook
|
ircd::m::vm::notify_hook
|
||||||
{
|
{
|
||||||
|
@ -491,6 +498,9 @@ try
|
||||||
if(ret != fault::ACCEPT)
|
if(ret != fault::ACCEPT)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
if(opts.post)
|
||||||
|
post_hook(event, eval);
|
||||||
|
|
||||||
if(opts.notify)
|
if(opts.notify)
|
||||||
notify_hook(event, eval);
|
notify_hook(event, eval);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue