Librarify common etcd timeline logic

This commit is contained in:
Kirill Bulatov
2022-05-04 18:28:46 +03:00
committed by Kirill Bulatov
parent dd6dca9072
commit d4e155aaa3
15 changed files with 633 additions and 147 deletions

View File

@@ -63,6 +63,10 @@ pub struct LocalEnv {
#[serde(default)]
pub broker_endpoints: Option<String>,
/// A prefix to all to any key when pushing/polling etcd from a node.
#[serde(default)]
pub broker_etcd_prefix: Option<String>,
pub pageserver: PageServerConf,
#[serde(default)]

View File

@@ -77,6 +77,7 @@ pub struct SafekeeperNode {
pub pageserver: Arc<PageServerNode>,
broker_endpoints: Option<String>,
broker_etcd_prefix: Option<String>,
}
impl SafekeeperNode {
@@ -94,6 +95,7 @@ impl SafekeeperNode {
http_base_url: format!("http://127.0.0.1:{}/v1", conf.http_port),
pageserver,
broker_endpoints: env.broker_endpoints.clone(),
broker_etcd_prefix: env.broker_etcd_prefix.clone(),
}
}
@@ -143,6 +145,9 @@ impl SafekeeperNode {
if let Some(ref ep) = self.broker_endpoints {
cmd.args(&["--broker-endpoints", ep]);
}
if let Some(prefix) = self.broker_etcd_prefix.as_deref() {
cmd.args(&["--broker-etcd-prefix", prefix]);
}
if !cmd.status()?.success() {
bail!(