Skip to content

Commit

Permalink
Adds --snapshot-zstd-compression-level to agave-ledger-tool (solana-l…
Browse files Browse the repository at this point in the history
  • Loading branch information
brooksprumo authored Jan 21, 2025
1 parent c043329 commit a2c9a94
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions ledger-tool/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1448,6 +1448,20 @@ fn main() {
.help("Snapshot archive format to use.")
.conflicts_with("no_snapshot"),
)
.arg(
Arg::with_name("snapshot_zstd_compression_level")
.long("snapshot-zstd-compression-level")
.default_value("0")
.value_name("LEVEL")
.takes_value(true)
.help("The compression level to use when archiving with zstd")
.long_help(
"The compression level to use when archiving with zstd. \
Higher compression levels generally produce higher \
compression ratio at the expense of speed and memory. \
See the zstd manpage for more information."
),
)
.arg(
Arg::with_name("enable_capitalization_change")
.long("enable-capitalization-change")
Expand Down Expand Up @@ -1970,9 +1984,18 @@ fn main() {
let snapshot_archive_format = {
let archive_format_str =
value_t_or_exit!(arg_matches, "snapshot_archive_format", String);
ArchiveFormat::from_cli_arg(&archive_format_str).unwrap_or_else(|| {
panic!("Archive format not recognized: {archive_format_str}")
})
let mut archive_format = ArchiveFormat::from_cli_arg(&archive_format_str)
.unwrap_or_else(|| {
panic!("Archive format not recognized: {archive_format_str}")
});
if let ArchiveFormat::TarZstd { config } = &mut archive_format {
config.compression_level = value_t_or_exit!(
arg_matches,
"snapshot_zstd_compression_level",
i32
);
}
archive_format
};

let genesis_config = open_genesis_config_by(&ledger_path, arg_matches);
Expand Down

0 comments on commit a2c9a94

Please sign in to comment.