Skip to main content

worldinterface_daemon/
state.rs

1//! Shared application state for route handlers.
2
3use std::sync::{Arc, RwLock};
4
5use worldinterface_host::EmbeddedHost;
6use worldinterface_http_trigger::WebhookRegistry;
7
8use crate::metrics::WiMetricsRegistry;
9
10/// Shared application state for all route handlers.
11pub struct AppState {
12    /// The embedded host (owns AQ engine, ContextStore, ConnectorRegistry).
13    pub host: EmbeddedHost,
14    /// Webhook registry (loaded from ContextStore at startup, modified via API).
15    pub webhook_registry: RwLock<WebhookRegistry>,
16    /// Prometheus metrics registry.
17    pub metrics: Arc<WiMetricsRegistry>,
18}
19
20/// Type alias for the shared state passed to axum handlers.
21pub type SharedState = Arc<AppState>;