pub trait Subsystem:
Send
+ Sync
+ Any
+ HasVersion {
// Required methods
fn name(&self) -> &'static str;
fn start(&mut self) -> Result<()>;
fn shutdown(&mut self) -> Result<()>;
fn is_running(&self) -> bool;
fn health_status(&self) -> HealthStatus;
fn as_any(&self) -> &dyn Any;
fn as_any_mut(&mut self) -> &mut dyn Any;
}Expand description
Uniform interface that all subsystems must implement
This trait provides a consistent lifecycle and monitoring interface for all subsystems managed by the Database.
Required Methods§
Sourcefn start(&mut self) -> Result<()>
fn start(&mut self) -> Result<()>
Start the subsystem
This method should initialize the subsystem and start any background threads or processes. It should be idempotent - calling start() on an already running subsystem should succeed without side effects.
Sourcefn shutdown(&mut self) -> Result<()>
fn shutdown(&mut self) -> Result<()>
Shutdown the subsystem
This method should gracefully shut down the subsystem and clean up any resources. This is a terminal operation - once shutdown, the subsystem cannot be restarted. It should be idempotent - calling shutdown() on an already shutdown subsystem should succeed without side effects.
Sourcefn is_running(&self) -> bool
fn is_running(&self) -> bool
Check if the subsystem is currently running
Sourcefn health_status(&self) -> HealthStatus
fn health_status(&self) -> HealthStatus
Get the current health status of the subsystem
This should provide information about the subsystem’s operational status and any errors or warnings.
Sourcefn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Get a mutable reference to self as Any for downcasting