summaryrefslogtreecommitdiffstats
path: root/src/config
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-25 12:55:27 +0100
committertv <tv@krebsco.de>2026-10-25 12:55:27 +0100
commitd6620dc266b593e9ed269bcb7e65d3d8c9710d27 (patch)
tree15d86e3fa2e0ef3b2cea6907c7b778a8ee6ed2b4 /src/config
parent9845a07960fa083db0b0c7e2312f98706e9684cb (diff)
add possibility to start with a document
The --recover-from option allows a node start with a given document.
Diffstat (limited to 'src/config')
-rw-r--r--src/config/mod.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/config/mod.rs b/src/config/mod.rs
index b4ea0aa..24791d3 100644
--- a/src/config/mod.rs
+++ b/src/config/mod.rs
@@ -110,6 +110,13 @@ pub(crate) const OPTIONS: &[OptionSpec] = &[
"Start a new swarm, as its genesis node, instead of joining one through seeds. Every start with it starts another new swarm: drop it once the swarm exists, and give the node seeds instead. With a --state-file that remembers a swarm, it starts that swarm again instead (empty; nodes of it still running merge with this one).",
),
option(
+ "recover-from",
+ Kind::Text,
+ "PATH",
+ None,
+ "Start the swarm again from a backup (as GET /admin/document saves it): this node loads it, on the swarm and epoch it names, and is ready at once; other nodes join it. Members of the swarm still running merge with it, or it rejoins them if they moved on to a newer epoch (the backup is then dropped).",
+ ),
+ option(
"state-file",
Kind::Text,
"PATH",
@@ -230,6 +237,7 @@ pub(crate) struct Settings {
#[serde(default)]
pub(crate) genesis: bool,
pub(crate) state_file: Option<PathBuf>,
+ pub(crate) recover_from: Option<PathBuf>,
pub(crate) swarm_key_file: Option<PathBuf>,
pub(crate) alias: Option<String>,
#[serde(default = "default_keepalive_secs")]
@@ -429,6 +437,8 @@ const CONFLICTS: &[(&[&str], &[&str])] = &[
),
// A new swarm has nobody to join.
(&["genesis"], &["seeds"]),
+ // Recovering starts the swarm too.
+ (&["recover-from"], &["genesis"]),
];
/// The options `name` can't be combined with.