omaha_client::storage

Trait StorageExt

Source
pub trait StorageExt: Storage {
    // Provided methods
    fn set_option_int<'a>(
        &'a mut self,
        key: &'a str,
        value: Option<i64>,
    ) -> BoxFuture<'_, Result<(), Self::Error>> { ... }
    fn get_time<'a>(&'a self, key: &'a str) -> BoxFuture<'_, Option<SystemTime>> { ... }
    fn set_time<'a>(
        &'a mut self,
        key: &'a str,
        value: impl Into<SystemTime>,
    ) -> BoxFuture<'_, Result<(), Self::Error>> { ... }
    fn remove_or_log<'a>(&'a mut self, key: &'a str) -> BoxFuture<'_, ()> { ... }
    fn commit_or_log(&mut self) -> BoxFuture<'_, ()> { ... }
}
Expand description

Extension trait that adds some features to Storage that can be implemented using the base Storage implementation.

Provided Methods§

Source

fn set_option_int<'a>( &'a mut self, key: &'a str, value: Option<i64>, ) -> BoxFuture<'_, Result<(), Self::Error>>

Set an Option to be stored in the backing store. The implementation should cache the value until the |commit()| fn is called, and then persist all cached values at that time. If the Option is None, the implementation should call |remove()| for the key.

Source

fn get_time<'a>(&'a self, key: &'a str) -> BoxFuture<'_, Option<SystemTime>>

Get a SystemTime from the backing store. Returns None if there is no value for the given key, or if the value for the key has a different type.

Source

fn set_time<'a>( &'a mut self, key: &'a str, value: impl Into<SystemTime>, ) -> BoxFuture<'_, Result<(), Self::Error>>

Set a SystemTime to be stored in the backing store. The implementation should cache the value until the |commit()| fn is called, and then persist all cached values at that time. Note that submicrosecond will be dropped.

Source

fn remove_or_log<'a>(&'a mut self, key: &'a str) -> BoxFuture<'_, ()>

Remove the value for |key| from the backing store, log an error message on error.

Source

fn commit_or_log(&mut self) -> BoxFuture<'_, ()>

Persist all cached values to storage, log an error message on error.

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.

Implementors§

Source§

impl<T> StorageExt for T
where T: Storage,