pub trait KVStorage {
// Required methods
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>;
}
Expand description
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§
Sourcefn available(&self) -> Result<(), Error>
fn available(&self) -> Result<(), Error>
Returns an error if the backend service is not online and available.
Sourcefn get<T: DeserializeOwned>(&self, key: &str) -> Result<GetResponse<T>, Error>
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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.