mod error;
mod run;
mod server;
use clap::{Args, Parser, Subcommand};
#[cfg(feature = "mimalloc")]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
#[cfg(feature = "rpmalloc")]
#[global_allocator]
static GLOBAL: rpmalloc::RpMalloc = rpmalloc::RpMalloc;
#[cfg(feature = "snmalloc")]
#[global_allocator]
static GLOBAL: snmalloc_rs::SnMalloc = snmalloc_rs::SnMalloc;
#[cfg(feature = "tikv-jemallocator")]
#[global_allocator]
static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
type Result<T, E = error::Error> = std::result::Result<T, E>;
#[derive(Parser)]
#[clap(author, version, about, arg_required_else_help = true)]
#[command(args_conflicts_with_subcommands = true)]
struct Opt {
#[clap(subcommand)]
commands: Commands,
}
#[derive(Subcommand)]
pub enum Commands {
Run(Bootstrap),
}
#[derive(Args, Clone)]
pub struct Bootstrap {
#[clap(short, long, default_value = "configs")]
conf: String,
}
fn main() -> Result<(), Box<dyn std::error::Error>> {
let opt = Opt::parse();
match opt.commands {
Commands::Run(args) => run::run(args)?,
};
Ok(())
}