diff options
| author | tv <tv@krebsco.de> | 2026-11-16 19:54:35 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-16 21:26:18 +0100 |
| commit | c9707297bd393f69461c781a38a5ddb017dced60 (patch) | |
| tree | bd4bf940103b7f6bc583ef13ba27c9b4eec76c7a /src/node.rs | |
| parent | 3ee3816076d07b0e9b2c56cc7ea6e50951745027 (diff) | |
federation: the store read from the document
A node of a swarm holding a store holds the store, read from its document
(`docs/store.md`, What the store takes from the document): `federation::held`. Whenever
the document changes, a worker reads the events it holds that the store wasn't offered
from it, under the document's lock, and offers them to the store without it, each taken
as from anywhere: once its dependencies are held, judged at its history. Another
document (a drop, a rejoin) is read as it comes, the store going on.
The node reads its store anew from its document whenever it starts, from the root, by
what is its own of it: the events it refused by what it took before, and those its
operator had it drop, which it keeps in a file (`--store-file`), written whenever that
changes, so that a store read anew in another order refuses what it refused before. A
file that doesn't read stops the node from starting; without one, a restart may take
what it refused.
Diffstat (limited to 'src/node.rs')
| -rw-r--r-- | src/node.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/node.rs b/src/node.rs index f722112..4e19da5 100644 --- a/src/node.rs +++ b/src/node.rs @@ -89,6 +89,9 @@ pub(crate) struct NodeConfig { /// `--store-id`). #[cfg(feature = "federation")] pub(crate) store: Option<crate::federation::store::Id>, + /// The store it holds, and the file it keeps its own of it in (`--store-file`). + #[cfg(feature = "federation")] + pub(crate) holding: crate::federation::held::Holding, /// `--strict-keys`. pub(crate) strict_keys: Vec<crate::access::sshsig::PublicKey>, /// `--cors-origins`. @@ -206,6 +209,8 @@ impl Node { )), roots: Default::default(), genesis_root: config.genesis_root, + #[cfg(feature = "federation")] + holding: Arc::new(config.holding), challenges: Default::default(), ended_sessions: Default::default(), session_ended: Default::default(), @@ -296,6 +301,12 @@ impl Node { tokio::spawn(swarm::topology::run_worker(state.clone())); trace!("Topology worker task spawned"); + #[cfg(feature = "federation")] + { + tokio::spawn(crate::federation::held::run_worker(state.clone())); + trace!("Store worker task spawned"); + } + state } } |
