aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-04-18 19:21:34 +0200
committerAlex Auvolat <alex@adnab.me>2020-04-18 19:21:34 +0200
commitf41583e1b731574b4bb13a20d4b3fd9fe3a899f5 (patch)
treea2c1d32284fa0dc30fdf5408afad8255d50e51f6 /src/main.rs
parent3f40ef149f6dd4d61ceb326b5691e186aec178c3 (diff)
downloadgarage-f41583e1b731574b4bb13a20d4b3fd9fe3a899f5.tar.gz
garage-f41583e1b731574b4bb13a20d4b3fd9fe3a899f5.zip
Massive RPC refactoring
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs
index ebf97a29..84b8c2bc 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -22,12 +22,14 @@ mod tls_util;
use std::collections::HashSet;
use std::net::SocketAddr;
use std::path::PathBuf;
+use std::sync::Arc;
use structopt::StructOpt;
use data::*;
use error::Error;
+use membership::Message;
use proto::*;
-use rpc_client::RpcClient;
+use rpc_client::*;
use server::TlsConfig;
#[derive(StructOpt, Debug)]
@@ -113,7 +115,9 @@ async fn main() {
}
};
- let rpc_cli = RpcClient::new(&tls_config).expect("Could not create RPC client");
+ let rpc_http_cli =
+ Arc::new(RpcHttpClient::new(&tls_config).expect("Could not create RPC client"));
+ let rpc_cli = RpcAddrClient::new(rpc_http_cli, "_membership".into());
let resp = match opt.cmd {
Command::Server(server_opt) => {
@@ -137,7 +141,7 @@ async fn main() {
}
}
-async fn cmd_status(rpc_cli: RpcClient, rpc_host: SocketAddr) -> Result<(), Error> {
+async fn cmd_status(rpc_cli: RpcAddrClient<Message>, rpc_host: SocketAddr) -> Result<(), Error> {
let status = match rpc_cli
.call(&rpc_host, &Message::PullStatus, DEFAULT_TIMEOUT)
.await?
@@ -196,7 +200,7 @@ async fn cmd_status(rpc_cli: RpcClient, rpc_host: SocketAddr) -> Result<(), Erro
}
async fn cmd_configure(
- rpc_cli: RpcClient,
+ rpc_cli: RpcAddrClient<Message>,
rpc_host: SocketAddr,
args: ConfigureOpt,
) -> Result<(), Error> {
@@ -249,7 +253,7 @@ async fn cmd_configure(
}
async fn cmd_remove(
- rpc_cli: RpcClient,
+ rpc_cli: RpcAddrClient<Message>,
rpc_host: SocketAddr,
args: RemoveOpt,
) -> Result<(), Error> {