aboutsummaryrefslogtreecommitdiffstats
path: root/src/remake/delta.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-17 04:10:55 +0000
committertv <tv@krebsco.de>2026-11-17 05:33:11 +0100
commit171f1fcabcdb62b93696f5028120e9d5390b118a (patch)
treef934a5d25ff7fda8417545db999540b02bb486fa /src/remake/delta.rs
parentb88b3abffceb3f91bb5bee08d9b1889a41e7b852 (diff)
remake: holding a store, a node puts again what the document it left holds
After a switch or a rejoin, a node of a swarm holding a store puts again what the document it left holds that a store starting at the new document's checkpoint takes, by its own refusals and drops, and the new one lacks (`docs/store.md`, Remakes, `Holding::left`): what it held beyond the base, and, where it moved to a later checkpoint since, what a store starting at the snapshot's takes to reach it. Its events aren't replayed into the new document, so none nobody takes go along.
Diffstat (limited to 'src/remake/delta.rs')
-rw-r--r--src/remake/delta.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/remake/delta.rs b/src/remake/delta.rs
index c3688cb..7543549 100644
--- a/src/remake/delta.rs
+++ b/src/remake/delta.rs
@@ -123,6 +123,15 @@ pub(crate) fn replay_newest(
// Under a strict policy, the other writes go with the links by history too: one may
// build on what a link grants (a capability, a key).
let strict = At::new(src, after).is_some_and(|now| crate::access::policy::of(&now).strict());
+ // Holding a store, its events aren't replayed: the node puts again those its store
+ // takes (`federation::held`, `Holding::left`).
+ #[cfg(feature = "federation")]
+ let holding = At::new(src, after).is_some_and(|now| {
+ matches!(
+ crate::access::policy::of(&now),
+ crate::access::policy::Policy::Store(_)
+ )
+ });
// Values their users signed, under a strict policy: replayed as chains, below.
let (signed, paths) = signed_places(
src,
@@ -200,6 +209,12 @@ pub(crate) fn replay_newest(
if user.is_none() && others_entry(&path, node) {
continue;
}
+ #[cfg(feature = "federation")]
+ if holding
+ && matches!(path.as_slice(), [root, events, ..] if root == meta::ROOT && events == meta::EVENTS)
+ {
+ continue;
+ }
match newest(&theirs, &path) {
Some((newer, _)) if newer > at => {
stats.superseded += 1;