pub struct StakeCacheData {
pub stake_accounts: HashMap<Pubkey, Option<StakeAccount>>,
pub validator_accounts: HashMap<Pubkey, Option<ValidatorAccount>>,
pub epoch: Epoch,
pub timestamp: u64,
pub modified_stake_pubkeys: HashSet<Pubkey>,
pub modified_validator_pubkeys: HashSet<Pubkey>,
}Expand description
Data structure holding the cached stake and validator accounts.
Uses HashMap<Pubkey, Option<T>> to support the delta-based persistence model:
Some(account)= account was added or updatedNone= account was deleted (tombstone)
In baseline, values are always Some(...) since it represents complete state.
In pending and frozen deltas, None indicates deletion.
Fields§
§stake_accounts: HashMap<Pubkey, Option<StakeAccount>>Map of stake accounts by public key.
None value indicates a tombstone (account was deleted during this epoch).
validator_accounts: HashMap<Pubkey, Option<ValidatorAccount>>Map of validator accounts by public key.
None value indicates a tombstone (account was deleted during this epoch).
epoch: EpochThe epoch counter when this snapshot was taken.
timestamp: u64The block’s Unix timestamp (in milliseconds) when this snapshot was taken. This is set when FreezeStakes is called and represents the epoch boundary.
modified_stake_pubkeys: HashSet<Pubkey>Set of stake account pubkeys modified during the current block.
Used to track which accounts need to be persisted to the deltas CF.
This is cleared after each finalize() call.
modified_validator_pubkeys: HashSet<Pubkey>Set of validator account pubkeys modified during the current block.
Used to track which accounts need to be persisted to the deltas CF.
This is cleared after each finalize() call.
Implementations§
Source§impl StakeCacheData
impl StakeCacheData
Sourcepub fn drain_modified(&mut self) -> (HashSet<Pubkey>, HashSet<Pubkey>)
pub fn drain_modified(&mut self) -> (HashSet<Pubkey>, HashSet<Pubkey>)
Drain the modified pubkey sets, returning the pubkeys and clearing the sets.
This is called by StateStore::finalize() to get the list of accounts
that need to be persisted to the deltas CF. After this call, both
modified_stake_pubkeys and modified_validator_pubkeys will be empty.
Returns a tuple of (stake_pubkeys, validator_pubkeys).
Sourcepub fn has_modified(&self) -> bool
pub fn has_modified(&self) -> bool
Check if there are any modified accounts pending persistence.
Trait Implementations§
Source§impl Clone for StakeCacheData
impl Clone for StakeCacheData
Source§fn clone(&self) -> StakeCacheData
fn clone(&self) -> StakeCacheData
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StakeCacheData
impl Debug for StakeCacheData
Source§impl Default for StakeCacheData
impl Default for StakeCacheData
Source§fn default() -> StakeCacheData
fn default() -> StakeCacheData
Auto Trait Implementations§
impl Freeze for StakeCacheData
impl RefUnwindSafe for StakeCacheData
impl Send for StakeCacheData
impl Sync for StakeCacheData
impl Unpin for StakeCacheData
impl UnsafeUnpin for StakeCacheData
impl UnwindSafe for StakeCacheData
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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