Add CLI args for no-incremental-snapshot-fetch (#20787)

This commit is contained in:
Brooks Prumo 2021-10-19 13:15:30 -05:00 committed by GitHub
parent dc1b8ddea1
commit 7a36bf5095
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 0 deletions

View File

@ -40,6 +40,12 @@ use {
},
};
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
pub enum ConfigState {
Disabled,
Enabled,
}
#[derive(Debug)]
pub struct RpcBootstrapConfig {
pub no_genesis_fetch: bool,
@ -47,6 +53,8 @@ pub struct RpcBootstrapConfig {
pub no_untrusted_rpc: bool,
pub max_genesis_archive_unpacked_size: u64,
pub no_check_vote_account: bool,
pub incremental_snapshots: ConfigState,
pub incremental_snapshot_fetch: ConfigState,
}
#[allow(clippy::too_many_arguments)]

View File

@ -521,6 +521,13 @@ pub fn main() {
.help("Do not attempt to fetch a snapshot from the cluster, \
start from a local snapshot if present"),
)
.arg(
Arg::with_name("no_incremental_snapshot_fetch")
.long("no-incremental-snapshot-fetch")
.takes_value(false)
.help("Do not attempt to fetch incremental snapshots from the cluster, only fetch \
full snapshots"),
)
.arg(
Arg::with_name("no_genesis_fetch")
.long("no-genesis-fetch")
@ -1788,6 +1795,16 @@ pub fn main() {
"max_genesis_archive_unpacked_size",
u64
),
incremental_snapshots: if matches.is_present("incremental_snapshots") {
bootstrap::ConfigState::Enabled
} else {
bootstrap::ConfigState::Disabled
},
incremental_snapshot_fetch: if matches.is_present("no_incremental_snapshot_fetch") {
bootstrap::ConfigState::Disabled
} else {
bootstrap::ConfigState::Enabled
},
};
let private_rpc = matches.is_present("private_rpc");