aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-17 16:21:09 +0000
committertv <tv@krebsco.de>2026-11-17 17:36:16 +0100
commit1bbb45bfe7c9c437373aefa08a6a985bc260f520 (patch)
tree5c17d68c431de24e123d32abb71c9b27377708db /src
parent7fc844ff0167fb0943e3fa85af671d8f3bbf005d (diff)
events: the store's summary names the node's party, and whether it votes for it
`GET /events` names the party the node is of (`party`, `--store-party`) and whether it votes for it by itself (`votesByItself`, `--store-vote-key`), and so casts a vote by hand (`POST /admin/events/vote`): what a page offering votes through the node asks.
Diffstat (limited to 'src')
-rw-r--r--src/api/events.rs8
-rw-r--r--src/federation/held.rs5
2 files changed, 11 insertions, 2 deletions
diff --git a/src/api/events.rs b/src/api/events.rs
index b388acc..3017c25 100644
--- a/src/api/events.rs
+++ b/src/api/events.rs
@@ -77,15 +77,19 @@ fn why(refusal: &Refusal) -> String {
}
}
-/// `GET /events`: the store's ID, its checkpoint's, its heads, and how many events it
-/// took after its checkpoint.
+/// `GET /events`: the store's ID, its checkpoint's, its heads, how many events it took
+/// after its checkpoint, the node's party, and whether the node votes for it by itself.
async fn summary(State(state): State<AppState>) -> Response {
+ let party = state.holding.party().map(str::to_owned);
+ let votes = state.holding.votes_by_itself();
with_store(&state, |store| {
json!({
"store": store.id().to_string(),
"checkpoint": Id::of(store.checkpoint()).to_string(),
"heads": ids(store.heads()),
"taken": store.taken().len(),
+ "party": party,
+ "votesByItself": votes,
})
})
}
diff --git a/src/federation/held.rs b/src/federation/held.rs
index 985ff45..3ca74a9 100644
--- a/src/federation/held.rs
+++ b/src/federation/held.rs
@@ -783,6 +783,11 @@ impl Holding {
self.party.as_deref()
}
+ /// Whether the node votes for its party by itself (`--store-vote-key`).
+ pub(crate) fn votes_by_itself(&self) -> bool {
+ self.voter.is_some() && self.party.is_some()
+ }
+
/// Itself, the node keeping some of its neighbours among the members of `parties`,
/// with those of its own (`--store-neighbour-parties`).
pub(crate) fn near(self, parties: Vec<String>) -> Self {