pub trait Subsystem:
Send
+ Sync
+ Any
+ HasVersion {
// Required methods
fn name(&self) -> &'static str;
fn start<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn shutdown<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
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<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn shutdown<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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