feat(#438): add StartupSweep queue kind — group boot-time rebuilds under a parent entry
This commit is contained in:
parent
816523861c
commit
ba7e9b0ef2
4 changed files with 64 additions and 20 deletions
|
|
@ -27,6 +27,11 @@ pub enum QueueKind {
|
|||
/// variant exists so the wire shape doesn't need to change later.
|
||||
#[allow(dead_code, reason = "wire shape — routed by a future PR")]
|
||||
Destroy,
|
||||
/// hive-c0re boot-time sweep: bumps the meta hyperhive lock then
|
||||
/// enqueues a `Rebuild` child for every managed container. Completes
|
||||
/// after the lock bump; children run as independent queue entries
|
||||
/// grouped under this parent's `id`. `agent` = `"hyperhive"`.
|
||||
StartupSweep,
|
||||
}
|
||||
|
||||
impl QueueKind {
|
||||
|
|
@ -36,6 +41,7 @@ impl QueueKind {
|
|||
QueueKind::MetaUpdate => "meta_update",
|
||||
QueueKind::Spawn => "spawn",
|
||||
QueueKind::Destroy => "destroy",
|
||||
QueueKind::StartupSweep => "startup_sweep",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -54,8 +60,13 @@ pub enum QueueSource {
|
|||
/// the originating meta-update.
|
||||
MetaUpdate,
|
||||
/// `auto_update::run` startup sweep — rebuild every container on
|
||||
/// hive-c0re boot.
|
||||
/// hive-c0re boot. Child rebuilds of a `StartupSweep` entry use
|
||||
/// this source; the `parent_id` links them to the parent.
|
||||
AutoUpdate,
|
||||
/// Direct child of a `StartupSweep` queue entry. Same semantics
|
||||
/// as `AutoUpdate` but carries the `parent_id` back-link so the
|
||||
/// dashboard can render the sweep's per-agent rebuilds nested.
|
||||
StartupSweep,
|
||||
/// Crash recovery path (future use — currently no auto-rebuild on
|
||||
/// crash, but the variant exists for the imminent feature).
|
||||
#[allow(dead_code, reason = "wire shape — used by a future feature")]
|
||||
|
|
@ -73,6 +84,7 @@ impl QueueSource {
|
|||
QueueSource::Manual => "manual",
|
||||
QueueSource::MetaUpdate => "meta_update",
|
||||
QueueSource::AutoUpdate => "auto_update",
|
||||
QueueSource::StartupSweep => "startup_sweep",
|
||||
QueueSource::CrashRecover => "crash_recover",
|
||||
QueueSource::Approval => "approval",
|
||||
}
|
||||
|
|
@ -552,6 +564,19 @@ async fn dispatch(
|
|||
// Reserved for future `destroy --purge` integration.
|
||||
anyhow::bail!("Destroy kind not yet implemented in rebuild_queue worker");
|
||||
}
|
||||
(QueueKind::StartupSweep, _) => {
|
||||
// Bump meta's hyperhive input before per-agent child rebuilds
|
||||
// run so they build against the latest base. Non-fatal on
|
||||
// failure — child rebuilds proceed regardless. After the bump
|
||||
// (or failure) this entry transitions to Done and the worker
|
||||
// drains the pre-enqueued child Rebuild entries.
|
||||
coord.set_queue_step(Some(entry.id), "nix flake update hyperhive");
|
||||
if let Err(e) = crate::meta::lock_update_hyperhive().await {
|
||||
tracing::warn!(error = ?e, "startup_sweep: meta lock_update_hyperhive failed");
|
||||
}
|
||||
// `finish` clears the step label; no explicit clear needed here.
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue