SettingsStore

Trait SettingsStore 

Source
pub trait SettingsStore {
    // Required methods
    fn read_bin(&self, key: &str) -> Result<Option<Vec<u8>>>;
    fn write_bin(&self, key: &str, value: &[u8]) -> Result<()>;
    fn exists(&self, key: &str) -> Result<bool>;
    fn setting_keys(&self) -> Result<Vec<String>>;
}
Expand description

Interface used to store and retrieve settings from the database. To store IPLD blocks, use the BlockStore trait.

Required Methods§

Source

fn read_bin(&self, key: &str) -> Result<Option<Vec<u8>>>

Reads binary field from the Settings store. This should be used for non-serializable data. For serializable data, use SettingsStoreExt::read_obj.

Source

fn write_bin(&self, key: &str, value: &[u8]) -> Result<()>

Writes binary field to the Settings store. This should be used for non-serializable data. For serializable data, use SettingsStoreExt::write_obj.

Source

fn exists(&self, key: &str) -> Result<bool>

Returns Ok(true) if key exists in store.

Source

fn setting_keys(&self) -> Result<Vec<String>>

Returns all setting keys.

Implementations on Foreign Types§

Source§

impl<T: SettingsStore> SettingsStore for Arc<T>

Source§

fn read_bin(&self, key: &str) -> Result<Option<Vec<u8>>>

Source§

fn write_bin(&self, key: &str, value: &[u8]) -> Result<()>

Source§

fn exists(&self, key: &str) -> Result<bool>

Source§

fn setting_keys(&self) -> Result<Vec<String>>

Implementors§