pub fn bank_to_incremental_snapshot_archive(
    bank_snapshots_dir: impl AsRef<Path>,
    bank: &Bank,
    full_snapshot_slot: Slot,
    snapshot_version: Option<SnapshotVersion>,
    snapshot_archives_dir: impl AsRef<Path>,
    archive_format: ArchiveFormat,
    maximum_full_snapshot_archives_to_retain: usize,
    maximum_incremental_snapshot_archives_to_retain: usize,
) -> Result<IncrementalSnapshotArchiveInfo> {
    let snapshot_version = snapshot_version.unwrap_or_default();

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

    let temp_dir = tempfile::tempdir_in(bank_snapshots_dir)?;
    let snapshot_storages = bank.get_snapshot_storages(Some(full_snapshot_slot));
    let bank_snapshot_info =
        add_bank_snapshot(&temp_dir, bank, &snapshot_storages, snapshot_version)?;

    package_and_archive_incremental_snapshot(
        bank,
        full_snapshot_slot,
        &bank_snapshot_info,
        &temp_dir,
        snapshot_archives_dir,
        snapshot_storages,
        archive_format,
        snapshot_version,
        maximum_full_snapshot_archives_to_retain,
        maximum_incremental_snapshot_archives_to_retain,
    )
}
/// Convenience function to create an incremental snapshot archive out of any Bank, regardless of
/// state.  The Bank will be frozen during the process.
///
/// Requires:
///     - `bank` is complete
///     - `bank`'s slot is greater than `full_snapshot_slot`
Convenience function to create an incremental snapshot archive out of any Bank, regardless of
state.  The Bank will be frozen during the process.


Convenience function to create an incremental snapshot archive out of any Bank regardless of state . The Bank will be frozen during the process .
pub fn bank_to_incremental_snapshot_archive(
    bank_snapshots_dir: impl AsRef<Path>,
    bank: &Bank,
    full_snapshot_slot: Slot,
    snapshot_version: Option<SnapshotVersion>,
    snapshot_archives_dir: impl AsRef<Path>,
    archive_format: ArchiveFormat,
    maximum_full_snapshot_archives_to_retain: usize,
    maximum_incremental_snapshot_archives_to_retain: usize,
) -> Result<IncrementalSnapshotArchiveInfo> {
    let snapshot_version = snapshot_version.unwrap_or_default();
    assert!(bank.is_complete());
    assert!(bank.slot() > full_snapshot_slot);
    bank.squash(); // Bank may not be a root
    bank.force_flush_accounts_cache();
    bank.clean_accounts(true, false, Some(full_snapshot_slot));
    bank.update_accounts_hash();
    bank.rehash(); // Bank accounts may have been manually modified by the caller
    let temp_dir = tempfile::tempdir_in(bank_snapshots_dir)?;
    let snapshot_storages = bank.get_snapshot_storages(Some(full_snapshot_slot));
    let bank_snapshot_info =
        add_bank_snapshot(&temp_dir, bank, &snapshot_storages, snapshot_version)?;
    package_and_archive_incremental_snapshot(
        bank,
        full_snapshot_slot,
        &bank_snapshot_info,
        &temp_dir,
        snapshot_archives_dir,
        snapshot_storages,
        archive_format,
        snapshot_version,
        maximum_full_snapshot_archives_to_retain,
        maximum_incremental_snapshot_archives_to_retain,
    )
}
pub fn bank_to_incremental_snapshot_archive ( bank_snapshots_dir : impl AsRef < Path > , bank : & Bank , full_snapshot_slot : Slot , snapshot_version : Option < SnapshotVersion > , snapshot_archives_dir : impl AsRef < Path > , archive_format : ArchiveFormat , maximum_full_snapshot_archives_to_retain : usize , maximum_incremental_snapshot_archives_to_retain : usize , ) -> Result < IncrementalSnapshotArchiveInfo > { let snapshot_version = snapshot_version . unwrap_or_default ( ) ; assert ! ( bank is_complete ( ) ) ; assert ! ( bank slot ( ) full_snapshot_slot ) ; bank . squash ( ) ; // Bank may not be a root bank . force_flush_accounts_cache ( ) ; bank . clean_accounts ( true , false , Some ( full_snapshot_slot ) ) ; bank . update_accounts_hash ( ) ; bank . rehash ( ) ; // Bank accounts may have been manually modified by the caller let temp_dir = tempfile :: tempdir_in ( bank_snapshots_dir ) ? ; let snapshot_storages = bank . get_snapshot_storages ( Some ( full_snapshot_slot ) ) ; let bank_snapshot_info = add_bank_snapshot ( & temp_dir , bank , & snapshot_storages , snapshot_version ) ? ; package_and_archive_incremental_snapshot ( bank , full_snapshot_slot , & bank_snapshot_info , & temp_dir , snapshot_archives_dir , snapshot_storages , archive_format , snapshot_version , maximum_full_snapshot_archives_to_retain , maximum_incremental_snapshot_archives_to_retain , ) }
Convenience function to create an incremental snapshot archive out of any Bank, regardless of
state.
Convenience function to create an incremental snapshot archive out of any Bank regardless of state .
bank_snapshots_dir
impl AsRef<Path>
bank
&Bank
full_snapshot_slot
Slot
snapshot_version
Option<SnapshotVersion>
snapshot_archives_dir
impl AsRef<Path>
archive_format
ArchiveFormat
maximum_full_snapshot_archives_to_retain
usize
maximum_incremental_snapshot_archives_to_retain
usize