pub struct PluginInternal {
pub reads: Vec<(MemAddr, Size)>,
pub writes: Vec<(MemAddr, Size)>,
pub consume_mailbox: bool,
}Expand description
Plugin internal computation descriptor
Corresponds to Lean: structure PluginInternal
Describes what a plugin’s internal WASM computation does:
- Memory regions read
- Memory regions written
- Whether to consume from mailbox
Fields§
§reads: Vec<(MemAddr, Size)>Memory regions read
Corresponds to Lean: reads : List (MemAddr x Size)
writes: Vec<(MemAddr, Size)>Memory regions written
Corresponds to Lean: writes : List (MemAddr x Size)
consume_mailbox: boolWhether to consume from mailbox
Corresponds to Lean: consume_mailbox : Bool
Implementations§
Source§impl PluginInternal
impl PluginInternal
Sourcepub fn new(
reads: Vec<(MemAddr, Size)>,
writes: Vec<(MemAddr, Size)>,
consume_mailbox: bool,
) -> Self
pub fn new( reads: Vec<(MemAddr, Size)>, writes: Vec<(MemAddr, Size)>, consume_mailbox: bool, ) -> Self
Create a new plugin internal computation descriptor
Sourcepub fn with_reads(reads: Vec<(MemAddr, Size)>) -> Self
pub fn with_reads(reads: Vec<(MemAddr, Size)>) -> Self
Create a computation that reads memory
Sourcepub fn with_writes(writes: Vec<(MemAddr, Size)>) -> Self
pub fn with_writes(writes: Vec<(MemAddr, Size)>) -> Self
Create a computation that writes memory
Sourcepub fn check_preconditions(
&self,
state: &State,
pid: PluginId,
) -> Result<(), StepError>
pub fn check_preconditions( &self, state: &State, pid: PluginId, ) -> Result<(), StepError>
Check preconditions for plugin internal execution
Corresponds to Lean: def plugin_internal_pre
Preconditions:
- Plugin is not blocked on another actor
- Read regions are in bounds
- Write regions are in bounds
- If consuming mailbox, mailbox must not be empty
§Errors
Returns StepError::PluginNotFound if the plugin does not exist.
Returns StepError::PluginPreconditionFailed if the plugin’s actor is blocked.
Returns StepError::PluginPreconditionFailed if a read region is out of bounds.
Returns StepError::PluginPreconditionFailed if a write region is out of bounds.
Returns StepError::PluginPreconditionFailed if consuming mailbox but the mailbox is empty.
Trait Implementations§
Source§impl Clone for PluginInternal
impl Clone for PluginInternal
Source§fn clone(&self) -> PluginInternal
fn clone(&self) -> PluginInternal
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more