use crate::arg_enums::Database;
use structopt::StructOpt;
use tc_service::TransactionStorageMode;
#[derive(Debug, StructOpt)]
pub struct DatabaseParams {
#[structopt(
long,
alias = "db",
value_name = "DB",
case_insensitive = true,
)]
pub database: Option<Database>,
#[structopt(long = "db-cache", value_name = "MiB")]
pub database_cache_size: Option<usize>,
#[structopt(long)]
pub storage_chain: bool,
}
impl DatabaseParams {
pub fn database(&self) -> Option<Database> {
self.database
}
pub fn database_cache_size(&self) -> Option<usize> {
self.database_cache_size
}
pub fn transaction_storage(&self) -> TransactionStorageMode {
if self.storage_chain {
TransactionStorageMode::StorageChain
} else {
TransactionStorageMode::BlockBody
}
}
}