pub struct SnapshotMinimizer<'a> {
bank: &'a Bank,
starting_slot: Slot,
ending_slot: Slot,
minimized_account_set: DashSet<Pubkey>,
}
Expand description
Used to modify bank and accounts_db to create a minimized snapshot
Fields§
§bank: &'a Bank
§starting_slot: Slot
§ending_slot: Slot
§minimized_account_set: DashSet<Pubkey>
Implementations§
source§impl<'a> SnapshotMinimizer<'a>
impl<'a> SnapshotMinimizer<'a>
sourcepub fn minimize(
bank: &'a Bank,
starting_slot: Slot,
ending_slot: Slot,
transaction_account_set: DashSet<Pubkey>
)
pub fn minimize( bank: &'a Bank, starting_slot: Slot, ending_slot: Slot, transaction_account_set: DashSet<Pubkey> )
Removes all accounts not necessary for replaying slots in the range [starting_slot, ending_slot].
transaction_account_set
should contain accounts used in transactions in the slot range [starting_slot, ending_slot].
This function will accumulate other accounts (rent colleciton, builtins, etc) necessary to replay transactions.
This function will modify accounts_db by removing accounts not needed to replay [starting_slot, ending_slot], and update the bank’s capitalization.
sourcefn add_accounts<F>(&self, add_accounts_fn: F, name: &'static str)where
F: Fn(&SnapshotMinimizer<'a>),
fn add_accounts<F>(&self, add_accounts_fn: F, name: &'static str)where F: Fn(&SnapshotMinimizer<'a>),
Helper function to measure time and number of accounts added
sourcefn get_active_bank_features(&self)
fn get_active_bank_features(&self)
Used to get active bank feature accounts in minimize
.
sourcefn get_inactive_bank_features(&self)
fn get_inactive_bank_features(&self)
Used to get inactive bank feature accounts in minimize
sourcefn get_builtins(&self)
fn get_builtins(&self)
Used to get builtin accounts in minimize
sourcefn get_static_runtime_accounts(&self)
fn get_static_runtime_accounts(&self)
Used to get static runtime accounts in minimize
sourcefn get_sdk_accounts(&self)
fn get_sdk_accounts(&self)
Used to get sdk accounts in minimize
sourcefn get_rent_collection_accounts(&self)
fn get_rent_collection_accounts(&self)
Used to get rent collection accounts in minimize
Add all pubkeys we would collect rent from or rewrite to minimized_account_set
.
related to Bank::rent_collection_partitions
sourcefn get_vote_accounts(&self)
fn get_vote_accounts(&self)
Used to get vote and node pubkeys in minimize
Add all pubkeys from vote accounts and nodes to minimized_account_set
sourcefn get_stake_accounts(&self)
fn get_stake_accounts(&self)
Used to get stake accounts in minimize
Add all pubkeys from stake accounts to minimized_account_set
sourcefn get_owner_accounts(&self)
fn get_owner_accounts(&self)
Used to get owner accounts in minimize
For each account in minimized_account_set
adds the owner account’s pubkey to minimized_account_set
.
sourcefn get_programdata_accounts(&self)
fn get_programdata_accounts(&self)
Used to get program data accounts in minimize
For each upgradable bpf program, adds the programdata account pubkey to minimized_account_set
sourcefn minimize_accounts_db(&self)
fn minimize_accounts_db(&self)
Remove accounts not in minimized_accoun_set
from accounts_db
sourcefn get_minimized_slot_set(&self) -> DashSet<Slot>
fn get_minimized_slot_set(&self) -> DashSet<Slot>
Determines minimum set of slots that accounts in minimized_account_set
are in
sourcefn process_snapshot_storages(
&self,
minimized_slot_set: DashSet<Slot>
) -> (Vec<Slot>, Vec<Arc<AccountStorageEntry>>)
fn process_snapshot_storages( &self, minimized_slot_set: DashSet<Slot> ) -> (Vec<Slot>, Vec<Arc<AccountStorageEntry>>)
Process all snapshot storages to during minimize
sourcefn filter_storage(
&self,
storage: &Arc<AccountStorageEntry>,
dead_storages: &Mutex<Vec<Arc<AccountStorageEntry>>>
)
fn filter_storage( &self, storage: &Arc<AccountStorageEntry>, dead_storages: &Mutex<Vec<Arc<AccountStorageEntry>>> )
Creates new storage replacing storages
that contains only accounts in minimized_account_set
.
sourcefn purge_dead_slots(&self, dead_slots: Vec<Slot>)
fn purge_dead_slots(&self, dead_slots: Vec<Slot>)
Purge dead slots from storage and cache
sourcefn accounts_db(&self) -> &AccountsDb
fn accounts_db(&self) -> &AccountsDb
Convenience function for getting accounts_db