[][src]Struct solana_libra_vm_runtime::txn_executor::TransactionExecutor

pub struct TransactionExecutor<'alloc, 'txn, P> where
    'alloc: 'txn,
    P: ModuleCache<'alloc>, 
{ /* fields omitted */ }

A struct that executes one single transaction. 'alloc is the lifetime for the code cache, which is the argument type P here. Hence the P should live as long as alloc. 'txn is the lifetime of one single transaction. execution_stack contains the call stack and value stack of current execution. txn_data contains the information of this transaction, such as sender, sequence number, etc. event_data is the vector that stores all events emitted during execution. data_view is the scratchpad for the local writes emitted by this transaction.

Methods

impl<'alloc, 'txn, P> TransactionExecutor<'alloc, 'txn, P> where
    'alloc: 'txn,
    P: ModuleCache<'alloc>, 
[src]

pub fn new(
    module_cache: P,
    data_cache: &'txn dyn RemoteCache,
    txn_data: TransactionMetadata
) -> Self
[src]

Create a new TransactionExecutor to execute a single transaction. module_cache is the cache that stores the modules previously read from the blockchain. data_cache is the cache that holds read-only connection to the state store as well as the changes made by previous transactions within the same block.

pub fn module_cache(&self) -> &P[src]

Returns the module cache for this executor.

pub fn execute_block(
    &mut self,
    code: &[Bytecode],
    beginning_offset: CodeOffset
) -> VMResult<CodeOffset>
[src]

This function will execute the code sequence starting from the beginning_offset, and return Ok(Ok(offset)) when the instruction sequence hit a branch, either by calling into a new function, branches, function return, etc. The return value will be the pc for the next instruction to be executed.

pub fn create_account(&mut self, addr: AccountAddress) -> VMResult<()>[src]

Create an account on the blockchain by calling into CREATE_ACCOUNT_NAME function stored in the ACCOUNT_MODULE on chain.

pub fn execute_function(
    &mut self,
    module: &ModuleId,
    function_name: &str,
    args: Vec<Local>
) -> VMResult<()>
[src]

Execute a function. module is an identifier for the name the module is stored in. function_name is the name of the function. If such function is found, the VM will execute this function with arguments args. The return value will be placed on the top of the value stack and abort if an error occurs.

pub fn pop_stack(&mut self) -> Result<Local, VMInvariantViolation>[src]

Get the value on the top of the value stack.

pub fn make_write_set(
    &mut self,
    to_be_published_modules: Vec<(ModuleId, Vec<u8>)>,
    result: VMResult<()>
) -> VMRuntimeResult<TransactionOutput>
[src]

Produce a write set at the end of a transaction. This will clear all the local states in the TransactionProcessor and turn them into a writeset.

Auto Trait Implementations

impl<'alloc, 'txn, P> !Sync for TransactionExecutor<'alloc, 'txn, P>

impl<'alloc, 'txn, P> !Send for TransactionExecutor<'alloc, 'txn, P>

impl<'alloc, 'txn, P> Unpin for TransactionExecutor<'alloc, 'txn, P> where
    P: Unpin

impl<'alloc, 'txn, P> !RefUnwindSafe for TransactionExecutor<'alloc, 'txn, P>

impl<'alloc, 'txn, P> !UnwindSafe for TransactionExecutor<'alloc, 'txn, P>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

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

impl<T> Erased for T

impl<T> Erased for T

impl<T> Typeable for T where
    T: Any

fn get_type(&self) -> TypeId

Get the TypeId of this object.