pub struct Accounts {
pub accounts_db: Arc<AccountsDb>,
/* private fields */
}agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.Expand description
This structure handles synchronization for db
Fields§
§accounts_db: Arc<AccountsDb>agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.Single global AccountsDb
Implementations§
Source§impl Accounts
impl Accounts
pub fn new(accounts_db: Arc<AccountsDb>) -> Self
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.Sourcepub fn load_lookup_table_addresses(
&self,
ancestors: &Ancestors,
address_table_lookup: SVMMessageAddressTableLookup<'_>,
slot_hashes: &SlotHashes,
) -> Result<(LoadedAddresses, Slot), AddressLookupError>
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn load_lookup_table_addresses( &self, ancestors: &Ancestors, address_table_lookup: SVMMessageAddressTableLookup<'_>, slot_hashes: &SlotHashes, ) -> Result<(LoadedAddresses, Slot), AddressLookupError>
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.Return loaded addresses and the deactivation slot.
If the table hasn’t been deactivated, the deactivation slot is u64::MAX.
Sourcepub fn load_lookup_table_addresses_into(
&self,
ancestors: &Ancestors,
address_table_lookup: SVMMessageAddressTableLookup<'_>,
slot_hashes: &SlotHashes,
loaded_addresses: &mut LoadedAddresses,
) -> Result<Slot, AddressLookupError>
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn load_lookup_table_addresses_into( &self, ancestors: &Ancestors, address_table_lookup: SVMMessageAddressTableLookup<'_>, slot_hashes: &SlotHashes, loaded_addresses: &mut LoadedAddresses, ) -> Result<Slot, AddressLookupError>
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.Fill loaded_addresses and return the deactivation slot.
If no tables are de-activating, the deactivation slot is u64::MAX.
pub fn load_with_fixed_root( &self, ancestors: &Ancestors, pubkey: &Pubkey, ) -> Option<(AccountSharedData, Slot)>
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.Sourcepub fn load_with_fixed_root_do_not_populate_read_cache(
&self,
ancestors: &Ancestors,
pubkey: &Pubkey,
) -> Option<(AccountSharedData, Slot)>
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn load_with_fixed_root_do_not_populate_read_cache( &self, ancestors: &Ancestors, pubkey: &Pubkey, ) -> Option<(AccountSharedData, Slot)>
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.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
pub fn load_without_fixed_root( &self, ancestors: &Ancestors, pubkey: &Pubkey, ) -> Option<(AccountSharedData, Slot)>
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.Sourcepub fn scan_slot<F, B>(&self, slot: Slot, func: F) -> Vec<B>
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn scan_slot<F, B>(&self, slot: Slot, func: F) -> Vec<B>
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.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
Sourcepub fn load_by_program_slot(
&self,
slot: Slot,
program_id: Option<&Pubkey>,
) -> Vec<KeyedAccountSharedData> ⓘ
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn load_by_program_slot( &self, slot: Slot, program_id: Option<&Pubkey>, ) -> Vec<KeyedAccountSharedData> ⓘ
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.Returns all the accounts from slot
If program_id is Some, filter the results to those whose owner matches program_id
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)>>
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.pub fn load_by_program( &self, ancestors: &Ancestors, bank_id: BankId, program_id: &Pubkey, config: &ScanConfig, ) -> ScanResult<Vec<KeyedAccountSharedData>>
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.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<KeyedAccountSharedData>>
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.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<KeyedAccountSharedData>>
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.pub fn account_indexes_include_key(&self, key: &Pubkey) -> bool
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.pub fn load_all( &self, ancestors: &Ancestors, bank_id: BankId, sort_results: bool, ) -> ScanResult<Vec<PubkeyAccountSlot>>
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.pub fn scan_all<F>( &self, ancestors: &Ancestors, bank_id: BankId, scan_func: F, sort_results: bool, ) -> ScanResult<()>
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.Sourcepub fn lock_accounts<'a>(
&self,
txs: impl Iterator<Item = &'a (impl SVMMessage + 'a)>,
results: impl Iterator<Item = Result<()>>,
tx_account_lock_limit: usize,
relax_intrabatch_account_locks: bool,
) -> Vec<Result<()>> ⓘ
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn lock_accounts<'a>( &self, txs: impl Iterator<Item = &'a (impl SVMMessage + 'a)>, results: impl Iterator<Item = Result<()>>, tx_account_lock_limit: usize, relax_intrabatch_account_locks: bool, ) -> Vec<Result<()>> ⓘ
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.This function will prevent multiple threads from modifying the same account state at the same time, possibly excluding transactions based on prior results
Sourcepub fn unlock_accounts<'a, Tx: SVMMessage + 'a>(
&self,
txs_and_results: impl Iterator<Item = (&'a Tx, &'a Result<()>)> + Clone,
)
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn unlock_accounts<'a, Tx: SVMMessage + 'a>( &self, txs_and_results: impl Iterator<Item = (&'a Tx, &'a Result<()>)> + Clone, )
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.Once accounts are unlocked, new transactions that modify that state can enter the pipeline
Sourcepub fn store_accounts_seq<'a>(
&self,
accounts: impl StorableAccounts<'a>,
transactions: Option<&'a [&'a SanitizedTransaction]>,
)
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn store_accounts_seq<'a>( &self, accounts: impl StorableAccounts<'a>, transactions: Option<&'a [&'a SanitizedTransaction]>, )
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.Store accounts into the DB
This version updates the accounts index sequentially, using the same thread that calls the fn itself.
Sourcepub fn store_accounts_par<'a>(
&self,
accounts: impl StorableAccounts<'a>,
transactions: Option<&'a [&'a SanitizedTransaction]>,
)
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn store_accounts_par<'a>( &self, accounts: impl StorableAccounts<'a>, transactions: Option<&'a [&'a SanitizedTransaction]>, )
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.Store accounts into the DB
This version updates the accounts index in parallel, using the foreground AccountsDb thread pool.
Sourcepub fn add_root(&self, slot: Slot) -> AccountsAddRootTiming
👎Deprecated since 3.1.0: This crate has been marked for formal inclusion in the Agave Unstable API. From v4.0.0 onward, the agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.
pub fn add_root(&self, slot: Slot) -> AccountsAddRootTiming
agave-unstable-api crate feature must be specified to acknowledge use of an interface that may break without warning.Add a slot to root. Root slots cannot be purged
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Accounts
impl !RefUnwindSafe for Accounts
impl Send for Accounts
impl Sync for Accounts
impl Unpin for Accounts
impl !UnwindSafe for Accounts
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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