Trait linera_execution::ContractRuntime
source · pub trait ContractRuntime: BaseRuntime {
// Required methods
fn remaining_fuel(&self) -> u64;
fn set_remaining_fuel(&self, remaining_fuel: u64);
fn try_read_and_lock_my_state<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, ExecutionError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn save_and_unlock_my_state(
&self,
state: Vec<u8>
) -> Result<(), ExecutionError>;
fn unlock_my_state(&self);
fn write_batch_and_unlock<'life0, 'async_trait>(
&'life0 self,
batch: Batch
) -> Pin<Box<dyn Future<Output = Result<(), ExecutionError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn try_call_application<'life0, 'life1, 'async_trait>(
&'life0 self,
authenticated: bool,
callee_id: UserApplicationId,
argument: &'life1 [u8],
forwarded_sessions: Vec<SessionId>
) -> Pin<Box<dyn Future<Output = Result<CallResult, ExecutionError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn try_call_session<'life0, 'life1, 'async_trait>(
&'life0 self,
authenticated: bool,
session_id: SessionId,
argument: &'life1 [u8],
forwarded_sessions: Vec<SessionId>
) -> Pin<Box<dyn Future<Output = Result<CallResult, ExecutionError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}
Required Methods§
sourcefn remaining_fuel(&self) -> u64
fn remaining_fuel(&self) -> u64
Returns the amount of execution fuel remaining before execution is aborted.
sourcefn set_remaining_fuel(&self, remaining_fuel: u64)
fn set_remaining_fuel(&self, remaining_fuel: u64)
Sets the amount of execution fuel remaining before execution is aborted.
sourcefn try_read_and_lock_my_state<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, ExecutionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn try_read_and_lock_my_state<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, ExecutionError>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Reads the application state and prevents further reading/loading until the state is saved.
sourcefn save_and_unlock_my_state(&self, state: Vec<u8>) -> Result<(), ExecutionError>
fn save_and_unlock_my_state(&self, state: Vec<u8>) -> Result<(), ExecutionError>
Saves the application state and allows reading/loading the state again.
sourcefn unlock_my_state(&self)
fn unlock_my_state(&self)
Allows reading/loading the state again (without saving anything).
sourcefn write_batch_and_unlock<'life0, 'async_trait>(
&'life0 self,
batch: Batch
) -> Pin<Box<dyn Future<Output = Result<(), ExecutionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn write_batch_and_unlock<'life0, 'async_trait>( &'life0 self, batch: Batch ) -> Pin<Box<dyn Future<Output = Result<(), ExecutionError>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Writes the batch and then unlock
sourcefn try_call_application<'life0, 'life1, 'async_trait>(
&'life0 self,
authenticated: bool,
callee_id: UserApplicationId,
argument: &'life1 [u8],
forwarded_sessions: Vec<SessionId>
) -> Pin<Box<dyn Future<Output = Result<CallResult, ExecutionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn try_call_application<'life0, 'life1, 'async_trait>( &'life0 self, authenticated: bool, callee_id: UserApplicationId, argument: &'life1 [u8], forwarded_sessions: Vec<SessionId> ) -> Pin<Box<dyn Future<Output = Result<CallResult, ExecutionError>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Calls another application. Forwarded sessions will now be visible to
callee_id
(but not to the caller any more).
sourcefn try_call_session<'life0, 'life1, 'async_trait>(
&'life0 self,
authenticated: bool,
session_id: SessionId,
argument: &'life1 [u8],
forwarded_sessions: Vec<SessionId>
) -> Pin<Box<dyn Future<Output = Result<CallResult, ExecutionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn try_call_session<'life0, 'life1, 'async_trait>( &'life0 self, authenticated: bool, session_id: SessionId, argument: &'life1 [u8], forwarded_sessions: Vec<SessionId> ) -> Pin<Box<dyn Future<Output = Result<CallResult, ExecutionError>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Calls into a session that is in our scope. Forwarded sessions will be visible to
the application that runs session_id
.