jobq-wire: move the generic graph projection into its own crate
The wire types were in hive-host-sock, which is the host *socket* crate — so anything living there is core-shaped by construction, and the projection had quietly grown two core dependencies to match: it selected roots by matching NodeKind::Dag, and rendered payloads through free functions in hive-c0re that nothing obliged a second host to write. hive-jobq is the wrong home too. That crate is the scheduler — logic — and folding presentation in means every consumer of it carries a JSON vocabulary it may never serve. So: a new hive-jobq-wire. A host implements WireNode for its payload N and WireResource for its resource name R; GraphWire::wire_snapshot is blanket-implemented for Graph<N, R> when both hold, and for nothing else. A payload that has never said how it displays has no way onto the wire. wire_snapshot takes the roots to serve rather than reading Graph::roots itself. Nothing is ever removed from a Graph, so retention is a policy only the host can hold; hive-c0re passes visible_roots(), which is the existing MAX_HISTORY_DAGS bound selected structurally (a root is a node with no parent) instead of by node kind.
This commit is contained in:
parent
f357f98867
commit
7966d5eb66
14 changed files with 564 additions and 297 deletions
|
|
@ -58,15 +58,14 @@ pub enum Resource {
|
|||
MetaWindow,
|
||||
}
|
||||
|
||||
impl Resource {
|
||||
/// 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.
|
||||
#[must_use]
|
||||
pub fn wire_name(&self) -> String {
|
||||
/// 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}"),
|
||||
|
|
|
|||
Loading…
Reference in a new issue