diff options
| author | tv <tv@krebsco.de> | 2026-11-16 20:06:42 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-16 21:26:29 +0100 |
| commit | 9d18983e4b643eac04de49a42a6f29805570dba3 (patch) | |
| tree | 90bff68e2b2ec5e3bbbd3fee974c53ff44dcbe32 /src/config/mod.rs | |
| parent | d8cec1cd61c63659d583168244f8f51ec550b3be (diff) | |
federation: a pinned checkpoint, found in the document
Once a store moved to a checkpoint, a node reading it from the root could take what was
grown anew from the root since, by keys of versions long replaced: so its operator pins
the checkpoint (`--store-checkpoint`, by its ID), and the node reads its store from
there whenever it starts (`docs/store.md`, Pinned checkpoints). It finds it in its
document: at heads a proposal's version names, built from their history read from the
root, as any node builds the checkpoint it moves to (`Store::checkpoint_at`), the one
whose ID is pinned. Until the document holds it, the node holds no store, and says so
once.
Diffstat (limited to 'src/config/mod.rs')
| -rw-r--r-- | src/config/mod.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/config/mod.rs b/src/config/mod.rs index afd9c4e..e2557cd 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -224,6 +224,14 @@ pub(crate) const OPTIONS: &[OptionSpec] = &[ None, "With store-root or store-id: where the node keeps what is its own of its store across restarts, written whenever it changes: the events it refused by what it took before (of two versions changing one, the second), and those its operator had it drop. It reads its store anew from its document whenever it starts: without the file, it may then take what it refused. A file that doesn't read stops the node from starting.", ), + #[cfg(feature = "federation")] + option( + "store-checkpoint", + Kind::Text, + "ID", + None, + "With store-root or store-id: a checkpoint of the store, by its ID (hex), from which the node reads its store whenever it starts, instead of from the root: once a store moved to a checkpoint, a node reading from the root could take what was grown anew from it since, by keys of versions long replaced (docs/federation.md, Checkpoints). The node finds it in its document, at heads a proposal names, built from their history as any node builds it; until then, it holds no store.", + ), option( "strict-keys", Kind::List, @@ -661,6 +669,8 @@ pub(crate) struct Settings { pub(crate) store_id: Option<String>, #[cfg(feature = "federation")] pub(crate) store_file: Option<PathBuf>, + #[cfg(feature = "federation")] + pub(crate) store_checkpoint: Option<String>, #[serde(default)] pub(crate) strict_keys: Vec<String>, @@ -1120,6 +1130,11 @@ impl Settings { { bail!("store-id: {id:?} isn't a store's ID (64 hex digits)"); } + if let Some(id) = &self.store_checkpoint + && crate::federation::store::Id::from_hex(id).is_none() + { + bail!("store-checkpoint: {id:?} isn't a checkpoint's ID (64 hex digits)"); + } let store = match (&self.store_root, &self.store_id) { (Some(_), Some(_)) => { bail!("store-root names the store's ID itself; unset store-id") @@ -1131,6 +1146,9 @@ impl Settings { "store-file keeps what is the node's own of a store: set store-root or store-id" ) } + (None, None) if self.store_checkpoint.is_some() => { + bail!("store-checkpoint pins a checkpoint of a store: set store-root or store-id") + } (None, None) => return Ok(()), }; let first_change = [ @@ -1186,6 +1204,8 @@ impl Settings { ("store-id", self.store_id.is_some()), #[cfg(feature = "federation")] ("store-file", self.store_file.is_some()), + #[cfg(feature = "federation")] + ("store-checkpoint", self.store_checkpoint.is_some()), ("alias", self.alias.is_some()), ("dashboard-url", self.dashboard_url.is_some()), ("debug-api", self.debug_api), |
