aboutsummaryrefslogtreecommitdiffstats
path: root/src/api
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-19 20:58:40 +0000
committertv <tv@krebsco.de>2026-11-19 22:10:16 +0100
commit59cc0283117be6b4195afbe857d702e7f8ddba6e (patch)
treee16ca3aeddb1007eff6b5b289b95a9f562730199 /src/api
parent011560a72ca895d8b516983485cfc45c9984cd45 (diff)
continuum-party status: a key, a node, a party a line, nodes by their names
`status` said each party's keys and nodes in one line, separated by commas, nodes by their IDs alone. Now each goes on a line of its own, indented beneath its heading (party_lines): the keys the version names, which sign votes, proposals, the key set and node list; those of the key set as it counts, which sign writes, or `the same`; `--key`'s marked, and said where it is none of them; and the nodes, each with the name it gave itself (`--alias`) where it did, as the dashboard names nodes. The store and the version are a heading each too, the parties one a line. The names come from GET /events/counts, which gives each party's `names` now (by node ID, of the nodes that gave themselves one), so that a party's session, which reads no /peers, has them. Bash completion reads the parties from the new layout.
Diffstat (limited to 'src/api')
-rw-r--r--src/api/events.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/api/events.rs b/src/api/events.rs
index 06a6e31..81f1481 100644
--- a/src/api/events.rs
+++ b/src/api/events.rs
@@ -155,7 +155,8 @@ async fn event(State(state): State<AppState>, Path(id): Path<String>) -> Respons
}
/// `GET /events/counts`: what counts, as the store reads now: the current version, each
-/// party's keys and nodes, what each of those nodes says it speaks and knows (`knows`),
+/// party's keys and nodes, the names those nodes gave themselves (`names`, `--alias`), what
+/// each of them says it speaks and knows (`knows`),
/// the values at places, the members, and the proposals on the
/// current version, each with the events proposing it a vote may build on (`proposals`:
/// for a checkpoint, those above its heads), the votes on it, the parties
@@ -164,6 +165,7 @@ async fn event(State(state): State<AppState>, Path(id): Path<String>) -> Respons
/// (`client::backable`), and, for a checkpoint, what its parties signed that moving there
/// refuses (`beside`, `signed_beside`).
async fn counts(State(state): State<AppState>) -> Response {
+ let aliases = crate::swarm::members::aliases(&state.doc.read().await.doc);
with_store(&state, |store| {
let read = store.state();
let current = read.current();
@@ -176,11 +178,16 @@ async fn counts(State(state): State<AppState>) -> Response {
.iter()
.map(|node| (node.clone(), knows(&state, node)))
.collect();
+ let names: serde_json::Map<String, JsonValue> = nodes
+ .iter()
+ .filter_map(|node| Some((node.clone(), aliases.get(node)?.clone().into())))
+ .collect();
(
party.clone(),
json!({
"keys": read.keys_of(party, current),
"nodes": nodes,
+ "names": names,
"knows": knows,
}),
)