diff options
author | Alex Auvolat <alex@adnab.me> | 2020-04-07 17:00:48 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2020-04-07 17:00:48 +0200 |
commit | 82b7fcd280d416aabc4f94a99a17c8d9e99888be (patch) | |
tree | 4e73d838472e382919bbc1e2fa8a85ef80527851 /src/main.rs | |
parent | 061e676136613dce3ffd40c515aa58f99bda30d8 (diff) | |
download | garage-82b7fcd280d416aabc4f94a99a17c8d9e99888be.tar.gz garage-82b7fcd280d416aabc4f94a99a17c8d9e99888be.zip |
Config management & ring
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs index 922e873e..2cb4b720 100644 --- a/src/main.rs +++ b/src/main.rs @@ -55,6 +55,9 @@ pub struct ConfigureOpt { /// Node to configure (prefix of hexadecimal node id) node_id: String, + /// Location (datacenter) of the node + datacenter: String, + /// Number of tokens n_tokens: u32, } @@ -100,7 +103,7 @@ async fn cmd_status(rpc_cli: RpcClient, rpc_host: SocketAddr) -> Result<(), Erro println!("Healthy nodes:"); for adv in status.iter() { if let Some(cfg) = config.members.get(&adv.id) { - println!("{}\t{}\t{}\t{}", hex::encode(adv.id), adv.addr, adv.datacenter, cfg.n_tokens); + println!("{}\t{}\t{}\t{}", hex::encode(adv.id), cfg.datacenter, cfg.n_tokens, adv.addr); } } @@ -109,7 +112,7 @@ async fn cmd_status(rpc_cli: RpcClient, rpc_host: SocketAddr) -> Result<(), Erro println!("\nFailed nodes:"); for (id, cfg) in config.members.iter() { if !status.iter().any(|x| x.id == *id) { - println!("{}\t{}", hex::encode(id), cfg.n_tokens); + println!("{}\t{}\t{}", hex::encode(id), cfg.datacenter, cfg.n_tokens); } } } @@ -118,7 +121,7 @@ async fn cmd_status(rpc_cli: RpcClient, rpc_host: SocketAddr) -> Result<(), Erro println!("\nUnconfigured nodes:"); for adv in status.iter() { if !config.members.contains_key(&adv.id) { - println!("{}\t{}\t{}", hex::encode(adv.id), adv.addr, adv.datacenter); + println!("{}\t{}", hex::encode(adv.id), adv.addr); } } } @@ -153,6 +156,7 @@ async fn cmd_configure(rpc_cli: RpcClient, rpc_host: SocketAddr, args: Configure config.members.insert(candidates[0].clone(), NetworkConfigEntry{ + datacenter: args.datacenter, n_tokens: args.n_tokens, }); config.version += 1; |