Skip to main content

bestool_alertd/http_server/
types.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Serialize, Deserialize)]
4pub struct StatusResponse {
5	pub name: String,
6	pub version: String,
7	pub started_at: String,
8	pub pid: u32,
9	/// Backups running on this daemon right now (empty when none, or when
10	/// backups aren't compiled in).
11	#[serde(default)]
12	pub backups_running: Vec<crate::RunningBackup>,
13	/// Backup types configured on this host (empty when none, or when backups
14	/// aren't compiled in).
15	#[serde(default)]
16	pub backups_configured: Vec<String>,
17}
18
19/// The `/seedling` response: what a co-located tool needs to know about this
20/// host's Seedling access.
21#[derive(Serialize, Deserialize)]
22pub struct SeedlingResponse {
23	/// Whether the host carries a Seedling identity for bestool, which a
24	/// privileged process can use to reach the daemon. Never the identity
25	/// itself: a tool asks this to learn that elevating will get it one.
26	pub host_identity: bool,
27}
28
29/// The `/health` response: the watchdog's view of the daemon's liveness.
30#[derive(Serialize, Deserialize)]
31pub struct HealthResponse {
32	/// Whether the daemon is within its watchdog window (always true when the
33	/// watchdog is disabled). The endpoint also signals this via the HTTP status.
34	pub healthy: bool,
35	/// Seconds since a background task last reported activity; `None` if none has
36	/// yet (freshly started).
37	pub last_activity_secs_ago: Option<i64>,
38	/// Seconds since the daemon started.
39	pub uptime_secs: i64,
40	/// The configured watchdog timeout in seconds; `None` when the watchdog is
41	/// disabled.
42	pub watchdog_timeout_secs: Option<u64>,
43}