remove the hivectl-only quota verbs and the trollshell status feed
This commit is contained in:
parent
70a8e54038
commit
cf360b74b9
1 changed files with 51 additions and 521 deletions
|
|
@ -155,22 +155,6 @@ pub enum HostRequest {
|
|||
/// pending reminders) — the `hivectl list-agents` roster view.
|
||||
/// Reuses the dashboard's per-agent `ContainerView` aggregation.
|
||||
AgentStatus,
|
||||
/// Turn this connection into a live push feed of agent-status changes,
|
||||
/// so a polling loop against [`HostRequest::AgentStatus`] is no longer
|
||||
/// the only way to notice one. The one verb on this socket that answers
|
||||
/// with more than one response: the server acks with a bare
|
||||
/// [`HostResponse::success()`] first, then keeps the connection open
|
||||
/// and writes one further [`HostResponse::agent_statuses`] (always a
|
||||
/// single-row `Vec`) per changed agent, for as long as the client stays
|
||||
/// connected. No further requests are read on this connection after
|
||||
/// this one — open a fresh connection for anything else.
|
||||
///
|
||||
/// Best-effort, same contract the dashboard's own live channel already
|
||||
/// has: a slow reader can miss updates rather than back-pressuring the
|
||||
/// daemon, so a client that cares about the *current* state after a gap
|
||||
/// should still fall back to a fresh [`HostRequest::AgentStatus`] poll,
|
||||
/// not assume the stream alone is authoritative.
|
||||
SubscribeAgentStatus,
|
||||
/// Report this hive's canonical DNS domain
|
||||
/// (`services.hyperhive.domain`) plus the browser-facing home /
|
||||
/// forge / matrix URLs, daemon-sourced so custom forge/matrix
|
||||
|
|
@ -210,32 +194,6 @@ pub enum HostRequest {
|
|||
#[serde(default)]
|
||||
scope: LifecycleScope,
|
||||
},
|
||||
/// Turn on btrfs qgroup accounting on the agent-state filesystem, via
|
||||
/// the privileged helper. Daemon-side equivalent of `hivectl
|
||||
/// quota-enable`. Returns advisory lines in [`HostResponse::messages`].
|
||||
QuotaEnable,
|
||||
/// Set (or, with `limit = None`, clear) an agent's btrfs disk quota via
|
||||
/// the privileged helper. Daemon-side equivalent of `hivectl agent
|
||||
/// <name> quota set`; the size string is parsed to bytes client-side.
|
||||
/// Returns a bare success — the client prints the confirmation from
|
||||
/// the value it sent.
|
||||
QuotaLimit {
|
||||
name: Ident,
|
||||
#[serde(default)]
|
||||
limit: Option<u64>,
|
||||
},
|
||||
/// Report btrfs qgroup usage (`hivectl agent <name> quota show`, or all
|
||||
/// kept state dirs when `name` is absent — no CLI path reaches the
|
||||
/// absent case today, but the daemon still supports it). The daemon
|
||||
/// resolves the agent set and reads each subvolume's referenced/
|
||||
/// exclusive usage via the privileged helper. Result rows land in
|
||||
/// [`HostResponse::quota`]; a "btrfs quota not enabled" error
|
||||
/// short-circuits the whole sweep as a plain [`HostResponse::error`]
|
||||
/// so the client can print the enable hint.
|
||||
QuotaShow {
|
||||
#[serde(default)]
|
||||
name: Option<Ident>,
|
||||
},
|
||||
/// Migrate an agent's plain state dir to a btrfs subvolume via the
|
||||
/// privileged helper (`hivectl agent <name> subvol upgrade`). The agent
|
||||
/// MUST already be stopped — the client orchestrates stop → this →
|
||||
|
|
@ -263,25 +221,6 @@ pub enum HostRequest {
|
|||
},
|
||||
}
|
||||
|
||||
/// One agent's btrfs qgroup usage row — the [`HostRequest::QuotaShow`]
|
||||
/// result unit. `referenced` / `exclusive` are byte counts when the agent
|
||||
/// has a live qgroup; both are `None` (with an explanatory `note`) for a
|
||||
/// plain-dir agent that has no subvolume to account. The client formats the
|
||||
/// byte counts into human-readable columns.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct QuotaRow {
|
||||
pub agent: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub referenced: Option<u64>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub exclusive: Option<u64>,
|
||||
/// Set instead of the byte counts when the agent has no qgroup data
|
||||
/// (plain dir, or a non-"quota not enabled" read error), so the client
|
||||
/// can print an inline explanation and keep going.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub note: Option<String>,
|
||||
}
|
||||
|
||||
/// Selects which container classes a hive-wide [`HostRequest::Stop`] /
|
||||
/// [`HostRequest::Start`] touches. An all-false scope means **everything**
|
||||
/// (the bare `hivectl stop` / `start`); set individual fields to restrict
|
||||
|
|
@ -401,10 +340,6 @@ pub struct HostResponse {
|
|||
/// Empty for requests that produce no such output.
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub messages: Vec<String>,
|
||||
/// `QuotaShow` result — one row per agent with its btrfs qgroup usage.
|
||||
/// `None` for every other request kind.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub quota: Option<Vec<QuotaRow>>,
|
||||
}
|
||||
|
||||
/// Hand-written rather than `#[derive(Default)]` for one reason:
|
||||
|
|
@ -426,7 +361,6 @@ impl Default for HostResponse {
|
|||
queued_dags: None,
|
||||
nodes: None,
|
||||
messages: Vec::new(),
|
||||
quota: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -520,14 +454,4 @@ impl HostResponse {
|
|||
..Self::default()
|
||||
}
|
||||
}
|
||||
|
||||
/// `QuotaShow` result — one usage row per agent.
|
||||
#[must_use]
|
||||
pub fn quota(rows: Vec<QuotaRow>) -> Self {
|
||||
Self {
|
||||
ok: true,
|
||||
quota: Some(rows),
|
||||
..Self::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue