bestool-alertd 16.0.1

(Internal) BES tooling: healthcheck daemon
Documentation
use std::{collections::HashMap, sync::Arc, time::Duration};

use jiff::Timestamp;

use crate::{context::InternalContext, daemon::DaemonControl, tasks::TaskEndpointHandler};

#[derive(Clone)]
pub struct ServerState {
	pub started_at: Timestamp,
	pub pid: u32,
	pub internal_context: Arc<InternalContext>,
	pub watchdog_timeout: Option<Duration>,
	/// Endpoint handlers exposed by registered background tasks. Keyed by
	/// `(task_name, endpoint_name)` so the `/tasks/:task/:endpoint` route can
	/// dispatch in O(1) without walking the task registry per request.
	pub task_endpoints: Arc<HashMap<(String, String), TaskEndpointHandler>>,
	/// Drives the daemon's `/reload` and `/restart` control endpoints.
	pub control: DaemonControl,
	/// Backup run registry, when backups are compiled in; lets `/status` list
	/// in-flight runs.
	pub backups: Option<Arc<crate::BackupRegistry>>,
}