pub struct HookExecutor { /* private fields */ }Expand description
Hook executor
Responsible for executing plugin hooks at specific points in the system. Handles error propagation, logging, and execution order.
Implementations§
Source§impl HookExecutor
impl HookExecutor
Sourcepub fn without_fail_fast() -> Self
pub fn without_fail_fast() -> Self
Create a hook executor with fail-fast disabled
When fail-fast is disabled, all plugins will be executed even if some fail. Useful for after-hooks where you want to ensure all plugins get a chance to run.
Sourcepub fn with_metrics(self) -> Self
pub fn with_metrics(self) -> Self
Enable metrics collection
Sourcepub async fn execute_before(
&self,
hook: HookPoint,
plugins: &[Arc<dyn Plugin>],
context: &PluginContext,
) -> Result<(), PluginError>
pub async fn execute_before( &self, hook: HookPoint, plugins: &[Arc<dyn Plugin>], context: &PluginContext, ) -> Result<(), PluginError>
Execute before hooks
Executes all plugins at the specified hook point. If fail_fast is enabled, stops at the first error. Otherwise, collects all errors and returns them.
Sourcepub async fn execute_after(
&self,
hook: HookPoint,
plugins: &[Arc<dyn Plugin>],
context: &PluginContext,
) -> Result<(), PluginError>
pub async fn execute_after( &self, hook: HookPoint, plugins: &[Arc<dyn Plugin>], context: &PluginContext, ) -> Result<(), PluginError>
Execute after hooks
Executes all plugins at the specified hook point. After hooks never fail the operation - errors are logged but execution continues.
Sourcepub async fn execute(
&self,
hook: HookPoint,
plugins: &[Arc<dyn Plugin>],
context: &PluginContext,
) -> Result<(), PluginError>
pub async fn execute( &self, hook: HookPoint, plugins: &[Arc<dyn Plugin>], context: &PluginContext, ) -> Result<(), PluginError>
Execute a hook point
Automatically determines whether to use before or after hook semantics based on the hook point.