pub fn handle_snapshot_requests(&self) -> Option<u64> {
        self.snapshot_request_receiver
            .try_iter()
            .last()
            .map(|snapshot_request| {
                let SnapshotRequest {
                    snapshot_root_bank,
                    status_cache_slot_deltas,
                } = snapshot_request;

                let mut hash_time = Measure::start("hash_time");
                snapshot_root_bank.update_accounts_hash();
                hash_time.stop();

                let mut shrink_time = Measure::start("shrink_time");
                snapshot_root_bank.process_stale_slot_with_budget(0, SHRUNKEN_ACCOUNT_PER_INTERVAL);
                shrink_time.stop();

                let mut clean_time = Measure::start("clean_time");
                // Don't clean the slot we're snapshotting because it may have zero-lamport
                // accounts that were included in the bank delta hash when the bank was frozen,
                // and if we clean them here, the newly created snapshot's hash may not match
                // the frozen hash.
                snapshot_root_bank.clean_accounts(true);
                clean_time.stop();

                // Generate an accounts package
                let mut snapshot_time = Measure::start("snapshot_time");
                let r = snapshot_utils::snapshot_bank(
                    &snapshot_root_bank,
                    status_cache_slot_deltas,
                    &self.accounts_package_sender,
                    &self.snapshot_config.snapshot_path,
                    &self.snapshot_config.snapshot_package_output_path,
                    self.snapshot_config.snapshot_version,
                    &self.snapshot_config.compression,
                );
                if r.is_err() {
                    warn!(
                        "Error generating snapshot for bank: {}, err: {:?}",
                        snapshot_root_bank.slot(),
                        r
                    );
                }
                snapshot_time.stop();

                // Cleanup outdated snapshots
                let mut purge_old_snapshots_time = Measure::start("purge_old_snapshots_time");
                snapshot_utils::purge_old_snapshots(&self.snapshot_config.snapshot_path);
                purge_old_snapshots_time.stop();

                datapoint_info!(
                    "handle_snapshot_requests-timing",
                    ("shrink_time", shrink_time.as_us(), i64),
                    ("clean_time", clean_time.as_us(), i64),
                    ("snapshot_time", snapshot_time.as_us(), i64),
                    (
                        "purge_old_snapshots_time",
                        purge_old_snapshots_time.as_us(),
                        i64
                    ),
                    ("hash_time", hash_time.as_us(), i64),
                );
                snapshot_root_bank.block_height()
            })
    }
// Returns the latest requested snapshot slot, if one exists
Returns the latest requested snapshot slot, if one exists
Returns the latest requested snapshot slot if one exists
pub fn handle_snapshot_requests(&self) -> Option<u64> {
        self.snapshot_request_receiver
            .try_iter()
            .last()
            .map(|snapshot_request| {
                let SnapshotRequest {
                    snapshot_root_bank,
                    status_cache_slot_deltas,
                } = snapshot_request;
                let mut hash_time = Measure::start("hash_time");
                snapshot_root_bank.update_accounts_hash();
                hash_time.stop();
                let mut shrink_time = Measure::start("shrink_time");
                snapshot_root_bank.process_stale_slot_with_budget(0, SHRUNKEN_ACCOUNT_PER_INTERVAL);
                shrink_time.stop();
                let mut clean_time = Measure::start("clean_time");
                // Don't clean the slot we're snapshotting because it may have zero-lamport
                // accounts that were included in the bank delta hash when the bank was frozen,
                // and if we clean them here, the newly created snapshot's hash may not match
                // the frozen hash.
                snapshot_root_bank.clean_accounts(true);
                clean_time.stop();
                // Generate an accounts package
                let mut snapshot_time = Measure::start("snapshot_time");
                let r = snapshot_utils::snapshot_bank(
                    &snapshot_root_bank,
                    status_cache_slot_deltas,
                    &self.accounts_package_sender,
                    &self.snapshot_config.snapshot_path,
                    &self.snapshot_config.snapshot_package_output_path,
                    self.snapshot_config.snapshot_version,
                    &self.snapshot_config.compression,
                );
                if r.is_err() {
                    warn!(
                        "Error generating snapshot for bank: {}, err: {:?}",
                        snapshot_root_bank.slot(),
                        r
                    );
                }
                snapshot_time.stop();
                // Cleanup outdated snapshots
                let mut purge_old_snapshots_time = Measure::start("purge_old_snapshots_time");
                snapshot_utils::purge_old_snapshots(&self.snapshot_config.snapshot_path);
                purge_old_snapshots_time.stop();
                datapoint_info!(
                    "handle_snapshot_requests-timing",
                    ("shrink_time", shrink_time.as_us(), i64),
                    ("clean_time", clean_time.as_us(), i64),
                    ("snapshot_time", snapshot_time.as_us(), i64),
                    (
                        "purge_old_snapshots_time",
                        purge_old_snapshots_time.as_us(),
                        i64
                    ),
                    ("hash_time", hash_time.as_us(), i64),
                );
                snapshot_root_bank.block_height()
            })
    }
pub fn handle_snapshot_requests ( & self ) -> Option < u64 > { self . snapshot_request_receiver . try_iter ( ) . last ( ) . map ( | snapshot_request | { let SnapshotRequest { snapshot_root_bank , status_cache_slot_deltas , } = snapshot_request ; let mut hash_time = Measure :: start ( " " ) ; snapshot_root_bank . update_accounts_hash ( ) ; hash_time . stop ( ) ; let mut shrink_time = Measure :: start ( " " ) ; snapshot_root_bank . process_stale_slot_with_budget ( 0 , SHRUNKEN_ACCOUNT_PER_INTERVAL ) ; shrink_time . stop ( ) ; let mut clean_time = Measure :: start ( " " ) ; // Don't clean the slot we're snapshotting because it may have zero-lamport // accounts that were included in the bank delta hash when the bank was frozen, // and if we clean them here, the newly created snapshot's hash may not match // the frozen hash. snapshot_root_bank . clean_accounts ( true ) ; clean_time . stop ( ) ; // Generate an accounts package let mut snapshot_time = Measure :: start ( " " ) ; let r = snapshot_utils :: snapshot_bank ( & snapshot_root_bank , status_cache_slot_deltas , & self . accounts_package_sender , & self . snapshot_config . snapshot_path , & self . snapshot_config . snapshot_package_output_path , self . snapshot_config . snapshot_version , & self . snapshot_config . compression , ) ; if r . is_err ( ) { warn ! ( " " snapshot_root_bank slot ( ) r ) ; } snapshot_time . stop ( ) ; // Cleanup outdated snapshots let mut purge_old_snapshots_time = Measure :: start ( " " ) ; snapshot_utils :: purge_old_snapshots ( & self . snapshot_config . snapshot_path ) ; purge_old_snapshots_time . stop ( ) ; datapoint_info ! ( " " ( " " shrink_time as_us ( ) i64 ) ( " " clean_time as_us ( ) i64 ) ( " " snapshot_time as_us ( ) i64 ) ( " " purge_old_snapshots_time as_us ( ) i64 ) ( " " hash_time as_us ( ) i64 ) ) ; snapshot_root_bank . block_height ( ) } ) }
Returns the latest requested snapshot slot, if one exists
Returns the latest requested snapshot slot if one exists
&self