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 request_stats;
7 : #[macro_use]
8 : pub(crate) mod tokio_thread_local_stats;
9 : /// Re-usable pieces of CLI-specific code.
10 : pub(crate) mod cli {
11 : pub(crate) mod targets;
12 : }
13 : }
14 :
15 : /// The pagebench CLI sub-commands, dispatched in [`main`] below.
16 : mod cmd {
17 : pub(super) mod basebackup;
18 : pub(super) mod getpage_latest_lsn;
19 : pub(super) mod ondemand_download_churn;
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 : OndemandDownloadChurn(cmd::ondemand_download_churn::Args),
30 : }
31 :
32 0 : fn main() {
33 0 : logging::init(
34 0 : logging::LogFormat::Plain,
35 0 : logging::TracingErrorLayerEnablement::Disabled,
36 0 : logging::Output::Stderr,
37 0 : )
38 0 : .unwrap();
39 0 : logging::replace_panic_hook_with_tracing_panic_hook().forget();
40 0 :
41 0 : let args = Args::parse();
42 0 : match args {
43 0 : Args::Basebackup(args) => cmd::basebackup::main(args),
44 0 : Args::GetPageLatestLsn(args) => cmd::getpage_latest_lsn::main(args),
45 0 : Args::TriggerInitialSizeCalculation(args) => {
46 0 : cmd::trigger_initial_size_calculation::main(args)
47 : }
48 0 : Args::OndemandDownloadChurn(args) => cmd::ondemand_download_churn::main(args),
49 : }
50 0 : .unwrap()
51 0 : }
|