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 aux_files;
18 : pub(super) mod basebackup;
19 : pub(super) mod getpage_latest_lsn;
20 : pub(super) mod ondemand_download_churn;
21 : pub(super) mod trigger_initial_size_calculation;
22 : }
23 :
24 : /// Component-level performance test for pageserver.
25 0 : #[derive(clap::Parser)]
26 : enum Args {
27 : Basebackup(cmd::basebackup::Args),
28 : GetPageLatestLsn(cmd::getpage_latest_lsn::Args),
29 : TriggerInitialSizeCalculation(cmd::trigger_initial_size_calculation::Args),
30 : OndemandDownloadChurn(cmd::ondemand_download_churn::Args),
31 : AuxFiles(cmd::aux_files::Args),
32 : }
33 :
34 0 : fn main() {
35 0 : logging::init(
36 0 : logging::LogFormat::Plain,
37 0 : logging::TracingErrorLayerEnablement::Disabled,
38 0 : logging::Output::Stderr,
39 0 : )
40 0 : .unwrap();
41 0 : logging::replace_panic_hook_with_tracing_panic_hook().forget();
42 0 :
43 0 : let args = Args::parse();
44 0 : match args {
45 0 : Args::Basebackup(args) => cmd::basebackup::main(args),
46 0 : Args::GetPageLatestLsn(args) => cmd::getpage_latest_lsn::main(args),
47 0 : Args::TriggerInitialSizeCalculation(args) => {
48 0 : cmd::trigger_initial_size_calculation::main(args)
49 : }
50 0 : Args::OndemandDownloadChurn(args) => cmd::ondemand_download_churn::main(args),
51 0 : Args::AuxFiles(args) => cmd::aux_files::main(args),
52 : }
53 0 : .unwrap()
54 0 : }
|