use crate::error::Result;
use async_trait::async_trait;
#[async_trait]
pub trait IcarusServerLifecycle: Send + Sync {
async fn on_initialize(&mut self) -> Result<()> {
Ok(())
}
async fn on_pre_upgrade(&self) -> Result<()> {
Ok(())
}
async fn on_post_upgrade(&mut self) -> Result<()> {
Ok(())
}
async fn on_stop(&self) -> Result<()> {
Ok(())
}
async fn on_heartbeat(&mut self) -> Result<()> {
Ok(())
}
}
#[derive(Debug, Clone)]
pub struct LifecycleConfig {
pub heartbeat_interval: u64,
pub auto_snapshot: bool,
pub max_snapshots: u32,
}