[][src]Struct solana_runtime::accounts::Accounts

pub struct Accounts {
    pub accounts_db: Arc<AccountsDB>,
    // some fields omitted
}

This structure handles synchronization for db

Fields

accounts_db: Arc<AccountsDB>

Single global AccountsDB

Methods

impl Accounts[src]

pub fn new(paths: Option<String>) -> Self[src]

pub fn new_from_parent(parent: &Accounts) -> Self[src]

pub fn update_from_stream<R: Read>(
    &self,
    stream: &mut BufReader<R>
) -> Result<(), Error>
[src]

pub fn load_accounts(
    &self,
    ancestors: &HashMap<Fork, usize>,
    txs: &[Transaction],
    lock_results: Vec<Result<()>>,
    hash_queue: &BlockhashQueue,
    error_counters: &mut ErrorCounters
) -> Vec<Result<(InstructionAccounts, InstructionLoaders, InstructionCredits)>>
[src]

pub fn load_slow(
    &self,
    ancestors: &HashMap<Fork, usize>,
    pubkey: &Pubkey
) -> Option<(Account, Fork)>
[src]

Slow because lock is held for 1 operation instead of many

pub fn load_by_program_fork(
    &self,
    fork: Fork,
    program_id: &Pubkey
) -> Vec<(Pubkey, Account)>
[src]

pub fn load_by_program(
    &self,
    ancestors: &HashMap<Fork, usize>,
    program_id: &Pubkey
) -> Vec<(Pubkey, Account)>
[src]

pub fn store_slow(&self, fork: Fork, pubkey: &Pubkey, account: &Account)[src]

Slow because lock is held for 1 operation instead of many

pub fn hash_internal_state(&self, fork_id: Fork) -> Option<Hash>[src]

#[must_use] pub fn lock_accounts(&self, txs: &[Transaction]) -> Vec<Result<()>>[src]

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

pub fn unlock_accounts(&self, txs: &[Transaction], results: &[Result<()>])[src]

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

pub fn has_accounts(&self, fork: Fork) -> bool[src]

pub fn store_accounts(
    &self,
    fork: Fork,
    txs: &[Transaction],
    res: &[Result<()>],
    loaded: &mut [Result<(InstructionAccounts, InstructionLoaders, InstructionCredits)>]
)
[src]

Store the accounts into the DB

pub fn purge_fork(&self, fork: Fork)[src]

Purge a fork if it is not a root Root forks cannot be purged

pub fn add_root(&self, fork: Fork)[src]

Add a fork to root. Root forks cannot be purged

pub fn commit_credits(&self, ancestors: &HashMap<Fork, usize>, fork: Fork)[src]

Commit remaining credit-only changes, regardless of reference count

We do a take() on self.credit_only_account_locks so that the hashmap is no longer available to be written to. This prevents any transactions from reinserting into the hashmap. Then there are then only 2 cases for interleaving with commit_credits and lock_accounts. Either:

pub fn commit_credits_unsafe(
    &self,
    ancestors: &HashMap<Fork, usize>,
    fork: Fork
)
[src]

Used only for tests to store credit-only accounts after every transaction

Trait Implementations

impl Default for Accounts[src]

impl Debug for Accounts[src]

Auto Trait Implementations

impl Unpin for Accounts

impl Send for Accounts

impl Sync for Accounts

impl !RefUnwindSafe for Accounts

impl !UnwindSafe for Accounts

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Typeable for T where
    T: Any

fn get_type(&self) -> TypeId

Get the TypeId of this object.

impl<T> Clear for T where
    T: InitializableFromZeroed + ?Sized

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> InitializableFromZeroed for T where
    T: Default

impl<T> Erased for T

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

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