diff options
Diffstat (limited to 'src/remake')
| -rw-r--r-- | src/remake/catchup.rs | 11 | ||||
| -rw-r--r-- | src/remake/delta.rs | 15 | ||||
| -rw-r--r-- | src/remake/switch.rs | 11 |
3 files changed, 37 insertions, 0 deletions
diff --git a/src/remake/catchup.rs b/src/remake/catchup.rs index 35add67..e7184be 100644 --- a/src/remake/catchup.rs +++ b/src/remake/catchup.rs @@ -460,6 +460,17 @@ async fn finish<H: Host>(host: &H) { }) .await; let quarantine_id = quarantine::add(host, previous, target, &old, unplaced); + // Holding a store: what the old document holds that the new one's store takes goes + // again (`Holding::left`). + #[cfg(feature = "federation")] + let old = { + let holding = host.holding(); + host.read_doc(move |doc| { + holding.left(doc, &old); + old + }) + .await + }; // Unless the quarantine holds the document. if !old.get_heads().is_empty() && !quarantined_whole { 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; diff --git a/src/remake/switch.rs b/src/remake/switch.rs index 94956f6..657b0f5 100644 --- a/src/remake/switch.rs +++ b/src/remake/switch.rs @@ -297,6 +297,17 @@ async fn switch<H: Host>( &old, std::mem::take(&mut stats.quarantined), ); + // Holding a store: what the old document holds that the new one's store takes goes + // again (`Holding::left`). + #[cfg(feature = "federation")] + let old = { + let holding = host.holding(); + host.read_doc(move |doc| { + holding.left(doc, &old); + old + }) + .await + }; host.remake().archive( previous, old, |
