aboutsummaryrefslogtreecommitdiff
path: root/src/garage/cli.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2021-04-05 19:55:53 +0200
committerAlex Auvolat <alex@adnab.me>2021-04-27 16:37:08 +0200
commit9ced9f78dcc3894b3c2f13b8a95653f990278f03 (patch)
tree00b5180edcfab392eef203f594edb1332ccfce5d /src/garage/cli.rs
parent3a449badb125b4f5bf0497639745a583bc949da2 (diff)
downloadgarage-9ced9f78dcc3894b3c2f13b8a95653f990278f03.tar.gz
garage-9ced9f78dcc3894b3c2f13b8a95653f990278f03.zip
Improve bootstraping: do it regularly; persist peer list
Diffstat (limited to 'src/garage/cli.rs')
-rw-r--r--src/garage/cli.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/garage/cli.rs b/src/garage/cli.rs
index 886cf384..eb8275a9 100644
--- a/src/garage/cli.rs
+++ b/src/garage/cli.rs
@@ -5,8 +5,8 @@ use std::path::PathBuf;
use serde::{Deserialize, Serialize};
use structopt::StructOpt;
-use garage_util::error::Error;
use garage_util::data::UUID;
+use garage_util::error::Error;
use garage_util::time::*;
use garage_rpc::membership::*;
@@ -384,7 +384,10 @@ pub async fn cmd_status(
Ok(())
}
-pub fn find_matching_node(cand: impl std::iter::Iterator<Item=UUID>, pattern: &str) -> Result<UUID, Error> {
+pub fn find_matching_node(
+ cand: impl std::iter::Iterator<Item = UUID>,
+ pattern: &str,
+) -> Result<UUID, Error> {
let mut candidates = vec![];
for c in cand {
if hex::encode(&c).starts_with(&pattern) {
@@ -428,7 +431,10 @@ pub async fn cmd_configure(
for replaced in args.replace.iter() {
let replaced_node = find_matching_node(config.members.keys().cloned(), replaced)?;
if config.members.remove(&replaced_node).is_none() {
- return Err(Error::Message(format!("Cannot replace node {:?} as it is not in current configuration", replaced_node)));
+ return Err(Error::Message(format!(
+ "Cannot replace node {:?} as it is not in current configuration",
+ replaced_node
+ )));
}
}