[][src]Trait cosmwasm_vm::Storage

pub trait Storage where
    Self: 'static, 
{ fn get(&self, key: &[u8]) -> FfiResult<(Option<Vec<u8>>, u64)>;
fn set(&mut self, key: &[u8], value: &[u8]) -> FfiResult<u64>;
fn remove(&mut self, key: &[u8]) -> FfiResult<u64>; }

Access to the VM's backend storage, i.e. the chain

Required methods

fn get(&self, key: &[u8]) -> FfiResult<(Option<Vec<u8>>, u64)>

Returns Err on error. Returns Ok(None) when key does not exist. Returns Ok(Some(Vec)) when key exists.

Note: Support for differentiating between a non-existent key and a key with empty value is not great yet and might not be possible in all backends. But we're trying to get there.

fn set(&mut self, key: &[u8], value: &[u8]) -> FfiResult<u64>

fn remove(&mut self, key: &[u8]) -> FfiResult<u64>

Removes a database entry at key.

The current interface does not allow to differentiate between a key that existed before and one that didn't exist. See https://github.com/CosmWasm/cosmwasm/issues/290

Loading content...

Implementors

impl Storage for MockStorage[src]

Loading content...