solana_accounts_db::accounts

Struct Accounts

Source
pub struct Accounts {
    pub accounts_db: Arc<AccountsDb>,
    /* private fields */
}
Expand description

This structure handles synchronization for db

Fields§

§accounts_db: Arc<AccountsDb>

Single global AccountsDb

Implementations§

Source§

impl Accounts

Source

pub fn new(accounts_db: Arc<AccountsDb>) -> Self

Source

pub fn load_lookup_table_addresses( &self, ancestors: &Ancestors, address_table_lookup: SVMMessageAddressTableLookup<'_>, slot_hashes: &SlotHashes, ) -> Result<(LoadedAddresses, Slot), AddressLookupError>

Return loaded addresses and the deactivation slot. If the table hasn’t been deactivated, the deactivation slot is u64::MAX.

Source

pub fn load_lookup_table_addresses_into( &self, ancestors: &Ancestors, address_table_lookup: SVMMessageAddressTableLookup<'_>, slot_hashes: &SlotHashes, loaded_addresses: &mut LoadedAddresses, ) -> Result<Slot, AddressLookupError>

Fill loaded_addresses and return the deactivation slot. If no tables are de-activating, the deactivation slot is u64::MAX.

Source

pub fn load_with_fixed_root( &self, ancestors: &Ancestors, pubkey: &Pubkey, ) -> Option<(AccountSharedData, Slot)>

Source

pub fn load_with_fixed_root_do_not_populate_read_cache( &self, ancestors: &Ancestors, pubkey: &Pubkey, ) -> Option<(AccountSharedData, Slot)>

same as load_with_fixed_root except: if the account is not already in the read cache, it is NOT put in the read cache on successful load

Source

pub fn load_without_fixed_root( &self, ancestors: &Ancestors, pubkey: &Pubkey, ) -> Option<(AccountSharedData, Slot)>

Source

pub fn scan_slot<F, B>(&self, slot: Slot, func: F) -> Vec<B>
where F: Fn(&LoadedAccount<'_>) -> Option<B> + Send + Sync, B: Sync + Send + Default + Eq,

scans underlying accounts_db for this delta (slot) with a map function from LoadedAccount to B returns only the latest/current version of B for this slot

Source

pub fn load_by_program_slot( &self, slot: Slot, program_id: Option<&Pubkey>, ) -> Vec<TransactionAccount>

Returns all the accounts from slot

If program_id is Some, filter the results to those whose owner matches program_id

Source

pub fn load_largest_accounts( &self, ancestors: &Ancestors, bank_id: BankId, num: usize, filter_by_address: &HashSet<Pubkey>, filter: AccountAddressFilter, sort_results: bool, ) -> ScanResult<Vec<(Pubkey, u64)>>

Source

pub fn verify_accounts_hash_and_lamports( &self, snapshot_storages_and_slots: (&[Arc<AccountStorageEntry>], &[Slot]), slot: Slot, total_lamports: u64, base: Option<(Slot, u64)>, config: VerifyAccountsHashAndLamportsConfig<'_>, ) -> bool

Only called from startup or test code.

Source

pub fn is_loadable(lamports: u64) -> bool

Source

pub fn load_by_program( &self, ancestors: &Ancestors, bank_id: BankId, program_id: &Pubkey, config: &ScanConfig, ) -> ScanResult<Vec<TransactionAccount>>

Source

pub fn load_by_program_with_filter<F: Fn(&AccountSharedData) -> bool>( &self, ancestors: &Ancestors, bank_id: BankId, program_id: &Pubkey, filter: F, config: &ScanConfig, ) -> ScanResult<Vec<TransactionAccount>>

Source

pub fn load_by_index_key_with_filter<F: Fn(&AccountSharedData) -> bool>( &self, ancestors: &Ancestors, bank_id: BankId, index_key: &IndexKey, filter: F, config: &ScanConfig, byte_limit_for_scan: Option<usize>, ) -> ScanResult<Vec<TransactionAccount>>

Source

pub fn account_indexes_include_key(&self, key: &Pubkey) -> bool

Source

pub fn load_all( &self, ancestors: &Ancestors, bank_id: BankId, sort_results: bool, ) -> ScanResult<Vec<PubkeyAccountSlot>>

Source

pub fn scan_all<F>( &self, ancestors: &Ancestors, bank_id: BankId, scan_func: F, sort_results: bool, ) -> ScanResult<()>

Source

pub fn hold_range_in_memory<R>( &self, range: &R, start_holding: bool, thread_pool: &ThreadPool, )
where R: RangeBounds<Pubkey> + Debug + Sync,

Source

pub fn load_to_collect_rent_eagerly<R: RangeBounds<Pubkey> + Debug>( &self, ancestors: &Ancestors, range: R, ) -> Vec<PubkeyAccountSlot>

Source

pub fn store_slow_uncached( &self, slot: Slot, pubkey: &Pubkey, account: &AccountSharedData, )

Slow because lock is held for 1 operation instead of many. WARNING: This noncached version is only to be used for tests/benchmarking as bypassing the cache in general is not supported

Source

pub fn lock_accounts<'a, Tx: SVMMessage + 'a>( &self, txs: impl Iterator<Item = &'a Tx>, tx_account_lock_limit: usize, ) -> Vec<Result<()>>

This function will prevent multiple threads from modifying the same account state at the same time

Source

pub fn lock_accounts_with_results<'a>( &self, txs: impl Iterator<Item = &'a (impl SVMMessage + 'a)>, results: impl Iterator<Item = Result<()>>, tx_account_lock_limit: usize, ) -> Vec<Result<()>>

Source

pub fn unlock_accounts<'a, Tx: SVMMessage + 'a>( &self, txs_and_results: impl Iterator<Item = (&'a Tx, &'a Result<()>)> + Clone, )

Once accounts are unlocked, new transactions that modify that state can enter the pipeline

Source

pub fn store_cached<'a>( &self, accounts: impl StorableAccounts<'a>, transactions: Option<&'a [&'a SanitizedTransaction]>, )

Store the accounts into the DB

Source

pub fn store_accounts_cached<'a>(&self, accounts: impl StorableAccounts<'a>)

Source

pub fn add_root(&self, slot: Slot) -> AccountsAddRootTiming

Add a slot to root. Root slots cannot be purged

Trait Implementations§

Source§

impl Debug for Accounts

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize = _

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.
Source§

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

Source§

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
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T