pub fn bank_to_snapshot_archive<P: AsRef<Path>, Q: AsRef<Path>>(
    snapshot_path: P,
    bank: &Bank,
    snapshot_version: Option<SnapshotVersion>,
    snapshot_package_output_path: Q,
    archive_format: ArchiveFormat,
    thread_pool: Option<&ThreadPool>,
) -> Result<PathBuf> {
    let snapshot_version = snapshot_version.unwrap_or_default();

    assert!(bank.is_complete());
    bank.squash(); // Bank may not be a root
    bank.force_flush_accounts_cache();
    bank.clean_accounts(true);
    bank.update_accounts_hash();
    bank.rehash(); // Bank accounts may have been manually modified by the caller

    let temp_dir = tempfile::tempdir_in(snapshot_path)?;

    let storages: Vec<_> = bank.get_snapshot_storages();
    let slot_snapshot_paths = add_snapshot(&temp_dir, bank, &storages, snapshot_version)?;
    let package = package_snapshot(
        bank,
        &slot_snapshot_paths,
        &temp_dir,
        bank.src.slot_deltas(&bank.src.roots()),
        snapshot_package_output_path,
        storages,
        archive_format,
        snapshot_version,
        None,
    )?;

    let package = process_accounts_package_pre(package, thread_pool);

    archive_snapshot_package(&package)?;
    Ok(package.tar_output_file)
}
/// Convenience function to create a snapshot archive out of any Bank, regardless of state.  The
/// Bank will be frozen during the process.
Convenience function to create a snapshot archive out of any Bank, regardless of state.  The
Bank will be frozen during the process.
Convenience function to create a snapshot archive out of any Bank regardless of state . The Bank will be frozen during the process .
pub fn bank_to_snapshot_archive<P: AsRef<Path>, Q: AsRef<Path>>(
    snapshot_path: P,
    bank: &Bank,
    snapshot_version: Option<SnapshotVersion>,
    snapshot_package_output_path: Q,
    archive_format: ArchiveFormat,
    thread_pool: Option<&ThreadPool>,
) -> Result<PathBuf> {
    let snapshot_version = snapshot_version.unwrap_or_default();
    assert!(bank.is_complete());
    bank.squash(); // Bank may not be a root
    bank.force_flush_accounts_cache();
    bank.clean_accounts(true);
    bank.update_accounts_hash();
    bank.rehash(); // Bank accounts may have been manually modified by the caller
    let temp_dir = tempfile::tempdir_in(snapshot_path)?;
    let storages: Vec<_> = bank.get_snapshot_storages();
    let slot_snapshot_paths = add_snapshot(&temp_dir, bank, &storages, snapshot_version)?;
    let package = package_snapshot(
        bank,
        &slot_snapshot_paths,
        &temp_dir,
        bank.src.slot_deltas(&bank.src.roots()),
        snapshot_package_output_path,
        storages,
        archive_format,
        snapshot_version,
        None,
    )?;
    let package = process_accounts_package_pre(package, thread_pool);
    archive_snapshot_package(&package)?;
    Ok(package.tar_output_file)
}
pub fn bank_to_snapshot_archive < P : AsRef < Path > , Q : AsRef < Path > > ( snapshot_path : P , bank : & Bank , snapshot_version : Option < SnapshotVersion > , snapshot_package_output_path : Q , archive_format : ArchiveFormat , thread_pool : Option < & ThreadPool > , ) -> Result < PathBuf > { let snapshot_version = snapshot_version . unwrap_or_default ( ) ; assert ! ( bank is_complete ( ) ) ; bank . squash ( ) ; // Bank may not be a root bank . force_flush_accounts_cache ( ) ; bank . clean_accounts ( true ) ; bank . update_accounts_hash ( ) ; bank . rehash ( ) ; // Bank accounts may have been manually modified by the caller let temp_dir = tempfile :: tempdir_in ( snapshot_path ) ? ; let storages : Vec < _ > = bank . get_snapshot_storages ( ) ; let slot_snapshot_paths = add_snapshot ( & temp_dir , bank , & storages , snapshot_version ) ? ; let package = package_snapshot ( bank , & slot_snapshot_paths , & temp_dir , bank . src . slot_deltas ( & bank . src . roots ( ) ) , snapshot_package_output_path , storages , archive_format , snapshot_version , None , ) ? ; let package = process_accounts_package_pre ( package , thread_pool ) ; archive_snapshot_package ( & package ) ? ; Ok ( package . tar_output_file ) }
Convenience function to create a snapshot archive out of any Bank, regardless of state.
Convenience function to create a snapshot archive out of any Bank regardless of state .
snapshot_path
P
bank
&Bank
snapshot_version
Option<SnapshotVersion>
snapshot_package_output_path
Q
archive_format
ArchiveFormat
thread_pool
Option<&ThreadPool>
snapshot_path
P
bank
&Bank
snapshot_version
Option<SnapshotVersion>
snapshot_package_output_path
Q
archive_format
ArchiveFormat
thread_pool
Option<&ThreadPool>