diff options
| author | tv <tv@krebsco.de> | 2026-11-16 16:23:51 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-16 18:01:39 +0100 |
| commit | 169b6b0e573ecc2a3f8e5f78d54f2e5c484a1373 (patch) | |
| tree | 3391f9ee71d7ebe705c82c3f71f9878c8218a806 /src/federation/store/testfold.rs | |
| parent | 11244e60fbcef6b154c7b657ce2c50d56277bf7b (diff) | |
store: moving to a checkpoint, and starting from a pinned one
Once the fold names heads of a later checkpoint (events after the store's, none in
another's history), the store builds the checkpoint at them, keeps what the fold keeps,
forgets what came before them, and refuses every event not above them, with what waits
on such an event. What it forgot is held as accounted for: brought again, it is held,
and an event built on it isn't above the heads. A store starts from a checkpoint its
operator pins, its events building on the heads the checkpoint was built at.
A node starting from a checkpoint must judge the event that named it as every node
does; the fold for the tests counts the heads of the checkpoint a state starts from as
after the checkpoint current at them, so that it does.
Diffstat (limited to 'src/federation/store/testfold.rs')
| -rw-r--r-- | src/federation/store/testfold.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/federation/store/testfold.rs b/src/federation/store/testfold.rs index 4b7e1b2..68397e7 100644 --- a/src/federation/store/testfold.rs +++ b/src/federation/store/testfold.rs @@ -176,7 +176,12 @@ impl State { /// Whether `heads` may be a checkpoint's here, and the state is above them. fn above(&self, heads: &[Id]) -> bool { - let after = |id: &Id| self.graph.contains_key(id) && !self.before.contains(id); + // The heads of the checkpoint the state starts from count as after the checkpoint + // current at them, so that a node starting from it judges the cut naming it as + // every node does. + let after = |id: &Id| { + (self.graph.contains_key(id) && !self.before.contains(id)) || self.at.contains(id) + }; if heads.is_empty() || !heads.iter().all(after) { return false; } |
