pub struct StorableAccountsMovingSlots<'a, T: ReadableAccount + Sync> {
pub accounts: &'a [(&'a Pubkey, &'a T)],
pub target_slot: Slot,
pub old_slot: Slot,
}
Expand description
accounts that are moving from ‘old_slot’ to ‘target_slot’ since all accounts are from the same old slot, we don’t need to create a slice with per-account slot but, we need slot(_) to return ‘old_slot’ for all accounts Created a struct instead of a tuple to make the code easier to read.
Fields§
§accounts: &'a [(&'a Pubkey, &'a T)]
§target_slot: Slot
accounts will be written to this slot
old_slot: Slot
slot where accounts are currently stored
Trait Implementations§
source§impl<'a, T: ReadableAccount + Sync> StorableAccounts<'a, T> for StorableAccountsMovingSlots<'a, T>
impl<'a, T: ReadableAccount + Sync> StorableAccounts<'a, T> for StorableAccountsMovingSlots<'a, T>
fn slot(&self, _index: usize) -> Slot
source§fn target_slot(&self) -> Slot
fn target_slot(&self) -> Slot
slot that all accounts are to be written to
source§fn account_default_if_zero_lamport(&self, index: usize) -> Option<&T>
fn account_default_if_zero_lamport(&self, index: usize) -> Option<&T>
None if account is zero lamports
source§fn contains_multiple_slots(&self) -> bool
fn contains_multiple_slots(&self) -> bool
are there accounts from multiple slots
only used for an assert
source§fn has_hash_and_write_version(&self) -> bool
fn has_hash_and_write_version(&self) -> bool
true iff the impl can provide hash and write_version
Otherwise, hash and write_version have to be provided separately to store functions.
source§fn hash(&self, _index: usize) -> &AccountHash
fn hash(&self, _index: usize) -> &AccountHash
return hash for account at ‘index’
Should only be called if ‘has_hash_and_write_version’ = true
source§fn write_version(&self, _index: usize) -> u64
fn write_version(&self, _index: usize) -> u64
return write_version for account at ‘index’
Should only be called if ‘has_hash_and_write_version’ = true
Auto Trait Implementations§
impl<'a, T> Freeze for StorableAccountsMovingSlots<'a, T>
impl<'a, T> RefUnwindSafe for StorableAccountsMovingSlots<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for StorableAccountsMovingSlots<'a, T>
impl<'a, T> Sync for StorableAccountsMovingSlots<'a, T>
impl<'a, T> Unpin for StorableAccountsMovingSlots<'a, T>
impl<'a, T> UnwindSafe for StorableAccountsMovingSlots<'a, T>where
T: RefUnwindSafe,
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
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>
Converts
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>
Converts
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