From 8366f7c5de474753dbfbf88431917e79c15e5389 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 3 Nov 2026 05:21:25 +0100 Subject: replace eager links by trees --- src/api/dashboard/clocks.rs | 2 -- src/api/dashboard/dashboard.html | 36 +----------------------------------- src/api/dashboard/mod.rs | 2 -- src/api/stats.rs | 11 +++-------- src/api/stats/prometheus.rs | 18 +++--------------- 5 files changed, 7 insertions(+), 62 deletions(-) (limited to 'src/api') diff --git a/src/api/dashboard/clocks.rs b/src/api/dashboard/clocks.rs index ac58676..9f069be 100644 --- a/src/api/dashboard/clocks.rs +++ b/src/api/dashboard/clocks.rs @@ -99,8 +99,6 @@ mod tests { down: false, rtt_us: None, dormant: false, - eager_to: false, - eager_from: false, others: Vec::new(), clock: Some(ClockOffset { offset_ms, diff --git a/src/api/dashboard/dashboard.html b/src/api/dashboard/dashboard.html index 1b442ae..9132275 100644 --- a/src/api/dashboard/dashboard.html +++ b/src/api/dashboard/dashboard.html @@ -161,9 +161,6 @@ .legend .dormant::before { border-top-width: 1.5px; --colour: var(--muted); box-shadow: 0 0 0 2.5px color-mix(in srgb, var(--bad) 50%, transparent); } .legend .silent::before { border-top-style: dotted; --colour: var(--muted); } - /* A chevron on the line, as on the map. */ - .legend .eager::before { content: "\203A"; width: auto; height: auto; border: none; - font-weight: bold; font-size: 15px; line-height: 0; } .legend .hint::before { display: none; } /* A kind of message: a dot in its colour, as on the map. */ .legend .message::before { width: 8px; height: 8px; border: none; border-radius: 50%; @@ -610,7 +607,6 @@ function renderLegend(measured) { el("span", { class: "direct" }, "direct"), el("span", { class: "relayed" }, "relayed"), el("span", { class: "dormant" }, "dormant or down"), - el("span", { class: "eager" }, "eager (changes sent on at once, this way)"), el("span", { class: "silent" }, "an end reports no links")); document.getElementById("legend").replaceChildren(...items); } @@ -641,18 +637,6 @@ function edges() { } } } - // Eager, which way, if either end says so: "a>b" where a sends b its changes as it - // applies them (a's eagerTo, or b's eagerFrom). - const eager = new Set(); - for (const [a, report] of Object.entries(state.graph.measured)) { - for (const link of report.links) { - if (link.eagerTo) eager.add(a + ">" + link.peer); - if (link.eagerFrom) eager.add(link.peer + ">" + a); - } - } - for (const edge of measured.values()) { - edge.eager = [eager.has(edge.a + ">" + edge.b), eager.has(edge.b + ">" + edge.a)]; - } // Dormant, or down, if either end says so, whichever report is drawn. for (const edge of measured.values()) { if ((edge.dormant && !edge.link.dormant) || (edge.down && !edge.link.down)) { @@ -970,7 +954,7 @@ function renderGraph() { tooltip(hit(key, p, q, 1), name(a) + " – " + name(b) + ": intended (member list), not measured"); } const ms = rtt => rtt < 10 ? rtt.toFixed(1) : String(Math.round(rtt)); - for (const [key, { a, b, link, secsAgo, eager }] of measured) { + for (const [key, { a, b, link, secsAgo }] of measured) { const p = positions.get(a), q = positions.get(b); if (!p || !q) continue; // The transport in use thick, in the middle; the others thin, beside it. @@ -1020,8 +1004,6 @@ function renderGraph() { (line.transport ? " via " + line.transport : "") + (line.used ? " (in use)" : "") + ((line.used ? link.relayed : line.relayed) ? ", relayed" : "") + (link.dormant ? ", dormant" : "") + (line.used && link.down ? ", down" : "") + - (line.used && eager[0] ? ", eager " + name(a) + " → " + name(b) : "") + - (line.used && eager[1] ? ", eager " + name(b) + " → " + name(a) : "") + (silent ? ", one end reports no links" : "") + (typeof line.rttMs === "number" ? ", " + line.rttMs.toFixed(1) + " ms" : "") + ", measured " + age(secsAgo + elapsed()) + " ago"; @@ -1045,22 +1027,6 @@ function renderGraph() { } }); children.push(...drawnLines.reverse()); - // Eager, each way it is: a chevron on the line in use pointing that way, past the - // middle towards the end it goes to (both ways: one each side of it). - const ux = (q.x - p.x) / length, uy = (q.y - p.y) / length; - [[eager[0], 1], [eager[1], -1]].forEach(([on, way]) => { - if (!on) return; - const t = eager[0] && eager[1] ? .5 + way * .06 : .5; - const mx = p.x + (q.x - p.x) * t, my = p.y + (q.y - p.y) * t; - const dx = ux * way * 5, dy = uy * way * 5; - const d = "M " + (mx - dx + nx * 5) + " " + (my - dy + ny * 5) + " L " + (mx + dx) + - " " + (my + dy) + " L " + (mx - dx - nx * 5) + " " + (my - dy - ny * 5); - const shape = { d, fill: "none", "stroke-linecap": "round", "stroke-linejoin": "round" }; - children.push(drawing("eager under " + key + " " + way, "path", - { ...shape, stroke: "var(--panel)", "stroke-width": 5 })); - children.push(drawing("eager " + key + " " + way, "path", - { ...shape, stroke: colourOf(link.transport), "stroke-width": 2 })); - }); tooltip(covering, descriptions.join("\n")); } // Above every line, so none crosses them. diff --git a/src/api/dashboard/mod.rs b/src/api/dashboard/mod.rs index 14464d4..8d954c0 100644 --- a/src/api/dashboard/mod.rs +++ b/src/api/dashboard/mod.rs @@ -407,8 +407,6 @@ fn links_json(links: &[Link]) -> JsonValue { "down": link.down, "rttMs": link.rtt_us.map(|us| f64::from(us) / 1000.0), "dormant": link.dormant, - "eagerTo": link.eager_to, - "eagerFrom": link.eager_from, "clock": link.clock, "others": link.others.iter().map(|other| json!({ "transport": other.transport, diff --git a/src/api/stats.rs b/src/api/stats.rs index 9ac2c94..96e8ad3 100644 --- a/src/api/stats.rs +++ b/src/api/stats.rs @@ -140,11 +140,8 @@ struct RelayStats { pulls: u64, /// Announcements of heads we lacked that waited for the pull in progress. pulls_queued: u64, - /// Links made eager, and lazy again (`swarm::relay`). - grafts: u64, - prunes: u64, - /// Changes forwarded over eager links, per neighbour. - eager_forwards: u64, + /// Changes passed on along writers' trees, per child (`swarm::tree`). + tree_forwards: u64, /// Blob requests not answered: too many were being answered. blob_requests_dropped: u64, } @@ -345,9 +342,7 @@ pub(crate) async fn collect(state: &AppState, list: &PeerListResponse) -> StatsR announce_rounds: node.relay.announce_rounds, pulls: node.relay.pulls, pulls_queued: node.relay.pulls_queued, - grafts: node.relay.grafts, - prunes: node.relay.prunes, - eager_forwards: node.relay.eager_forwards, + tree_forwards: node.relay.tree_forwards, blob_requests_dropped: node.blob_requests_dropped, }, topology: TopologyStats { diff --git a/src/api/stats/prometheus.rs b/src/api/stats/prometheus.rs index 3d4bcc6..03643ee 100644 --- a/src/api/stats/prometheus.rs +++ b/src/api/stats/prometheus.rs @@ -651,22 +651,10 @@ pub(super) fn render(stats: &StatsResponse, list: &PeerListResponse) -> String { relay.pulls_queued as f64, ); out.single( - "grafts_total", + "tree_forwards_total", "counter", - "Links made eager: a pull brought changes over them.", - relay.grafts as f64, - ); - out.single( - "prunes_total", - "counter", - "Links made lazy again: changes came over them that another path brought first.", - relay.prunes as f64, - ); - out.single( - "eager_forwards_total", - "counter", - "Changes forwarded over eager links, per neighbour.", - relay.eager_forwards as f64, + "Changes passed on along writers' trees, per child.", + relay.tree_forwards as f64, ); out.single( "blob_requests_dropped_total", -- cgit v1.3.1