aboutsummaryrefslogtreecommitdiffstats
path: root/src/config/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/config/mod.rs')
-rw-r--r--src/config/mod.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/config/mod.rs b/src/config/mod.rs
index 1b9a439..6f9bd98 100644
--- a/src/config/mod.rs
+++ b/src/config/mod.rs
@@ -504,6 +504,13 @@ pub(crate) const OPTIONS: &[OptionSpec] = &[
"Longest wait between HELLOs to a member that doesn't answer (dormant, or unanswered HELLOs): they start at 10 keepalives and double up to this. It bounds how long a returning member, or the other side of a partition, takes to be noticed. Default: 60 keepalives (1h at 1m). Shorter than 10 keepalives, it is every wait.",
),
option(
+ "worker-threads",
+ Kind::Integer,
+ "COUNT",
+ None,
+ "How many threads take the node's work in turns (at least 1): as many as the machine has cores unless given. What takes long (reading and saving the document, judging a store's events, a remake's snapshot) runs on threads of its own beside them, started as needed. Fewer wake less often on a node that is idle most of the time; set as the node starts, and changed only by a restart (docs/operations.md, Worker threads).",
+ ),
+ option(
"neighbours",
Kind::Integer,
"COUNT",
@@ -637,6 +644,13 @@ pub(crate) const OPTIONS: &[OptionSpec] = &[
"With the libp2p transport: find nodes on the LAN (multicast DNS, IPv4). Those that speak continuum are seeds while joining, so nodes on one LAN find each other without configured seeds; a swarm key keeps a new node from joining another swarm on the same LAN.",
),
option(
+ "libp2p-ping-interval",
+ Kind::Duration,
+ "DURATION",
+ Some("15s"),
+ "With the libp2p transport: how often each open connection is pinged, for its round trip: of several connections to one peer the fastest is kept, by the shortest round trip each measured. Every connection is pinged once as it opens, whatever this says; 0 leaves it at that. The pings keep no connection open and close none: continuum's own keepalives tell whether a peer answers. A longer interval, or none, spares a node that is idle most of the time the wakeups (docs/transports.md, Pings).",
+ ),
+ option(
"libp2p-upnp",
Kind::Flag,
"BOOL",
@@ -961,6 +975,8 @@ pub(crate) struct Settings {
serialize_with = "crate::units::serialize_optional_duration"
)]
pub(crate) dormant_probe_max: Option<Duration>,
+ #[serde(default)]
+ pub(crate) worker_threads: Option<usize>,
#[serde(default = "default_neighbours")]
pub(crate) neighbours: usize,
#[serde(
@@ -1012,6 +1028,12 @@ pub(crate) struct Settings {
#[serde(default)]
#[cfg_attr(not(feature = "libp2p"), allow(dead_code))]
pub(crate) libp2p_upnp: bool,
+ #[serde(
+ default = "default_libp2p_ping_interval",
+ with = "crate::units::duration_option"
+ )]
+ #[cfg_attr(not(feature = "libp2p"), allow(dead_code))]
+ pub(crate) libp2p_ping_interval: Duration,
#[serde(default)]
#[cfg_attr(not(feature = "libp2p"), allow(dead_code))]
pub(crate) libp2p_ignore: Vec<String>,
@@ -1099,6 +1121,9 @@ fn default_keepalive() -> Duration {
fn default_stream_heartbeat() -> Duration {
Duration::from_secs(30)
}
+fn default_libp2p_ping_interval() -> Duration {
+ Duration::from_secs(15)
+}
fn default_neighbours() -> usize {
12
}
@@ -1284,6 +1309,9 @@ impl Settings {
if self.debug_epoch.is_some() && !self.debug_api {
bail!("debug-epoch needs debug-api");
}
+ if self.worker_threads == Some(0) {
+ bail!("worker-threads must be at least 1");
+ }
if self.neighbours < 2 {
bail!("neighbours must be at least 2");
}