Name snapshots consistently (#19346)

#### Problem

Snapshot names are overloaded, and there are multiple terms that mean the same thing. This is confusing. Here's a list of ones in the codebase that I've found:

```
- snapshot_dir
- snapshots_dir
- snapshot_path
- snapshot_output_dir
- snapshot_package_output_path
- snapshot_archives_dir
```

#### Summary of Changes

For all the ones that are about the directory where snapshot archives are stored, ensure they are `snapshot_archives_dir`. For the ones about the (bank) snapshots directory, set to `bank_snapshots_dir`.


Co-authored-by: Michael Vines <mvines@gmail.com>
This commit is contained in:
Brooks Prumo
2021-08-21 15:41:03 -05:00
committed by GitHub
parent 9483866e0b
commit 6d939811e9
19 changed files with 237 additions and 221 deletions

View File

@ -2369,7 +2369,7 @@ pub mod rpc_minimal {
meta.snapshot_config
.and_then(|snapshot_config| {
snapshot_utils::get_highest_full_snapshot_archive_slot(
&snapshot_config.snapshot_package_output_path,
&snapshot_config.snapshot_archives_dir,
)
})
.ok_or_else(|| RpcCustomError::NoSnapshot.into())

View File

@ -149,7 +149,7 @@ impl RpcRequestMiddleware {
self.snapshot_config
.as_ref()
.unwrap()
.snapshot_package_output_path
.snapshot_archives_dir
.join(stem)
}
}
@ -204,7 +204,7 @@ impl RequestMiddleware for RpcRequestMiddleware {
// Convenience redirect to the latest snapshot
return if let Some(full_snapshot_archive_info) =
snapshot_utils::get_highest_full_snapshot_archive_info(
&snapshot_config.snapshot_package_output_path,
&snapshot_config.snapshot_archives_dir,
) {
RpcRequestMiddleware::redirect(&format!(
"/{}",
@ -604,8 +604,8 @@ mod tests {
Some(SnapshotConfig {
full_snapshot_archive_interval_slots: 0,
incremental_snapshot_archive_interval_slots: u64::MAX,
snapshot_package_output_path: PathBuf::from("/"),
snapshot_path: PathBuf::from("/"),
snapshot_archives_dir: PathBuf::from("/"),
bank_snapshots_dir: PathBuf::from("/"),
archive_format: ArchiveFormat::TarBzip2,
snapshot_version: SnapshotVersion::default(),
maximum_snapshots_to_retain: DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,