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’
pub fn slot(&self) -> Slot
Auto Trait Implementations§
impl<'a> Freeze for AccountsToStore<'a>
impl<'a> RefUnwindSafe for AccountsToStore<'a>
impl<'a> Send for AccountsToStore<'a>
impl<'a> Sync for AccountsToStore<'a>
impl<'a> Unpin for AccountsToStore<'a>
impl<'a> UnwindSafe for AccountsToStore<'a>
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more