Add --sled flag to use deprecated sled db

This commit is contained in:
rishflab 2021-09-27 11:13:08 +10:00
parent 0f7876c107
commit 05a28dc37a
5 changed files with 93 additions and 2 deletions

View file

@ -33,6 +33,7 @@ pub struct Arguments {
pub env_config: env::Config,
pub debug: bool,
pub json: bool,
pub sled: bool,
pub data_dir: PathBuf,
pub cmd: Command,
}
@ -66,6 +67,7 @@ where
let debug = args.debug;
let json = args.json;
let sled = args.sled;
let is_testnet = args.testnet;
let data = args.data;
@ -90,6 +92,7 @@ where
env_config: env_config_from(is_testnet),
debug,
json,
sled,
data_dir: data::data_dir_from(data, is_testnet)?,
cmd: Command::BuyXmr {
seller,
@ -106,6 +109,7 @@ where
env_config: env_config_from(is_testnet),
debug,
json,
sled,
data_dir: data::data_dir_from(data, is_testnet)?,
cmd: Command::History,
},
@ -117,6 +121,7 @@ where
env_config: env_config_from(is_testnet),
debug,
json,
sled,
data_dir: data::data_dir_from(data, is_testnet)?,
cmd: Command::Balance {
bitcoin_electrum_rpc_url,
@ -136,6 +141,7 @@ where
env_config: env_config_from(is_testnet),
debug,
json,
sled,
data_dir: data::data_dir_from(data, is_testnet)?,
cmd: Command::WithdrawBtc {
bitcoin_electrum_rpc_url,
@ -159,6 +165,7 @@ where
env_config: env_config_from(is_testnet),
debug,
json,
sled,
data_dir: data::data_dir_from(data, is_testnet)?,
cmd: Command::Resume {
swap_id,
@ -180,6 +187,7 @@ where
env_config: env_config_from(is_testnet),
debug,
json,
sled,
data_dir: data::data_dir_from(data, is_testnet)?,
cmd: Command::Cancel {
swap_id,
@ -199,6 +207,7 @@ where
env_config: env_config_from(is_testnet),
debug,
json,
sled,
data_dir: data::data_dir_from(data, is_testnet)?,
cmd: Command::Refund {
swap_id,
@ -214,6 +223,7 @@ where
env_config: env_config_from(is_testnet),
debug,
json,
sled,
data_dir: data::data_dir_from(data, is_testnet)?,
cmd: Command::ListSellers {
rendezvous_point,
@ -304,6 +314,13 @@ struct RawArguments {
)]
json: bool,
#[structopt(
short,
long = "sled",
help = "Forces the swap-cli to use the deprecated sled db if it is available"
)]
sled: bool,
#[structopt(subcommand)]
cmd: RawCommand,
}
@ -1105,6 +1122,7 @@ mod tests {
env_config: env::Testnet::get_config(),
debug: false,
json: false,
sled: false,
data_dir: data_dir_path_cli().join(TESTNET),
cmd: Command::BuyXmr {
seller: Multiaddr::from_str(MULTI_ADDRESS).unwrap(),
@ -1125,6 +1143,7 @@ mod tests {
env_config: env::Mainnet::get_config(),
debug: false,
json: false,
sled: false,
data_dir: data_dir_path_cli().join(MAINNET),
cmd: Command::BuyXmr {
seller: Multiaddr::from_str(MULTI_ADDRESS).unwrap(),
@ -1144,6 +1163,7 @@ mod tests {
env_config: env::Testnet::get_config(),
debug: false,
json: false,
sled: false,
data_dir: data_dir_path_cli().join(TESTNET),
cmd: Command::Resume {
swap_id: Uuid::from_str(SWAP_ID).unwrap(),
@ -1161,6 +1181,7 @@ mod tests {
env_config: env::Mainnet::get_config(),
debug: false,
json: false,
sled: false,
data_dir: data_dir_path_cli().join(MAINNET),
cmd: Command::Resume {
swap_id: Uuid::from_str(SWAP_ID).unwrap(),
@ -1177,6 +1198,7 @@ mod tests {
env_config: env::Testnet::get_config(),
debug: false,
json: false,
sled: false,
data_dir: data_dir_path_cli().join(TESTNET),
cmd: Command::Cancel {
swap_id: Uuid::from_str(SWAP_ID).unwrap(),
@ -1192,6 +1214,7 @@ mod tests {
env_config: env::Mainnet::get_config(),
debug: false,
json: false,
sled: false,
data_dir: data_dir_path_cli().join(MAINNET),
cmd: Command::Cancel {
swap_id: Uuid::from_str(SWAP_ID).unwrap(),
@ -1206,6 +1229,7 @@ mod tests {
env_config: env::Testnet::get_config(),
debug: false,
json: false,
sled: false,
data_dir: data_dir_path_cli().join(TESTNET),
cmd: Command::Refund {
swap_id: Uuid::from_str(SWAP_ID).unwrap(),
@ -1221,6 +1245,7 @@ mod tests {
env_config: env::Mainnet::get_config(),
debug: false,
json: false,
sled: false,
data_dir: data_dir_path_cli().join(MAINNET),
cmd: Command::Refund {
swap_id: Uuid::from_str(SWAP_ID).unwrap(),