aboutsummaryrefslogtreecommitdiffstats
path: root/src/federation/store/memory.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-29 13:24:34 +0000
committertv <tv@krebsco.de>2026-11-29 13:24:34 +0000
commit61fb06c420d5e481badc8a9d3252b90cf9013746 (patch)
treed90578948fc7b581594621a13dae9be0cd3ad2f8 /src/federation/store/memory.rs
parent2d31675f5c2c3b3475be89558c55a8a6e604df49 (diff)
federation: passing a set of events on
What two nodes say to each other of their sets (store::passing), with nothing kept of a peer between messages: where a node stands, its store's checkpoint and heads and the fingerprint of all its names; ranges (document::ranges, whose messages serialize), where fingerprints differ; its heads, where they differ and the fingerprints don't; the names it lacks and would have; events and entries, no more than 1 MiB a message. What comes is offered to the store or put as an entry, and for what the store then waits on and doesn't hold (Store::lacks) the node asks in turn. Sets that wrote apart come to hold the same, over seeds; what a node refuses of its own reaches others through it. Used by nothing yet: no node carries a set.
Diffstat (limited to 'src/federation/store/memory.rs')
-rw-r--r--src/federation/store/memory.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/federation/store/memory.rs b/src/federation/store/memory.rs
index 781ba01..0243d03 100644
--- a/src/federation/store/memory.rs
+++ b/src/federation/store/memory.rs
@@ -256,6 +256,18 @@ impl<F: Fold> Store<F> {
|| self.holding_back.contains(id)
}
+ /// What events that wait build on and the store doesn't hold, nor has wait.
+ pub(crate) fn lacks(&self) -> Vec<Id> {
+ let mut lacks: Vec<Id> = self
+ .waits_for
+ .iter()
+ .filter(|(id, waiting)| !waiting.is_empty() && !self.waiting.contains_key(id))
+ .map(|(id, _)| *id)
+ .collect();
+ lacks.sort();
+ lacks
+ }
+
/// Whether an event waits for dependencies the store doesn't hold.
pub(crate) fn is_waiting(&self, id: &Id) -> bool {
self.waiting.contains_key(id)