diff options
Diffstat (limited to 'src/config')
| -rw-r--r-- | src/config/mod.rs | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/config/mod.rs b/src/config/mod.rs index 5a723c7..7b17f5d 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -224,6 +224,14 @@ pub(crate) const OPTIONS: &[OptionSpec] = &[ ), #[cfg(feature = "federation")] option( + "store-both", + Kind::Flag, + "BOOL", + Some("false"), + "With store-document: hold the store in the Automerge document too, and sync with nodes of either kind, taking into each what the other holds: an event that comes by one goes on by the other, and the node's entry is in both. For moving a running swarm to sets of events node by node (docs/document.md, From an Automerge document to this): a node is started with it, on the document it has, and without it once no node it reaches holds the Automerge document alone. Without the set's file yet, the set begins from the store as the node reads it of its document.", + ), + #[cfg(feature = "federation")] + option( "store-keeps-forgotten", Kind::Duration, "DURATION", @@ -827,6 +835,9 @@ pub(crate) struct Settings { #[cfg(feature = "federation")] pub(crate) store_document: Option<PathBuf>, #[cfg(feature = "federation")] + #[serde(default)] + pub(crate) store_both: bool, + #[cfg(feature = "federation")] #[serde( default = "default_store_keeps_forgotten", with = "crate::units::duration_option" @@ -1361,6 +1372,7 @@ impl Settings { ("store-file", self.store_file.is_some()), ("store-checkpoint", self.store_checkpoint.is_some()), ("store-document", self.store_document.is_some()), + ("store-both", self.store_both), ("store-party", self.store_party.is_some()), ("store-readers", !self.store_readers.is_empty()), ( @@ -1384,9 +1396,14 @@ impl Settings { return Ok(()); } }; - if self.store_document.is_some() && self.store_file.is_some() { + if self.store_document.is_some() && self.store_file.is_some() && !self.store_both { bail!("store-document holds what store-file would: unset store-file"); } + if self.store_both && self.store_document.is_none() { + bail!( + "store-both: set store-document, the file of the set of events the node holds beside its Automerge document" + ); + } match &self.store_party { None => bail!( "{store}: set store-party, the party this node is of: in a swarm holding a store, nodes sync with the nodes its parties list, each as its party's" @@ -1516,6 +1533,8 @@ impl Settings { #[cfg(feature = "federation")] ("store-document", self.store_document.is_some()), #[cfg(feature = "federation")] + ("store-both", self.store_both), + #[cfg(feature = "federation")] ("store-party", self.store_party.is_some()), #[cfg(feature = "federation")] ("store-readers", !self.store_readers.is_empty()), |
