sui_indexer_alt/args.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use std::path::PathBuf;
#[cfg(feature = "benchmark")]
use crate::benchmark::BenchmarkArgs;
use crate::IndexerArgs;
use clap::Subcommand;
use sui_indexer_alt_framework::{db::DbArgs, ingestion::ClientArgs};
use sui_indexer_alt_metrics::MetricsArgs;
use url::Url;
#[derive(clap::Parser, Debug, Clone)]
pub struct Args {
#[command(subcommand)]
pub command: Command,
}
#[allow(clippy::large_enum_variant)]
#[derive(Subcommand, Clone, Debug)]
pub enum Command {
/// Run the indexer.
Indexer {
/// The URL of the database to connect to.
#[clap(
long,
default_value = "postgres://postgres:postgrespw@localhost:5432/sui_indexer_alt"
)]
database_url: Url,
#[command(flatten)]
db_args: DbArgs,
#[command(flatten)]
client_args: ClientArgs,
#[command(flatten)]
indexer_args: IndexerArgs,
#[command(flatten)]
metrics_args: MetricsArgs,
/// Path to the indexer's configuration TOML file.
#[arg(long)]
config: PathBuf,
},
/// Output the contents of the default configuration to STDOUT.
GenerateConfig,
/// Combine the configuration held across multiple files into one and output it to STDOUT. When
/// two configurations set the same field, the last write wins.
MergeConfigs {
/// Path to a TOML file to be merged
#[arg(long, required = true, action = clap::ArgAction::Append)]
config: Vec<PathBuf>,
},
/// Wipe the database of its contents
ResetDatabase {
/// The URL of the database to connect to.
#[clap(
long,
default_value = "postgres://postgres:postgrespw@localhost:5432/sui_indexer_alt"
)]
database_url: Url,
#[command(flatten)]
db_args: DbArgs,
/// If true, only drop all tables but do not run the migrations.
/// That is, no tables will exist in the DB after the reset.
#[clap(long, default_value_t = false)]
skip_migrations: bool,
},
/// Run the benchmark. It will load ingestion data from the given path and run the pipelines.
/// The first and last checkpoint will be determined automatically based on the ingestion data.
/// Note that the indexer will not be bootstrapped from genesis, and hence will
/// skip any pipelines that rely on genesis data.
#[cfg(feature = "benchmark")]
Benchmark {
/// The URL of the database to connect to.
#[clap(
long,
default_value = "postgres://postgres:postgrespw@localhost:5432/sui_indexer_alt"
)]
database_url: Url,
#[command(flatten)]
db_args: DbArgs,
#[command(flatten)]
benchmark_args: BenchmarkArgs,
/// Path to the indexer's configuration TOML file.
#[arg(long)]
config: PathBuf,
},
}