The hive no longer renders, locks or commits a meta flake. A rebuild's MetaSync node picks the internal/meta commit and records it with the hyperhive and config pins it holds; Prebuild, Swap and Create build from it, and a head that does not pin the agent's current config fails the build naming the agent. hive-priv's meta_rev is required. Removed: meta.rs sync/lock/render, the manual-rebuild relock, the boot sweep's hyperhive bump (MetaLock), the update-meta-inputs form and its panel, MetaWindow, the hive's hyperhive_rev setting. Kept: agent_set::refresh holds what sync_agents also did (topology.json, the gateway's agent-socket map and nginx include), called from spawn, destroy, rebuild and the migration. The boot reconcile and the stale-start upgrade compare the agent's marker with the hyperhive pin of internal/meta; the dashboard's deployed chip reads the config marker a successful build writes.
57 lines
2.7 KiB
Rust
57 lines
2.7 KiB
Rust
//! The concrete resource type the rebuild queue schedules over — the bridge
|
|
//! from hive-c0re's [`super::model::NodeKind`] onto the domain-agnostic `hive-jobq` crate.
|
|
//! `hive-jobq` is generic over a resource type `R: Clone + Eq + Hash` and a node
|
|
//! payload `N`; here `R` is [`Resource`] and `N` is [`super::model::NodeKind`] directly (each
|
|
//! variant carries the agent it targets).
|
|
//!
|
|
//! **A node's resources are declared where the node is constructed** with
|
|
//! `.needs(…)`, not derived from its kind. Deriving them made the requirement a
|
|
//! property of the *kind*, which let a kind that happened to run under a
|
|
//! holding ancestor declare nothing at all.
|
|
//!
|
|
//! All of a node's resource edges are acquired **atomically**
|
|
//! (`try_acquire_all`) — a node never holds one resource while waiting on
|
|
//! another, so the multi-resource nodes (the rebuild brace wants a build slot
|
|
//! *and* the agent lease) cannot deadlock against each other.
|
|
|
|
/// The resource classes the queue gates concurrency on, as the crate's
|
|
/// generic resource type `R`. What each holds, who declares it, and the
|
|
/// exemptions: see `docs/scheduler/coordinator.md`'s _Scheduler semantics_
|
|
/// section — this enum stays the one-line summary, not a second copy.
|
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
|
pub enum Resource {
|
|
/// One of the `buildSlots` permits, held by a nix-heavy node for its
|
|
/// duration.
|
|
BuildSlot,
|
|
/// The per-agent lifecycle lease — globally exclusive per agent across
|
|
/// all DAGs.
|
|
Agent(String),
|
|
|
|
/// The `/knowledge` working tree, held by every `KnowledgePull`. Two
|
|
/// overlapping `reset` / `clean` / `pull` passes there fail on
|
|
/// `.git/index.lock` and the remote-tracking ref lock.
|
|
KnowledgeTree,
|
|
/// The hive's matrix provisioning, held by every `MatrixSweep`. Two
|
|
/// overlapping passes on a hive with no persisted Space / chat-room id both
|
|
/// miss the by-name lookup and both `createRoom`, leaving a duplicate room
|
|
/// with agents invited to both.
|
|
MatrixSweep,
|
|
}
|
|
|
|
/// This resource's name on the generic graph wire.
|
|
///
|
|
/// `hive_jobq` is generic over the resource type, so a viewer that can render
|
|
/// any graph gets a string here rather than this enum. The `agent:` prefix
|
|
/// keeps the per-agent leases from colliding with a hypothetical global
|
|
/// resource that happens to share an agent's name.
|
|
impl hive_jobq_wire::WireResource for Resource {
|
|
fn name(&self) -> String {
|
|
match self {
|
|
Resource::BuildSlot => "build-slot".to_owned(),
|
|
Resource::Agent(agent) => format!("agent:{agent}"),
|
|
|
|
Resource::KnowledgeTree => "knowledge-tree".to_owned(),
|
|
Resource::MatrixSweep => "matrix-sweep".to_owned(),
|
|
}
|
|
}
|
|
}
|