Struct solana_runtime::accounts::Accounts [−][src]
pub struct Accounts {
pub accounts_db: Arc<AccountsDb>,
// some fields omitted
}
Expand description
This structure handles synchronization for db
Fields
accounts_db: Arc<AccountsDb>
Single global AccountsDb
Implementations
pub fn new_with_config_for_tests(
paths: Vec<PathBuf>,
cluster_type: &ClusterType,
account_indexes: AccountSecondaryIndexes,
caching_enabled: bool,
shrink_ratio: AccountShrinkThreshold
) -> Self
pub fn new_with_config_for_benches(
paths: Vec<PathBuf>,
cluster_type: &ClusterType,
account_indexes: AccountSecondaryIndexes,
caching_enabled: bool,
shrink_ratio: AccountShrinkThreshold
) -> Self
pub fn new_with_config(
paths: Vec<PathBuf>,
cluster_type: &ClusterType,
account_indexes: AccountSecondaryIndexes,
caching_enabled: bool,
shrink_ratio: AccountShrinkThreshold,
accounts_db_config: Option<AccountsDbConfig>,
accounts_update_notifier: Option<AccountsUpdateNotifier>
) -> Self
pub fn load_accounts(
&self,
ancestors: &Ancestors,
txs: &[SanitizedTransaction],
lock_results: Vec<TransactionCheckResult>,
hash_queue: &BlockhashQueue,
error_counters: &mut ErrorCounters,
rent_collector: &RentCollector,
feature_set: &FeatureSet
) -> Vec<TransactionLoadResult>ⓘ
pub fn load_with_fixed_root(
&self,
ancestors: &Ancestors,
pubkey: &Pubkey
) -> Option<(AccountSharedData, Slot)>
pub fn load_without_fixed_root(
&self,
ancestors: &Ancestors,
pubkey: &Pubkey
) -> Option<(AccountSharedData, Slot)>
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
pub fn load_by_program_slot(
&self,
slot: Slot,
program_id: Option<&Pubkey>
) -> Vec<(Pubkey, AccountSharedData)>ⓘ
pub fn load_largest_accounts(
&self,
ancestors: &Ancestors,
bank_id: BankId,
num: usize,
filter_by_address: &HashSet<Pubkey>,
filter: AccountAddressFilter
) -> ScanResult<Vec<(Pubkey, u64)>>
pub fn calculate_capitalization(
&self,
ancestors: &Ancestors,
slot: Slot,
can_cached_slot_be_unflushed: bool,
debug_verify: bool
) -> u64
Only called from startup or test code.
pub fn load_by_program(
&self,
ancestors: &Ancestors,
bank_id: BankId,
program_id: &Pubkey,
config: &ScanConfig
) -> ScanResult<Vec<(Pubkey, AccountSharedData)>>
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<(Pubkey, AccountSharedData)>>
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<(Pubkey, AccountSharedData)>>
pub fn load_all(
&self,
ancestors: &Ancestors,
bank_id: BankId
) -> ScanResult<Vec<(Pubkey, AccountSharedData, Slot)>>
pub fn hold_range_in_memory<R>(&self, range: &R, start_holding: bool) where
R: RangeBounds<Pubkey> + Debug,
pub fn load_to_collect_rent_eagerly<R: RangeBounds<Pubkey> + Debug>(
&self,
ancestors: &Ancestors,
range: R
) -> Vec<(Pubkey, 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
This function will prevent multiple threads from modifying the same account state at the same time
pub fn lock_accounts_with_results<'a>(
&self,
txs: impl Iterator<Item = &'a SanitizedTransaction>,
results: impl Iterator<Item = Result<()>>,
demote_program_write_locks: bool
) -> Vec<Result<()>>ⓘ
pub fn unlock_accounts<'a>(
&self,
txs: impl Iterator<Item = &'a SanitizedTransaction>,
results: &[Result<()>],
demote_program_write_locks: bool
)
pub fn unlock_accounts<'a>(
&self,
txs: impl Iterator<Item = &'a SanitizedTransaction>,
results: &[Result<()>],
demote_program_write_locks: bool
)
Once accounts are unlocked, new transactions that modify that state can enter the pipeline
pub fn store_cached<'a>(
&self,
slot: Slot,
txs: &'a [SanitizedTransaction],
res: &'a [TransactionExecutionResult],
loaded: &'a mut [TransactionLoadResult],
rent_collector: &RentCollector,
blockhash: &Hash,
lamports_per_signature: u64,
rent_for_sysvars: bool,
demote_program_write_locks: bool,
leave_nonce_on_success: bool
)
pub fn store_cached<'a>(
&self,
slot: Slot,
txs: &'a [SanitizedTransaction],
res: &'a [TransactionExecutionResult],
loaded: &'a mut [TransactionLoadResult],
rent_collector: &RentCollector,
blockhash: &Hash,
lamports_per_signature: u64,
rent_for_sysvars: bool,
demote_program_write_locks: bool,
leave_nonce_on_success: bool
)
Store the accounts into the DB
Purge a slot if it is not a root
Root slots cannot be purged
is_from_abs
is true if the caller is the AccountsBackgroundService
Add a slot to root. Root slots cannot be purged
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Accounts
impl !UnwindSafe for Accounts
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more