fn unarchive_snapshot<P, Q>(
    bank_snapshots_dir: P,
    unpacked_snapshots_dir_prefix: &'static str,
    snapshot_archive_path: Q,
    measure_name: &'static str,
    account_paths: &[PathBuf],
    archive_format: ArchiveFormat,
    parallel_divisions: usize,
) -> Result<UnarchivedSnapshot>
where
    P: AsRef<Path>,
    Q: AsRef<Path>,
{
    let unpack_dir = tempfile::Builder::new()
        .prefix(unpacked_snapshots_dir_prefix)
        .tempdir_in(bank_snapshots_dir)?;
    let unpacked_snapshots_dir = unpack_dir.path().join("snapshots");

    let mut measure_untar = Measure::start(measure_name);
    let unpacked_append_vec_map = untar_snapshot_in(
        snapshot_archive_path,
        unpack_dir.path(),
        account_paths,
        archive_format,
        parallel_divisions,
    )?;
    measure_untar.stop();
    info!("{}", measure_untar);

    let unpacked_version_file = unpack_dir.path().join("version");
    let snapshot_version = snapshot_version_from_file(&unpacked_version_file)?;

    Ok(UnarchivedSnapshot {
        unpack_dir,
        unpacked_append_vec_map,
        unpacked_snapshots_dir_and_version: UnpackedSnapshotsDirAndVersion {
            unpacked_snapshots_dir,
            snapshot_version,
        },
        measure_untar,
    })
}
/// Perform the common tasks when unarchiving a snapshot.  Handles creating the temporary
/// directories, untaring, reading the version file, and then returning those fields plus the
/// unpacked append vec map.
Perform the common tasks when unarchiving a snapshot.  Handles creating the temporary
directories, untaring, reading the version file, and then returning those fields plus the
unpacked append vec map.
Perform the common tasks when unarchiving a snapshot . Handles creating the temporary directories untaring reading the version file and then returning those fields plus the unpacked append vec map .
fn unarchive_snapshot<P, Q>(
    bank_snapshots_dir: P,
    unpacked_snapshots_dir_prefix: &'static str,
    snapshot_archive_path: Q,
    measure_name: &'static str,
    account_paths: &[PathBuf],
    archive_format: ArchiveFormat,
    parallel_divisions: usize,
) -> Result<UnarchivedSnapshot>
where
    P: AsRef<Path>,
    Q: AsRef<Path>,
{
    let unpack_dir = tempfile::Builder::new()
        .prefix(unpacked_snapshots_dir_prefix)
        .tempdir_in(bank_snapshots_dir)?;
    let unpacked_snapshots_dir = unpack_dir.path().join("snapshots");
    let mut measure_untar = Measure::start(measure_name);
    let unpacked_append_vec_map = untar_snapshot_in(
        snapshot_archive_path,
        unpack_dir.path(),
        account_paths,
        archive_format,
        parallel_divisions,
    )?;
    measure_untar.stop();
    info!("{}", measure_untar);
    let unpacked_version_file = unpack_dir.path().join("version");
    let snapshot_version = snapshot_version_from_file(&unpacked_version_file)?;
    Ok(UnarchivedSnapshot {
        unpack_dir,
        unpacked_append_vec_map,
        unpacked_snapshots_dir_and_version: UnpackedSnapshotsDirAndVersion {
            unpacked_snapshots_dir,
            snapshot_version,
        },
        measure_untar,
    })
}
fn unarchive_snapshot < P , Q > ( bank_snapshots_dir : P , unpacked_snapshots_dir_prefix : & ' static str , snapshot_archive_path : Q , measure_name : & ' static str , account_paths : & [ PathBuf ] , archive_format : ArchiveFormat , parallel_divisions : usize , ) -> Result < UnarchivedSnapshot > where P : AsRef < Path > , Q : AsRef < Path > , { let unpack_dir = tempfile :: Builder :: new ( ) . prefix ( unpacked_snapshots_dir_prefix ) . tempdir_in ( bank_snapshots_dir ) ? ; let unpacked_snapshots_dir = unpack_dir . path ( ) . join ( " " ) ; let mut measure_untar = Measure :: start ( measure_name ) ; let unpacked_append_vec_map = untar_snapshot_in ( snapshot_archive_path , unpack_dir . path ( ) , account_paths , archive_format , parallel_divisions , ) ? ; measure_untar . stop ( ) ; info ! ( " " measure_untar ) ; let unpacked_version_file = unpack_dir . path ( ) . join ( " " ) ; let snapshot_version = snapshot_version_from_file ( & unpacked_version_file ) ? ; Ok ( UnarchivedSnapshot { unpack_dir , unpacked_append_vec_map , unpacked_snapshots_dir_and_version : UnpackedSnapshotsDirAndVersion { unpacked_snapshots_dir , snapshot_version , } , measure_untar , } ) }
Perform the common tasks when unarchiving a snapshot.
Perform the common tasks when unarchiving a snapshot .
bank_snapshots_dir
P
unpacked_snapshots_dir_prefix
&'static str
snapshot_archive_path
Q
measure_name
&'static str
account_paths
&[PathBuf]
archive_format
ArchiveFormat
parallel_divisions
usize