pub struct ProgramCacheEntry {
pub program: ProgramCacheEntryType,
pub account_owner: ProgramCacheEntryOwner,
pub account_size: usize,
pub deployment_slot: Slot,
pub effective_slot: Slot,
pub tx_usage_counter: AtomicU64,
pub ix_usage_counter: AtomicU64,
pub latest_access_slot: AtomicU64,
}
Expand description
Holds a program version at a specific address and on a specific slot / fork.
It contains the actual program in ProgramCacheEntryType and a bunch of meta-data.
Fields§
§program: ProgramCacheEntryType
The program of this entry
account_owner: ProgramCacheEntryOwner
The loader of this entry
account_size: usize
Size of account that stores the program and program data
deployment_slot: Slot
Slot in which the program was (re)deployed
effective_slot: Slot
Slot in which this entry will become active (can be in the future)
tx_usage_counter: AtomicU64
How often this entry was used by a transaction
ix_usage_counter: AtomicU64
How often this entry was used by an instruction
latest_access_slot: AtomicU64
Latest slot in which the entry was used
Implementations§
Source§impl ProgramCacheEntry
impl ProgramCacheEntry
Sourcepub fn new(
loader_key: &Pubkey,
program_runtime_environment: ProgramRuntimeEnvironment,
deployment_slot: Slot,
effective_slot: Slot,
elf_bytes: &[u8],
account_size: usize,
metrics: &mut LoadProgramMetrics,
) -> Result<Self, Box<dyn Error>>
pub fn new( loader_key: &Pubkey, program_runtime_environment: ProgramRuntimeEnvironment, deployment_slot: Slot, effective_slot: Slot, elf_bytes: &[u8], account_size: usize, metrics: &mut LoadProgramMetrics, ) -> Result<Self, Box<dyn Error>>
Creates a new user program
Sourcepub unsafe fn reload(
loader_key: &Pubkey,
program_runtime_environment: Arc<BuiltinProgram<InvokeContext<'static>>>,
deployment_slot: Slot,
effective_slot: Slot,
elf_bytes: &[u8],
account_size: usize,
metrics: &mut LoadProgramMetrics,
) -> Result<Self, Box<dyn Error>>
pub unsafe fn reload( loader_key: &Pubkey, program_runtime_environment: Arc<BuiltinProgram<InvokeContext<'static>>>, deployment_slot: Slot, effective_slot: Slot, elf_bytes: &[u8], account_size: usize, metrics: &mut LoadProgramMetrics, ) -> Result<Self, Box<dyn Error>>
Reloads a user program, without running the verifier.
§Safety
This method is unsafe since it assumes that the program has already been verified. Should
only be called when the program was previously verified and loaded in the cache, but was
unloaded due to inactivity. It should also be checked that the program_runtime_environment
hasn’t changed since it was unloaded.
pub fn to_unloaded(&self) -> Option<Self>
Sourcepub fn new_builtin(
deployment_slot: Slot,
account_size: usize,
builtin_function: BuiltinFunctionWithContext,
) -> Self
pub fn new_builtin( deployment_slot: Slot, account_size: usize, builtin_function: BuiltinFunctionWithContext, ) -> Self
Creates a new built-in program
pub fn new_tombstone( slot: Slot, account_owner: ProgramCacheEntryOwner, reason: ProgramCacheEntryType, ) -> Self
pub fn is_tombstone(&self) -> bool
pub fn update_access_slot(&self, slot: Slot)
pub fn decayed_usage_counter(&self, now: Slot) -> u64
pub fn account_owner(&self) -> Pubkey
Trait Implementations§
Source§impl Debug for ProgramCacheEntry
impl Debug for ProgramCacheEntry
Source§impl Default for ProgramCacheEntry
impl Default for ProgramCacheEntry
Source§fn default() -> ProgramCacheEntry
fn default() -> ProgramCacheEntry
Source§impl PartialEq for ProgramCacheEntry
impl PartialEq for ProgramCacheEntry
Auto Trait Implementations§
impl !Freeze for ProgramCacheEntry
impl RefUnwindSafe for ProgramCacheEntry
impl Send for ProgramCacheEntry
impl Sync for ProgramCacheEntry
impl Unpin for ProgramCacheEntry
impl !UnwindSafe for ProgramCacheEntry
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