pub struct AppState {
pub config: Arc<Config>,
pub token: String,
pub dedup: DedupStore,
pub event_logger: EventLogger,
pub privacy_filter: PrivacyFilter,
pub event_counter: AtomicU64,
pub shutdown_tx: Mutex<Option<Sender<()>>>,
pub started_at: Instant,
pub available_update: Mutex<Option<String>>,
}Expand description
Shared state injected into every axum handler via Arc<AppState>.
Fields are either inherently thread-safe (AtomicU64, DashMap, mpsc::Sender)
or wrapped in appropriate synchronization primitives.
Fields§
§config: Arc<Config>Resolved daemon configuration (port, log dir, retention, etc.)
token: StringBearer token for authenticating POST requests. SECURITY: Never log this value.
dedup: DedupStoreIn-memory dedup store with 100ms TTL.
event_logger: EventLoggerAsync event logger (sends to background writer task via mpsc).
privacy_filter: PrivacyFilterPre-compiled privacy filter for credential masking.
event_counter: AtomicU64Total events processed (not counting deduped duplicates).
shutdown_tx: Mutex<Option<Sender<()>>>Oneshot sender for triggering graceful shutdown via POST /shutdown.
Wrapped in Mutex so the handler can take ownership without &mut self.
started_at: InstantWall-clock time when the daemon started (for uptime reporting).
available_update: Mutex<Option<String>>Latest available version string, populated by the async update check on startup.
None means either the check has not completed yet, or the current version is latest.
Implementations§
Source§impl AppState
impl AppState
Sourcepub fn set_available_update(&self, version: String)
pub fn set_available_update(&self, version: String)
Store a newly discovered available version.
Sourcepub fn get_available_update(&self) -> Option<String>
pub fn get_available_update(&self) -> Option<String>
Return the latest available version, if one has been discovered.