pub fn snapshot_bank(
    root_bank: &Bank,
    status_cache_slot_deltas: Vec<BankSlotDelta>,
    accounts_package_sender: &AccountsPackageSender,
    bank_snapshots_dir: impl AsRef<Path>,
    snapshot_archives_dir: impl AsRef<Path>,
    snapshot_version: SnapshotVersion,
    archive_format: ArchiveFormat,
    hash_for_testing: Option<Hash>,
    snapshot_type: Option<SnapshotType>,
) -> Result<()> {
    let snapshot_storages = get_snapshot_storages(root_bank, snapshot_type);

    let mut add_snapshot_time = Measure::start("add-snapshot-ms");
    let bank_snapshot_info = add_bank_snapshot(
        &bank_snapshots_dir,
        root_bank,
        &snapshot_storages,
        snapshot_version,
    )?;
    add_snapshot_time.stop();
    inc_new_counter_info!("add-snapshot-ms", add_snapshot_time.as_ms() as usize);

    let accounts_package = AccountsPackage::new(
        root_bank,
        &bank_snapshot_info,
        bank_snapshots_dir,
        status_cache_slot_deltas,
        snapshot_archives_dir,
        snapshot_storages,
        archive_format,
        snapshot_version,
        hash_for_testing,
        snapshot_type,
    )
    .expect("failed to hard link bank snapshot into a tmpdir");

    accounts_package_sender.send(accounts_package)?;

    Ok(())
}
/// Gather the necessary elements for a snapshot of the given `root_bank`.
///
/// **DEVELOPER NOTE** Any error that is returned from this function may bring down the node!  This
/// function is called from AccountsBackgroundService to handle snapshot requests.  Since taking a
/// snapshot is not permitted to fail, any errors returned here will trigger the node to shutdown.
/// So, be careful whenever adding new code that may return errors.
Gather the necessary elements for a snapshot of the given `root_bank`.
DEVELOPER NOTE** Any error that is returned from this function may bring down the node.  This
function is called from AccountsBackgroundService to handle snapshot requests.  Since taking a
snapshot is not permitted to fail, any errors returned here will trigger the node to shutdown.
So, be careful whenever adding new code that may return errors.
Gather the necessary elements for a snapshot of the given ` root_bank ` . DEVELOPER NOTE ** Any error that is returned from this function may bring down the node . This function is called from AccountsBackgroundService to handle snapshot requests . Since taking a snapshot is not permitted to fail any errors returned here will trigger the node to shutdown . So be careful whenever adding new code that may return errors .
pub fn snapshot_bank(
    root_bank: &Bank,
    status_cache_slot_deltas: Vec<BankSlotDelta>,
    accounts_package_sender: &AccountsPackageSender,
    bank_snapshots_dir: impl AsRef<Path>,
    snapshot_archives_dir: impl AsRef<Path>,
    snapshot_version: SnapshotVersion,
    archive_format: ArchiveFormat,
    hash_for_testing: Option<Hash>,
    snapshot_type: Option<SnapshotType>,
) -> Result<()> {
    let snapshot_storages = get_snapshot_storages(root_bank, snapshot_type);
    let mut add_snapshot_time = Measure::start("add-snapshot-ms");
    let bank_snapshot_info = add_bank_snapshot(
        &bank_snapshots_dir,
        root_bank,
        &snapshot_storages,
        snapshot_version,
    )?;
    add_snapshot_time.stop();
    inc_new_counter_info!("add-snapshot-ms", add_snapshot_time.as_ms() as usize);
    let accounts_package = AccountsPackage::new(
        root_bank,
        &bank_snapshot_info,
        bank_snapshots_dir,
        status_cache_slot_deltas,
        snapshot_archives_dir,
        snapshot_storages,
        archive_format,
        snapshot_version,
        hash_for_testing,
        snapshot_type,
    )
    .expect("failed to hard link bank snapshot into a tmpdir");
    accounts_package_sender.send(accounts_package)?;
    Ok(())
}
pub fn snapshot_bank ( root_bank : & Bank , status_cache_slot_deltas : Vec < BankSlotDelta > , accounts_package_sender : & AccountsPackageSender , bank_snapshots_dir : impl AsRef < Path > , snapshot_archives_dir : impl AsRef < Path > , snapshot_version : SnapshotVersion , archive_format : ArchiveFormat , hash_for_testing : Option < Hash > , snapshot_type : Option < SnapshotType > , ) -> Result < ( ) > { let snapshot_storages = get_snapshot_storages ( root_bank , snapshot_type ) ; let mut add_snapshot_time = Measure :: start ( " " ) ; let bank_snapshot_info = add_bank_snapshot ( & bank_snapshots_dir , root_bank , & snapshot_storages , snapshot_version , ) ? ; add_snapshot_time . stop ( ) ; inc_new_counter_info ! ( " " add_snapshot_time as_ms ( ) as usize ) ; let accounts_package = AccountsPackage :: new ( root_bank , & bank_snapshot_info , bank_snapshots_dir , status_cache_slot_deltas , snapshot_archives_dir , snapshot_storages , archive_format , snapshot_version , hash_for_testing , snapshot_type , ) . expect ( " " ) ; accounts_package_sender . send ( accounts_package ) ? ; Ok ( ( ) ) }
Gather the necessary elements for a snapshot of the given `root_bank`.
Gather the necessary elements for a snapshot of the given ` root_bank ` .
root_bank
&Bank
status_cache_slot_deltas
Vec<BankSlotDelta>
accounts_package_sender
&AccountsPackageSender
bank_snapshots_dir
impl AsRef<Path>
snapshot_archives_dir
impl AsRef<Path>
snapshot_version
SnapshotVersion
archive_format
ArchiveFormat
hash_for_testing
Option<Hash>
snapshot_type
Option<SnapshotType>