pub struct ProgramCacheForTxBatch {
pub environments: ProgramRuntimeEnvironments,
pub upcoming_environments: Option<ProgramRuntimeEnvironments>,
pub latest_root_epoch: Epoch,
pub hit_max_limit: bool,
pub loaded_missing: bool,
pub merged_modified: bool,
/* private fields */
}
Expand description
Local view into ProgramCache which was extracted for a specific TX batch.
This isolation enables the global ProgramCache to continue to evolve (e.g. evictions), while the TX batch is guaranteed it will continue to find all the programs it requires. For program management instructions this also buffers them before they are merged back into the global ProgramCache.
Fields§
§environments: ProgramRuntimeEnvironments
§upcoming_environments: Option<ProgramRuntimeEnvironments>
Anticipated replacement for environments
at the next epoch.
This is None
during most of an epoch, and only Some
around the boundaries (at the end and beginning of an epoch).
More precisely, it starts with the cache preparation phase a few hundred slots before the epoch boundary,
and it ends with the first rerooting after the epoch boundary.
Needed when a program is deployed at the last slot of an epoch, becomes effective in the next epoch.
So needs to be compiled with the environment for the next epoch.
latest_root_epoch: Epoch
The epoch of the last rerooting
hit_max_limit: bool
§loaded_missing: bool
§merged_modified: bool
Implementations§
Source§impl ProgramCacheForTxBatch
impl ProgramCacheForTxBatch
pub fn new( slot: Slot, environments: ProgramRuntimeEnvironments, upcoming_environments: Option<ProgramRuntimeEnvironments>, latest_root_epoch: Epoch, ) -> Self
pub fn new_from_cache<FG: ForkGraph>( slot: Slot, epoch: Epoch, cache: &ProgramCache<FG>, ) -> Self
Sourcepub fn get_environments_for_epoch(
&self,
epoch: Epoch,
) -> &ProgramRuntimeEnvironments
pub fn get_environments_for_epoch( &self, epoch: Epoch, ) -> &ProgramRuntimeEnvironments
Returns the current environments depending on the given epoch
Sourcepub fn replenish(
&mut self,
key: Pubkey,
entry: Arc<ProgramCacheEntry>,
) -> (bool, Arc<ProgramCacheEntry>)
pub fn replenish( &mut self, key: Pubkey, entry: Arc<ProgramCacheEntry>, ) -> (bool, Arc<ProgramCacheEntry>)
Refill the cache with a single entry. It’s typically called during transaction loading, and
transaction processing (for program management instructions).
It replaces the existing entry (if any) with the provided entry. The return value contains
true
if an entry existed.
The function also returns the newly inserted value.
Sourcepub fn store_modified_entry(
&mut self,
key: Pubkey,
entry: Arc<ProgramCacheEntry>,
)
pub fn store_modified_entry( &mut self, key: Pubkey, entry: Arc<ProgramCacheEntry>, )
Store an entry in modified_entries
for a program modified during the
transaction batch.
Sourcepub fn drain_modified_entries(
&mut self,
) -> HashMap<Pubkey, Arc<ProgramCacheEntry>>
pub fn drain_modified_entries( &mut self, ) -> HashMap<Pubkey, Arc<ProgramCacheEntry>>
Drain the program cache’s modified entries, returning the owned collection.
pub fn find(&self, key: &Pubkey) -> Option<Arc<ProgramCacheEntry>>
pub fn slot(&self) -> Slot
pub fn set_slot_for_tests(&mut self, slot: Slot)
pub fn merge( &mut self, modified_entries: &HashMap<Pubkey, Arc<ProgramCacheEntry>>, )
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Clone for ProgramCacheForTxBatch
impl Clone for ProgramCacheForTxBatch
Source§fn clone(&self) -> ProgramCacheForTxBatch
fn clone(&self) -> ProgramCacheForTxBatch
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ProgramCacheForTxBatch
impl Debug for ProgramCacheForTxBatch
Source§impl Default for ProgramCacheForTxBatch
impl Default for ProgramCacheForTxBatch
Source§fn default() -> ProgramCacheForTxBatch
fn default() -> ProgramCacheForTxBatch
Auto Trait Implementations§
impl Freeze for ProgramCacheForTxBatch
impl RefUnwindSafe for ProgramCacheForTxBatch
impl Send for ProgramCacheForTxBatch
impl Sync for ProgramCacheForTxBatch
impl Unpin for ProgramCacheForTxBatch
impl UnwindSafe for ProgramCacheForTxBatch
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> 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