[][src]Trait libra_secure_storage::KVStorage

pub trait KVStorage {
    fn available(&self) -> Result<(), Error>;
fn get<T: DeserializeOwned>(
        &self,
        key: &str
    ) -> Result<GetResponse<T>, Error>;
fn set<T: Serialize>(&mut self, key: &str, value: T) -> Result<(), Error>;
fn reset_and_clear(&mut self) -> Result<(), Error>; }

A secure key/value storage engine. Create takes a policy that is enforced internally by the actual backend. The policy contains public identities that the backend can translate into a unique and private token for another service. Hence get and set internally will pass the current service private token to the backend to gain its permissions.

Required methods

fn available(&self) -> Result<(), Error>

Returns an error if the backend service is not online and available.

fn get<T: DeserializeOwned>(&self, key: &str) -> Result<GetResponse<T>, Error>

Retrieves a value from storage and fails if the backend is unavailable or the process has invalid permissions.

fn set<T: Serialize>(&mut self, key: &str, value: T) -> Result<(), Error>

Sets a value in storage and fails if the backend is unavailable or the process has invalid permissions.

fn reset_and_clear(&mut self) -> Result<(), Error>

Resets and clears all data held in the storage engine. Note: this should only be exposed and used for testing. Resetting the storage engine is not something that should be supported in production.

Loading content...

Implementors

impl KVStorage for Storage[src]

fn available(&self) -> Result<(), Error>[src]

Returns an error if the backend service is not online and available.

fn get<T: DeserializeOwned>(&self, key: &str) -> Result<GetResponse<T>, Error>[src]

Retrieves a value from storage and fails if the backend is unavailable or the process has invalid permissions.

fn set<T: Serialize>(&mut self, key: &str, value: T) -> Result<(), Error>[src]

Sets a value in storage and fails if the backend is unavailable or the process has invalid permissions.

fn reset_and_clear(&mut self) -> Result<(), Error>[src]

Resets and clears all data held in the storage engine. Note: this should only be exposed and used for testing. Resetting the storage engine is not something that should be supported in production.

impl KVStorage for GitHubStorage[src]

impl KVStorage for NamespacedStorage[src]

fn reset_and_clear(&mut self) -> Result<(), Error>[src]

Note: This is not a namespace function

impl KVStorage for VaultStorage[src]

impl<T: TimeService> KVStorage for InMemoryStorageInternal<T>[src]

impl<T: TimeService> KVStorage for OnDiskStorageInternal<T>[src]

Loading content...