From 1656f73b41a3528048c33774457b0d68ed430934 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 25 Nov 2026 13:03:52 +0000 Subject: store: a new event builds on a head holding what it is judged by A new event builds on the heads taken earliest, 64 at most. Where a store holds more, and those all come from before the current version was written, an event on them is written under the version before: a merge event, under one without merge events, was refused, so the backlog of heads a revision was passed to merge stayed, and with more heads than a checkpoint may name, no node proposed one. The fold now says which events a new one is to have in its history (Fold::judged_by; the federation: those writing the current version), and building_on names the earliest head holding one, in place of the last of the others. --- src/federation/fold.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/federation/fold.rs') diff --git a/src/federation/fold.rs b/src/federation/fold.rs index b590f07..a527a74 100644 --- a/src/federation/fold.rs +++ b/src/federation/fold.rs @@ -877,6 +877,16 @@ impl Fold for Federation { (heads.iter().copied().collect::>() != now.at).then_some(heads) } + /// The events writing the current version: an event without one in its history is + /// written under a version before, by its keys, lists and revision. None where the + /// checkpoint's version is current, which every history holds. + fn judged_by(now: &State) -> Vec { + now.writing + .get(&now.current().hash) + .map(|events| events.iter().copied().collect()) + .unwrap_or_default() + } + fn members(state: &State) -> Vec<(String, String)> { state.members() } -- cgit v1.3.1