Subsystem

Trait Subsystem 

Source
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§

Source

fn name(&self) -> &'static str

Get the unique name of this subsystem

Source

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.

Source

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.

Source

fn is_running(&self) -> bool

Check if the subsystem is currently running

Source

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.

Source

fn as_any(&self) -> &dyn Any

Get a reference to self as Any for downcasting

Source

fn as_any_mut(&mut self) -> &mut dyn Any

Get a mutable reference to self as Any for downcasting

Implementors§