pub struct LoadedProgram {
pub program: LoadedProgramType,
pub account_size: usize,
pub deployment_slot: Slot,
pub effective_slot: Slot,
pub maybe_expiration_slot: Option<Slot>,
pub tx_usage_counter: AtomicU64,
pub ix_usage_counter: AtomicU64,
pub latest_access_slot: AtomicU64,
}Fields§
§program: LoadedProgramTypeThe program of this entry
account_size: usizeSize of account that stores the program and program data
deployment_slot: SlotSlot in which the program was (re)deployed
effective_slot: SlotSlot in which this entry will become active (can be in the future)
maybe_expiration_slot: Option<Slot>Optional expiration slot for this entry, after which it is treated as non-existent
tx_usage_counter: AtomicU64How often this entry was used by a transaction
ix_usage_counter: AtomicU64How often this entry was used by an instruction
latest_access_slot: AtomicU64Latest slot in which the entry was used
Implementations§
source§impl LoadedProgram
impl LoadedProgram
sourcepub fn new(
loader_key: &Pubkey,
program_runtime_environment: ProgramRuntimeEnvironment,
deployment_slot: Slot,
effective_slot: Slot,
maybe_expiration_slot: Option<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, maybe_expiration_slot: Option<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,
maybe_expiration_slot: Option<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, maybe_expiration_slot: Option<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, reason: LoadedProgramType) -> Self
pub fn is_tombstone(&self) -> bool
pub fn update_access_slot(&self, slot: Slot)
pub fn decayed_usage_counter(&self, now: Slot) -> u64
Trait Implementations§
source§impl AbiExample for LoadedProgram
impl AbiExample for LoadedProgram
source§impl Debug for LoadedProgram
impl Debug for LoadedProgram
source§impl Default for LoadedProgram
impl Default for LoadedProgram
source§fn default() -> LoadedProgram
fn default() -> LoadedProgram
source§impl PartialEq for LoadedProgram
impl PartialEq for LoadedProgram
Auto Trait Implementations§
impl !Freeze for LoadedProgram
impl RefUnwindSafe for LoadedProgram
impl Send for LoadedProgram
impl Sync for LoadedProgram
impl Unpin for LoadedProgram
impl !UnwindSafe for LoadedProgram
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