#[cfg(feature = "db-sql")]
pub mod db;
pub mod default;
pub mod registry;
use crate::app::context::AppContext;
use crate::app::{App, PreparedAppWithoutCli};
use crate::error::RoadsterResult;
use async_trait::async_trait;
use axum_core::extract::FromRef;
#[cfg_attr(test, mockall::automock)]
#[async_trait]
pub trait AppLifecycleHandler<A, S>: Send + Sync
where
S: Clone + Send + Sync + 'static,
AppContext: FromRef<S>,
A: App<S> + 'static,
{
fn name(&self) -> String;
fn enabled(&self, _state: &S) -> bool {
true
}
fn priority(&self, _state: &S) -> i32 {
0
}
async fn before_health_checks(
&self,
_prepared_app: &PreparedAppWithoutCli<A, S>,
) -> RoadsterResult<()> {
Ok(())
}
async fn before_services(
&self,
_prepared_app: &PreparedAppWithoutCli<A, S>,
) -> RoadsterResult<()> {
Ok(())
}
async fn on_shutdown(&self, _state: &S) -> RoadsterResult<()> {
Ok(())
}
}