pub trait App<AppEv: Send + Sync + 'static, AppMetric: Send + Sync + 'static> {
type AppConfig: Config;
type AppSecrets: Secrets;
type Setup;
// Required methods
fn name(&self) -> &'static str;
fn setup<'life0, 'life1, 'async_trait>(
&'life0 mut self,
wora: &'life1 Wora<AppEv, AppMetric>,
exec: impl 'async_trait + AsyncExecutor<AppEv, AppMetric>,
fs: impl 'async_trait + WFS + 'static,
metrics: Sender<O11yEvent<AppMetric>>,
is_first_boot: bool,
) -> Pin<Box<dyn Future<Output = Result<Self::Setup, Box<dyn Error>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn main<'life0, 'life1, 'async_trait>(
&'life0 mut self,
wora: &'life1 mut Wora<AppEv, AppMetric>,
exec: impl 'async_trait + AsyncExecutor<AppEv, AppMetric>,
fs: impl 'async_trait + WFS + 'static,
metrics: Sender<O11yEvent<AppMetric>>,
) -> Pin<Box<dyn Future<Output = MainRetryAction> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn end<'life0, 'life1, 'async_trait>(
&'life0 mut self,
wora: &'life1 Wora<AppEv, AppMetric>,
exec: impl 'async_trait + AsyncExecutor<AppEv, AppMetric>,
fs: impl 'async_trait + WFS + 'static,
metrics: Sender<O11yEvent<AppMetric>>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn allow_concurrent_executions(&self) -> bool { ... }
fn configure<'life0, 'async_trait>(
&'life0 mut self,
_config: <Self::AppConfig as Config>::ConfigT,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait { ... }
fn reload_config<'life0, 'async_trait>(
&'life0 mut self,
reload: ConfigReload<<Self::AppConfig as Config>::ConfigT>,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait { ... }
fn reload_secrets<'life0, 'async_trait>(
&'life0 mut self,
_reload: SecretReload<<Self::AppSecrets as Secrets>::SecretT>,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Application lifecycle implemented by WORA workloads.
Runtime health and readiness supervision is driven through
Wora::report_health, Wora::report_readiness, or a cloned
RuntimeStatusHandle, not by polling an app callback.
Required Associated Types§
Sourcetype AppSecrets: Secrets
type AppSecrets: Secrets
Secret parser for the app.
Required Methods§
Sourcefn name(&self) -> &'static str
fn name(&self) -> &'static str
Stable application name used for directories, locks, and logging.
Sourcefn setup<'life0, 'life1, 'async_trait>(
&'life0 mut self,
wora: &'life1 Wora<AppEv, AppMetric>,
exec: impl 'async_trait + AsyncExecutor<AppEv, AppMetric>,
fs: impl 'async_trait + WFS + 'static,
metrics: Sender<O11yEvent<AppMetric>>,
is_first_boot: bool,
) -> Pin<Box<dyn Future<Output = Result<Self::Setup, Box<dyn Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn setup<'life0, 'life1, 'async_trait>(
&'life0 mut self,
wora: &'life1 Wora<AppEv, AppMetric>,
exec: impl 'async_trait + AsyncExecutor<AppEv, AppMetric>,
fs: impl 'async_trait + WFS + 'static,
metrics: Sender<O11yEvent<AppMetric>>,
is_first_boot: bool,
) -> Pin<Box<dyn Future<Output = Result<Self::Setup, Box<dyn Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Initialize application state after executor setup and before main.
Sourcefn main<'life0, 'life1, 'async_trait>(
&'life0 mut self,
wora: &'life1 mut Wora<AppEv, AppMetric>,
exec: impl 'async_trait + AsyncExecutor<AppEv, AppMetric>,
fs: impl 'async_trait + WFS + 'static,
metrics: Sender<O11yEvent<AppMetric>>,
) -> Pin<Box<dyn Future<Output = MainRetryAction> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn main<'life0, 'life1, 'async_trait>(
&'life0 mut self,
wora: &'life1 mut Wora<AppEv, AppMetric>,
exec: impl 'async_trait + AsyncExecutor<AppEv, AppMetric>,
fs: impl 'async_trait + WFS + 'static,
metrics: Sender<O11yEvent<AppMetric>>,
) -> Pin<Box<dyn Future<Output = MainRetryAction> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Run the primary application loop.
Sourcefn end<'life0, 'life1, 'async_trait>(
&'life0 mut self,
wora: &'life1 Wora<AppEv, AppMetric>,
exec: impl 'async_trait + AsyncExecutor<AppEv, AppMetric>,
fs: impl 'async_trait + WFS + 'static,
metrics: Sender<O11yEvent<AppMetric>>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn end<'life0, 'life1, 'async_trait>(
&'life0 mut self,
wora: &'life1 Wora<AppEv, AppMetric>,
exec: impl 'async_trait + AsyncExecutor<AppEv, AppMetric>,
fs: impl 'async_trait + WFS + 'static,
metrics: Sender<O11yEvent<AppMetric>>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Clean up application state after main returns.
Provided Methods§
Sourcefn allow_concurrent_executions(&self) -> bool
fn allow_concurrent_executions(&self) -> bool
Return whether multiple instances may run concurrently.
Sourcefn configure<'life0, 'async_trait>(
&'life0 mut self,
_config: <Self::AppConfig as Config>::ConfigT,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn configure<'life0, 'async_trait>(
&'life0 mut self,
_config: <Self::AppConfig as Config>::ConfigT,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
Apply an initially loaded application configuration.
For event-driven apps, runtime config reloads usually flow through
reload_config instead of this hook directly.
Sourcefn reload_config<'life0, 'async_trait>(
&'life0 mut self,
reload: ConfigReload<<Self::AppConfig as Config>::ConfigT>,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn reload_config<'life0, 'async_trait>(
&'life0 mut self,
reload: ConfigReload<<Self::AppConfig as Config>::ConfigT>,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
Apply a typed configuration reload.
Sourcefn reload_secrets<'life0, 'async_trait>(
&'life0 mut self,
_reload: SecretReload<<Self::AppSecrets as Secrets>::SecretT>,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn reload_secrets<'life0, 'async_trait>(
&'life0 mut self,
_reload: SecretReload<<Self::AppSecrets as Secrets>::SecretT>,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
Apply a typed secret reload.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".