pub struct AccountsToStore<'a> { /* private fields */ }
Expand description
reference a set of accounts to store The accounts may have to be split between 2 storages (primary and overflow) if there is not enough room in the primary storage. The ‘store’ functions need data stored in a slice of specific type. We need 1-2 of these slices constructed based on available bytes and individual account sizes. The slice arithmetic across both hashes and account data gets messy. So, this struct abstracts that.
Implementations§
source§impl<'a> AccountsToStore<'a>
impl<'a> AccountsToStore<'a>
sourcepub fn new(
available_bytes: u64,
accounts: &'a [&'a StoredAccountMeta<'a>],
alive_total_bytes: usize,
slot: Slot
) -> Self
pub fn new( available_bytes: u64, accounts: &'a [&'a StoredAccountMeta<'a>], alive_total_bytes: usize, slot: Slot ) -> Self
break ‘stored_accounts’ into primary and overflow available_bytes: how many bytes remain in the primary storage. Excess accounts will be directed to an overflow storage
sourcepub fn has_overflow(&self) -> bool
pub fn has_overflow(&self) -> bool
true if a request to ‘get’ ‘Overflow’ would return accounts & hashes
sourcepub fn get_bytes(&self, selector: StorageSelector) -> usize
pub fn get_bytes(&self, selector: StorageSelector) -> usize
return # required bytes for the given selector
sourcepub fn get(&self, storage: StorageSelector) -> &[&'a StoredAccountMeta<'a>]
pub fn get(&self, storage: StorageSelector) -> &[&'a StoredAccountMeta<'a>]
get the accounts to store in the given ‘storage’