Line data Source code
1 : use clap::Parser;
2 : use utils::logging;
3 :
4 : /// Re-usable pieces of code that aren't CLI-specific.
5 : mod util {
6 : pub(crate) mod connstring;
7 : pub(crate) mod request_stats;
8 : #[macro_use]
9 : pub(crate) mod tokio_thread_local_stats;
10 : /// Re-usable pieces of CLI-specific code.
11 : pub(crate) mod cli {
12 : pub(crate) mod targets;
13 : }
14 : }
15 :
16 : /// The pagebench CLI sub-commands, dispatched in [`main`] below.
17 : mod cmd {
18 : pub(super) mod basebackup;
19 : pub(super) mod getpage_latest_lsn;
20 : pub(super) mod trigger_initial_size_calculation;
21 : }
22 :
23 : /// Component-level performance test for pageserver.
24 0 : #[derive(clap::Parser)]
25 : enum Args {
26 : Basebackup(cmd::basebackup::Args),
27 : GetPageLatestLsn(cmd::getpage_latest_lsn::Args),
28 : TriggerInitialSizeCalculation(cmd::trigger_initial_size_calculation::Args),
29 : }
30 :
31 0 : fn main() {
32 0 : logging::init(
33 0 : logging::LogFormat::Plain,
34 0 : logging::TracingErrorLayerEnablement::Disabled,
35 0 : logging::Output::Stderr,
36 0 : )
37 0 : .unwrap();
38 0 : logging::replace_panic_hook_with_tracing_panic_hook().forget();
39 0 :
40 0 : let args = Args::parse();
41 0 : match args {
42 0 : Args::Basebackup(args) => cmd::basebackup::main(args),
43 0 : Args::GetPageLatestLsn(args) => cmd::getpage_latest_lsn::main(args),
44 0 : Args::TriggerInitialSizeCalculation(args) => {
45 0 : cmd::trigger_initial_size_calculation::main(args)
46 : }
47 : }
48 0 : .unwrap()
49 0 : }
|