Trait sp_runtime::offchain::OffchainStorage
source · pub trait OffchainStorage: Clone + Send + Sync {
// Required methods
fn set(&mut self, prefix: &[u8], key: &[u8], value: &[u8]);
fn remove(&mut self, prefix: &[u8], key: &[u8]);
fn get(&self, prefix: &[u8], key: &[u8]) -> Option<Vec<u8, Global>>;
fn compare_and_set(
&mut self,
prefix: &[u8],
key: &[u8],
old_value: Option<&[u8]>,
new_value: &[u8]
) -> bool;
}
Expand description
Offchain DB persistent (non-fork-aware) storage.
Required Methods§
sourcefn set(&mut self, prefix: &[u8], key: &[u8], value: &[u8])
fn set(&mut self, prefix: &[u8], key: &[u8], value: &[u8])
Persist a value in storage under given key and prefix.
sourcefn remove(&mut self, prefix: &[u8], key: &[u8])
fn remove(&mut self, prefix: &[u8], key: &[u8])
Clear a storage entry under given key and prefix.