pub trait ModuleLifecycleHook: Send + Sync {
// Provided methods
fn before_init(&self, module_name: &str) -> Result<(), ModuleRuntimeError> { ... }
fn after_init(
&self,
module_name: &str,
duration: Duration,
) -> Result<(), ModuleRuntimeError> { ... }
fn on_init_failure(&self, module_name: &str, error: &ModuleRuntimeError) { ... }
fn before_shutdown(
&self,
module_name: &str,
) -> Result<(), ModuleRuntimeError> { ... }
fn after_shutdown(
&self,
module_name: &str,
) -> Result<(), ModuleRuntimeError> { ... }
fn health_check(
&self,
module_name: &str,
) -> Result<HealthStatus, ModuleRuntimeError> { ... }
}
Expand description
Trait for module lifecycle hooks
Provided Methods§
Sourcefn before_init(&self, module_name: &str) -> Result<(), ModuleRuntimeError>
fn before_init(&self, module_name: &str) -> Result<(), ModuleRuntimeError>
Called before module initialization
Sourcefn after_init(
&self,
module_name: &str,
duration: Duration,
) -> Result<(), ModuleRuntimeError>
fn after_init( &self, module_name: &str, duration: Duration, ) -> Result<(), ModuleRuntimeError>
Called after successful module initialization
Sourcefn on_init_failure(&self, module_name: &str, error: &ModuleRuntimeError)
fn on_init_failure(&self, module_name: &str, error: &ModuleRuntimeError)
Called when module initialization fails
Sourcefn before_shutdown(&self, module_name: &str) -> Result<(), ModuleRuntimeError>
fn before_shutdown(&self, module_name: &str) -> Result<(), ModuleRuntimeError>
Called before module shutdown
Sourcefn after_shutdown(&self, module_name: &str) -> Result<(), ModuleRuntimeError>
fn after_shutdown(&self, module_name: &str) -> Result<(), ModuleRuntimeError>
Called after module shutdown
Sourcefn health_check(
&self,
module_name: &str,
) -> Result<HealthStatus, ModuleRuntimeError>
fn health_check( &self, module_name: &str, ) -> Result<HealthStatus, ModuleRuntimeError>
Health check for the module