swarm roster shows a declared agent's state before it has ever reported
A declared agent that never reported (e.g. its first deploy was lost) had no hive in the roster row, so the wanted merge skipped it and swarm-ui showed 'no declaration' with the state control disabled. GET /api/agents/status now takes such a row's hive from the one hive whose declaration places the agent, so the declared state shows and the control works on deploy.
This commit is contained in:
parent
0e061067dd
commit
d989636d98
1 changed files with 109 additions and 19 deletions
|
|
@ -12,10 +12,10 @@
|
|||
//! it does not say which hive an agent lives on. That is not a gap this
|
||||
//! module needs to close: a *reporting* agent's hive comes straight out of
|
||||
//! its bucket key (`swarm_wire::agent_status::split_key`), and a
|
||||
//! *never-reported* agent's hive is unknowable regardless of what any
|
||||
//! roster might claim, so [`AgentStatusRow::hive`] is `None` in exactly
|
||||
//! that one case rather than a second lookup this module would have to
|
||||
//! keep in sync with the bucket.
|
||||
//! *never-reported* agent has no bucket key, so [`AgentStatusRow::hive`]
|
||||
//! is `None` out of this module in exactly that one case. The
|
||||
//! `GET /api/agents/status` handler fills it from the wanted declaration
|
||||
//! that places the agent.
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use std::time::{Duration, SystemTime, UNIX_EPOCH};
|
||||
|
|
@ -32,8 +32,9 @@ use crate::status::Freshness;
|
|||
pub struct AgentStatusRow {
|
||||
pub name: String,
|
||||
/// The hive this agent reported from, taken from its bucket key.
|
||||
/// `None` when the agent has never reported — see the module doc for
|
||||
/// why that is not answered from anywhere else.
|
||||
/// `None` when the agent has never reported. Out of this reader only:
|
||||
/// `GET /api/agents/status` fills it from the declaration that places
|
||||
/// the agent.
|
||||
pub hive: Option<String>,
|
||||
pub freshness: Freshness,
|
||||
/// When the snapshot was stored, unix seconds — the bucket's own
|
||||
|
|
|
|||
Loading…
Reference in a new issue