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 default_for_tests() -> Self

source

pub fn new_with_config_for_tests(
paths: Vec<PathBuf>,
cluster_type: &ClusterType,
account_indexes: AccountSecondaryIndexes,
caching_enabled: bool,
shrink_ratio: AccountShrinkThreshold
) -> Self

source

pub fn new_with_config_for_benches(
paths: Vec<PathBuf>,
cluster_type: &ClusterType,
account_indexes: AccountSecondaryIndexes,
caching_enabled: bool,
shrink_ratio: AccountShrinkThreshold
) -> Self

source

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

source

pub fn new_from_parent(parent: &Accounts, slot: Slot, parent_slot: Slot) -> Self

source

pub fn load_accounts(
&self,
ancestors: &Ancestors,
txs: &[SanitizedTransaction],
lock_results: Vec<TransactionCheckResult>,
hash_queue: &BlockhashQueue,
error_counters: &mut TransactionErrorMetrics,
rent_collector: &RentCollector,
feature_set: &FeatureSet,
fee_structure: &FeeStructure,
account_overrides: Option<&AccountOverrides>
) -> Vec<TransactionLoadResult>

source

pub fn load_lookup_table_addresses(
&self,
ancestors: &Ancestors,
address_table_lookup: &MessageAddressTableLookup,
slot_hashes: &SlotHashes,
load_zero_lamports: LoadZeroLamports
) -> Result<LoadedAddresses, AddressLookupError>

source

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

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>

source

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

source

pub fn calculate_capitalization(
&self,
ancestors: &Ancestors,
slot: Slot,
can_cached_slot_be_unflushed: bool,
debug_verify: bool,
epoch_schedule: &EpochSchedule,
rent_collector: &RentCollector
) -> u64

only called at startup vs steady-state runtime

source

pub fn verify_bank_hash_and_lamports(
&self,
slot: Slot,
ancestors: &Ancestors,
total_lamports: u64,
test_hash_calculation: bool,
epoch_schedule: &EpochSchedule,
rent_collector: &RentCollector,
can_cached_slot_be_unflushed: bool,
ignore_mismatch: bool,
store_detailed_debug_info: bool,
use_bg_thread_pool: bool
) -> bool

Only called from startup or test code.

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
) -> ScanResult<Vec<PubkeyAccountSlot>>

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 bank_hash_at(&self, slot: Slot, rewrites: &Rewrites) -> Hash

source

pub fn bank_hash_info_at(&self, slot: Slot, rewrites: &Rewrites) -> BankHashInfo

source

pub fn lock_accounts<'a>(
&self,
txs: impl Iterator<Item = &'a SanitizedTransaction>,
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 SanitizedTransaction>,
results: impl Iterator<Item = &'a Result<()>>,
tx_account_lock_limit: usize
) -> Vec<Result<()>>

source

pub fn unlock_accounts<'a>(
&self,
txs: impl Iterator<Item = &'a SanitizedTransaction>,
results: &[Result<()>]
)

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

source

pub fn store_accounts_cached<'a, T: ReadableAccount + Sync + ZeroLamport>(
&self,
accounts: impl StorableAccounts<'a, T>
)

source

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

Add a slot to root. Root slots cannot be purged

Trait Implementations§

source§

impl AbiExample for Accounts

source§

fn example() -> Self

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> 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,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · 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>,

const: unstable · 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.
const: unstable · 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.
const: unstable · 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