solana_program_runtime::loaded_programs

Struct LoadedProgram

source
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: 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 an instruction

§latest_access_slot: AtomicU64

Latest slot in which the entry was used

Implementations§

source§

impl LoadedProgram

source

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

source

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.

source

pub fn to_unloaded(&self) -> Option<Self>

source

pub fn new_builtin( deployment_slot: Slot, account_size: usize, builtin_function: BuiltinFunctionWithContext, ) -> Self

Creates a new built-in program

source

pub fn new_tombstone(slot: Slot, reason: LoadedProgramType) -> Self

source

pub fn is_tombstone(&self) -> bool

source

pub fn update_access_slot(&self, slot: Slot)

source

pub fn decayed_usage_counter(&self, now: Slot) -> u64

Trait Implementations§

source§

impl AbiExample for LoadedProgram

source§

fn example() -> Self

source§

impl Debug for LoadedProgram

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for LoadedProgram

source§

fn default() -> LoadedProgram

Returns the “default value” for a type. Read more
source§

impl PartialEq for LoadedProgram

source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> AbiExample for T

source§

default fn example() -> T

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
source§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more