Struct solana_runtime::accounts_db::AccountStorageEntry
source · pub struct AccountStorageEntry {
pub(crate) id: AtomicAppendVecId,
pub(crate) slot: AtomicU64,
pub(crate) accounts: AccountsFile,
count_and_status: RwLock<(usize, AccountStorageStatus)>,
approx_store_count: AtomicUsize,
alive_bytes: AtomicUsize,
}
Expand description
Persistent storage structure holding the accounts
Fields§
§id: AtomicAppendVecId
§slot: AtomicU64
§accounts: AccountsFile
storage holding the accounts
count_and_status: RwLock<(usize, AccountStorageStatus)>
Keeps track of the number of accounts stored in a specific AppendVec. This is periodically checked to reuse the stores that do not have any accounts in it status corresponding to the storage, lets us know that the append_vec, once maxed out, then emptied, can be reclaimed
approx_store_count: AtomicUsize
This is the total number of accounts stored ever since initialized to keep track of lifetime count of all store operations. And this differs from count_and_status in that this field won’t be decremented.
This is used as a rough estimate for slot shrinking. As such a relaxed use case, this value ARE NOT strictly synchronized with count_and_status!
alive_bytes: AtomicUsize
Implementations§
source§impl AccountStorageEntry
impl AccountStorageEntry
pub fn new(path: &Path, slot: Slot, id: AppendVecId, file_size: u64) -> Self
pub(crate) fn new_existing( slot: Slot, id: AppendVecId, accounts: AccountsFile, num_accounts: usize ) -> Self
pub fn set_status(&self, status: AccountStorageStatus)
pub fn recycle(&self, slot: Slot, id: AppendVecId)
pub fn status(&self) -> AccountStorageStatus
pub fn count(&self) -> usize
pub fn approx_stored_count(&self) -> usize
pub fn alive_bytes(&self) -> usize
pub fn written_bytes(&self) -> u64
pub fn capacity(&self) -> u64
pub fn has_accounts(&self) -> bool
pub fn slot(&self) -> Slot
pub fn append_vec_id(&self) -> AppendVecId
pub fn flush(&self) -> Result<(), IoError>
fn get_stored_account_meta( &self, offset: usize ) -> Option<StoredAccountMeta<'_>>
fn add_account(&self, num_bytes: usize)
fn try_available(&self) -> bool
pub fn all_accounts(&self) -> Vec<StoredAccountMeta<'_>>
fn remove_account(&self, num_bytes: usize, reset_accounts: bool) -> usize
pub fn get_path(&self) -> PathBuf
Trait Implementations§
source§impl Debug for AccountStorageEntry
impl Debug for AccountStorageEntry
source§impl From<&AccountStorageEntry> for SerializableAccountStorageEntry
impl From<&AccountStorageEntry> for SerializableAccountStorageEntry
source§fn from(rhs: &AccountStorageEntry) -> Self
fn from(rhs: &AccountStorageEntry) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl RefUnwindSafe for AccountStorageEntry
impl Send for AccountStorageEntry
impl Sync for AccountStorageEntry
impl Unpin for AccountStorageEntry
impl UnwindSafe for AccountStorageEntry
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
Mutably borrows from an owned value. Read more