remove what no longer has a reader: build-log store, dashboard sent/delivered events, graph resource dep
This commit is contained in:
parent
32f5b74ba4
commit
49266e4410
1 changed files with 204 additions and 1054 deletions
|
|
@ -46,7 +46,7 @@ mod workers;
|
|||
|
||||
pub(crate) use agent_config::{archetypes, limits, permissions, resource_limits, topology};
|
||||
pub(crate) use stats::{container_stats, host_stats, otel_metrics, warnings};
|
||||
pub(crate) use stores::{broker, build_logs, db, power};
|
||||
pub(crate) use stores::{broker, db, power};
|
||||
pub(crate) use workers::{agent_sockets, auto_update, crash_watch, knowledge, mcp_sockets};
|
||||
|
||||
use coordinator::{Coordinator, HiveEnv, ServeConfig};
|
||||
|
|
@ -218,7 +218,7 @@ async fn cmd_serve(
|
|||
) -> Result<()> {
|
||||
// Move any host-side state still at the legacy flat layout into its
|
||||
// subdir (`db/`, `forge/`, `run/`) BEFORE opening the
|
||||
// broker db — the broker + build-logs dbs are among the relocated
|
||||
// broker db — the broker db is among the relocated
|
||||
// files. Idempotent; a no-op once migrated.
|
||||
crate::paths::relocate_legacy_state();
|
||||
// `dashboard_port` is consumed into the Coordinator below; capture the
|
||||
|
|
@ -338,9 +338,6 @@ async fn cmd_serve(
|
|||
// (`OTEL_EXPORTER_OTLP_ENDPOINT`), unauthenticated. The swarm-otel
|
||||
// collector alone forwards upstream. No-op when the endpoint is unset.
|
||||
crate::otel_metrics::spawn_exporter(&coord.hyperhive_flake);
|
||||
// build_logs.sqlite vacuum: c0re-side (single db). Failures kept
|
||||
// 30d, successes 24h — see `build_logs::vacuum` for the rule.
|
||||
crate::build_logs::spawn_vacuum(&coord);
|
||||
// Container crash watcher: warn!()s "container crash detected" when a
|
||||
// previously-running container goes away without an operator-initiated
|
||||
// transient state — a swarm-level grafana alert matches that line.
|
||||
|
|
@ -373,11 +370,6 @@ async fn cmd_serve(
|
|||
job_queue::scheduler::run_worker(q_coord).await;
|
||||
});
|
||||
}
|
||||
// Forward every broker event onto the unified dashboard
|
||||
// channel, so the dashboard SSE sees broker messages and
|
||||
// mutation events on one stream. The broker's intra-process
|
||||
// channel (used by `recv_blocking_batch`) stays untouched.
|
||||
spawn_broker_to_dashboard_forwarder(coord.clone());
|
||||
let dash_coord = coord.clone();
|
||||
tokio::spawn(async move {
|
||||
if let Err(e) = dashboard::serve(dashboard_port, dash_coord).await {
|
||||
|
|
@ -406,59 +398,3 @@ async fn cmd_serve(
|
|||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Re-emit every broker `MessageEvent` onto the dashboard channel as
|
||||
/// a `DashboardEvent::Sent` / `Delivered`.
|
||||
/// Background task; runs for the life of the process. On a lagged
|
||||
/// broker subscription we just keep going — the dashboard channel is
|
||||
/// best-effort presentation plumbing, the broker keeps its own sqlite
|
||||
/// log for replay.
|
||||
fn spawn_broker_to_dashboard_forwarder(coord: Arc<Coordinator>) {
|
||||
use broker::MessageEvent;
|
||||
use dashboard_events::DashboardEvent;
|
||||
let mut rx = coord.broker.subscribe();
|
||||
tokio::spawn(async move {
|
||||
loop {
|
||||
match rx.recv().await {
|
||||
Ok(MessageEvent::Sent {
|
||||
id,
|
||||
from,
|
||||
to,
|
||||
body,
|
||||
at,
|
||||
in_reply_to,
|
||||
}) => {
|
||||
coord.emit_dashboard_event(DashboardEvent::Sent {
|
||||
id,
|
||||
from,
|
||||
to,
|
||||
body,
|
||||
at: hive_sh4re::wire_time::from_secs(at),
|
||||
in_reply_to,
|
||||
});
|
||||
}
|
||||
Ok(MessageEvent::Delivered {
|
||||
id,
|
||||
from,
|
||||
to,
|
||||
body,
|
||||
at,
|
||||
in_reply_to,
|
||||
}) => {
|
||||
coord.emit_dashboard_event(DashboardEvent::Delivered {
|
||||
id,
|
||||
from,
|
||||
to,
|
||||
body,
|
||||
at: hive_sh4re::wire_time::from_secs(at),
|
||||
in_reply_to,
|
||||
});
|
||||
}
|
||||
Err(tokio::sync::broadcast::error::RecvError::Lagged(n)) => {
|
||||
tracing::warn!(skipped = n, "broker-to-dashboard forwarder lagged");
|
||||
}
|
||||
Err(tokio::sync::broadcast::error::RecvError::Closed) => break,
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue