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>

source

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.

source

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

source

fn get_active_bank_features(&self)

Used to get active bank feature accounts in minimize.

source

fn get_inactive_bank_features(&self)

Used to get inactive bank feature accounts in minimize

source

fn get_builtins(&self)

Used to get builtin accounts in minimize

source

fn get_static_runtime_accounts(&self)

Used to get static runtime accounts in minimize

source

fn get_sdk_accounts(&self)

Used to get sdk accounts in minimize

source

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

source

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

source

fn get_stake_accounts(&self)

Used to get stake accounts in minimize Add all pubkeys from stake accounts to minimized_account_set

source

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.

source

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

source

fn minimize_accounts_db(&self)

Remove accounts not in minimized_accoun_set from accounts_db

source

fn get_minimized_slot_set(&self) -> DashSet<Slot>

Determines minimum set of slots that accounts in minimized_account_set are in

source

fn process_snapshot_storages( &self, minimized_slot_set: DashSet<Slot> ) -> (Vec<Slot>, Vec<Arc<AccountStorageEntry>>)

Process all snapshot storages to during minimize

source

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.

source

fn purge_dead_slots(&self, dead_slots: Vec<Slot>)

Purge dead slots from storage and cache

source

fn accounts_db(&self) -> &AccountsDb

Convenience function for getting accounts_db

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for SnapshotMinimizer<'a>

§

impl<'a> Send for SnapshotMinimizer<'a>

§

impl<'a> Sync for SnapshotMinimizer<'a>

§

impl<'a> Unpin for SnapshotMinimizer<'a>

§

impl<'a> !UnwindSafe for SnapshotMinimizer<'a>

Blanket Implementations§

source§

impl<T> AbiExample for T

source§

default fn example() -> T

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more