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,
}
Fields§
§program: LoadedProgramType
The program 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)
maybe_expiration_slot: Option<Slot>
Optional expiration slot for this entry, after which it is treated as non-existent
tx_usage_counter: AtomicU64
How often this entry was used by a transaction
ix_usage_counter: AtomicU64
How often this entry was used by a transaction
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