Trait sp_runtime::offchain::OffchainStorage [−][src]
Offchain workers local storage.
Required methods
pub fn set(&mut self, prefix: &[u8], key: &[u8], value: &[u8])
[src]
Persist a value in storage under given key and prefix.
pub fn remove(&mut self, prefix: &[u8], key: &[u8])
[src]
Clear a storage entry under given key and prefix.
pub fn get(&self, prefix: &[u8], key: &[u8]) -> Option<Vec<u8, Global>>
[src]
Retrieve a value from storage under given key and prefix.
pub fn compare_and_set(
&mut self,
prefix: &[u8],
key: &[u8],
old_value: Option<&[u8]>,
new_value: &[u8]
) -> bool
[src]
&mut self,
prefix: &[u8],
key: &[u8],
old_value: Option<&[u8]>,
new_value: &[u8]
) -> bool
Replace the value in storage if given old_value matches the current one.
Returns true
if the value has been set and false otherwise.
Implementors
impl OffchainStorage for InMemOffchainStorage
[src]
pub fn set(&mut self, prefix: &[u8], key: &[u8], value: &[u8])
[src]
pub fn remove(&mut self, prefix: &[u8], key: &[u8])
[src]
pub fn get(&self, prefix: &[u8], key: &[u8]) -> Option<Vec<u8, Global>>
[src]
pub fn compare_and_set(
&mut self,
prefix: &[u8],
key: &[u8],
old_value: Option<&[u8]>,
new_value: &[u8]
) -> bool
[src]
&mut self,
prefix: &[u8],
key: &[u8],
old_value: Option<&[u8]>,
new_value: &[u8]
) -> bool
impl OffchainStorage for TestPersistentOffchainDB
[src]
pub fn set(&mut self, prefix: &[u8], key: &[u8], value: &[u8])
[src]
pub fn remove(&mut self, prefix: &[u8], key: &[u8])
[src]
pub fn get(&self, prefix: &[u8], key: &[u8]) -> Option<Vec<u8, Global>>
[src]
pub fn compare_and_set(
&mut self,
prefix: &[u8],
key: &[u8],
old_value: Option<&[u8]>,
new_value: &[u8]
) -> bool
[src]
&mut self,
prefix: &[u8],
key: &[u8],
old_value: Option<&[u8]>,
new_value: &[u8]
) -> bool