Trait move_vm_types::data_store::DataStore
source · pub trait DataStore {
// Required methods
fn load_resource(
&mut self,
addr: AccountAddress,
ty: &Type
) -> PartialVMResult<&mut GlobalValue>;
fn load_module(&self, module_id: &ModuleId) -> VMResult<Vec<u8>>;
fn publish_module(
&mut self,
module_id: &ModuleId,
blob: Vec<u8>
) -> VMResult<()>;
fn exists_module(&self, module_id: &ModuleId) -> VMResult<bool>;
fn emit_event(
&mut self,
guid: Vec<u8>,
seq_num: u64,
ty: Type,
val: Value
) -> PartialVMResult<()>;
}
Expand description
Provide an implementation for bytecodes related to data with a given data store.
The DataStore
is a generic concept that includes both data and events.
A default implementation of the DataStore
is TransactionDataCache
which provides
an in memory cache for a given transaction and the atomic transactional changes
proper of a script execution (transaction).
Required Methods§
sourcefn load_resource(
&mut self,
addr: AccountAddress,
ty: &Type
) -> PartialVMResult<&mut GlobalValue>
fn load_resource( &mut self, addr: AccountAddress, ty: &Type ) -> PartialVMResult<&mut GlobalValue>
Try to load a resource from remote storage and create a corresponding GlobalValue that is owned by the data store.
sourcefn load_module(&self, module_id: &ModuleId) -> VMResult<Vec<u8>>
fn load_module(&self, module_id: &ModuleId) -> VMResult<Vec<u8>>
Get the serialized format of a CompiledModule
given a ModuleId
.
sourcefn publish_module(&mut self, module_id: &ModuleId, blob: Vec<u8>) -> VMResult<()>
fn publish_module(&mut self, module_id: &ModuleId, blob: Vec<u8>) -> VMResult<()>
Publish a module.
sourcefn exists_module(&self, module_id: &ModuleId) -> VMResult<bool>
fn exists_module(&self, module_id: &ModuleId) -> VMResult<bool>
Check if this module exists.
sourcefn emit_event(
&mut self,
guid: Vec<u8>,
seq_num: u64,
ty: Type,
val: Value
) -> PartialVMResult<()>
fn emit_event( &mut self, guid: Vec<u8>, seq_num: u64, ty: Type, val: Value ) -> PartialVMResult<()>
Emit an event to the EventStore