diff options
| author | tv <tv@krebsco.de> | 2026-11-30 19:36:56 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-30 19:36:56 +0000 |
| commit | 6a06bc4a955cdf2b5a183c9ff21e25c79a4e5d9f (patch) | |
| tree | 8ca41fca8d70f938e8444b0cceed880975c9797a /src/federation/store/memory.rs | |
| parent | 3bc200a2fdae7b928c68b4a1f8bfee9a919e8ff8 (diff) | |
federation: a stopped node on a set passes on what it holds back
A store that stopped at an event it can't judge holds back what comes
after, and its set gave none of it to others: what was put through such
a node reached nobody, and a restart lost it. The set now names what its
store holds back among what it gives, passes it on at once as it does
what it took, and keeps it in its file; once the store takes again, it
gives of it what the store took, or refused of its own.
Diffstat (limited to 'src/federation/store/memory.rs')
| -rw-r--r-- | src/federation/store/memory.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/federation/store/memory.rs b/src/federation/store/memory.rs index 8f099be..6f4ee5d 100644 --- a/src/federation/store/memory.rs +++ b/src/federation/store/memory.rs @@ -332,6 +332,14 @@ impl<F: Fold> Store<F> { .map(|(id, why)| (id, why.as_str(), self.held_back.len())) } + /// The events the store holds back, stopped, in the order offered: the one it stopped + /// at, and those offered since. None while it isn't stopped. + pub(crate) fn holds_back(&self) -> impl ExactSizeIterator<Item = (Id, &[u8])> { + self.held_back + .iter() + .map(|(id, event)| (*id, event.bytes.as_slice())) + } + /// What the store holds back, stopped (`Fold::stops`): the events offered since, and /// those waiting for events it doesn't hold, as it can't tell which will be taken; each /// after those of its dependencies among them, by ID otherwise. Nothing while it isn't |
