job_queue: add NodeKind::Reparent (topology moves as a queue node, #2719)
This commit is contained in:
parent
766b1f71fb
commit
05b373474a
6 changed files with 177 additions and 5 deletions
|
|
@ -22,6 +22,7 @@
|
|||
//! spawn(a): Provision(a) → Create(a) → WriteDropin(a) → Reconcile(a) [wanted=Up at approve]
|
||||
//! perm-change(a): WritePermFile(a) → «rebuild subgraph»
|
||||
//! meta-update(inp): MetaLock(inp) →«in-DAG rebuild subgraph per affected a»
|
||||
//! reparent(moves): Reparent(moves) [no rebuild — topology.json is read live]
|
||||
//! ```
|
||||
//!
|
||||
//! For the dynamic power-op shapes (`stop` / `start` / `restart`, built from
|
||||
|
|
@ -341,6 +342,47 @@ pub fn meta_update(
|
|||
}
|
||||
}
|
||||
|
||||
/// Topology move(s) as a single-node DAG. `moves` is `(child, new_parent)`
|
||||
/// pairs — len 1 for `set-parent`, len N for `set-parent-bulk`, applied
|
||||
/// uniformly by the one [`NodeKind::Reparent`] node (which holds the global
|
||||
/// meta window for its duration, same precedent as [`NodeKind::WritePermFile`]).
|
||||
/// No rebuild subgraph: `topology.json` is read live by every consumer
|
||||
/// (dashboard tree, `<parent>`/`<children>` sentinel routing, permission
|
||||
/// checks), so a parent move needs no container rebuild to take effect.
|
||||
/// No transient pill either — the node is agentless (no lease to hang one
|
||||
/// off of) and near-instant.
|
||||
///
|
||||
/// Rides `Template::MetaUpdate` rather than a dedicated variant because
|
||||
/// `Template` is being removed and nothing should dispatch on it — a fresh
|
||||
/// variant would just be more surface to delete later. `Template` is already
|
||||
/// internal-only (not on `DagView`'s wire shape — the dashboard derives its
|
||||
/// label from `nodes`), so the choice of stand-in variant only affects
|
||||
/// `terminal_hook` dispatch (`MetaUpdate` resolves to `None`, same as a
|
||||
/// dedicated variant would) and the per-template history-retention bucket —
|
||||
/// both cosmetic. Swap this to whatever the eventual node-kind-derived
|
||||
/// dispatch lands with, whenever it lands.
|
||||
#[allow(
|
||||
dead_code,
|
||||
reason = "landed ahead of the server.rs/dashboard::topology call-site swap, pending an \
|
||||
answer on whether that swap should be synchronous or fire-and-forget — \
|
||||
exercised today by job_queue::tests and submit::reparent"
|
||||
)]
|
||||
pub fn reparent(
|
||||
moves: Vec<(hive_types::Ident, Option<hive_types::Ident>)>,
|
||||
source: Source,
|
||||
reason: String,
|
||||
) -> DagSpec {
|
||||
DagSpec {
|
||||
template: Template::MetaUpdate,
|
||||
source,
|
||||
reason,
|
||||
approval_id: None,
|
||||
inputs: Vec::new(),
|
||||
transient: None,
|
||||
nodes: vec![node(NodeKind::Reparent { moves }, Vec::new())],
|
||||
}
|
||||
}
|
||||
|
||||
// The boot is assembled inline in `workers/auto_update.rs::submit_boot_tree`
|
||||
// as ONE `Boot` DAG (a sweep `MetaLock` root that grows rebuild subgraphs
|
||||
// in-DAG, plus a `Reconcile` root per drifted agent) — no anchor node and no
|
||||
|
|
|
|||
Loading…
Reference in a new issue