pub enum DefaultStorageDB {
Sled(SledStorageDB),
Redis(RedisStorageDB),
RedisCluster(RedisStorageDB),
}
Expand description
Unified storage backend enum (dispatches to concrete implementations)
Variants§
Sled(SledStorageDB)
Sled database backend
Redis(RedisStorageDB)
Redis backend
RedisCluster(RedisStorageDB)
Redis Cluster backend
Implementations§
Source§impl DefaultStorageDB
impl DefaultStorageDB
Sourcepub async fn map<V: AsRef<[u8]> + Sync + Send>(
&self,
name: V,
expire: Option<i64>,
) -> Result<StorageMap>
pub async fn map<V: AsRef<[u8]> + Sync + Send>( &self, name: V, expire: Option<i64>, ) -> Result<StorageMap>
Accesses a named map
Sourcepub async fn map_remove<K>(&self, name: K) -> Result<()>
pub async fn map_remove<K>(&self, name: K) -> Result<()>
Removes a named map
Sourcepub async fn map_contains_key<K: AsRef<[u8]> + Sync + Send>(
&self,
key: K,
) -> Result<bool>
pub async fn map_contains_key<K: AsRef<[u8]> + Sync + Send>( &self, key: K, ) -> Result<bool>
Checks if map exists
Sourcepub async fn list<V: AsRef<[u8]> + Sync + Send>(
&self,
name: V,
expire: Option<i64>,
) -> Result<StorageList>
pub async fn list<V: AsRef<[u8]> + Sync + Send>( &self, name: V, expire: Option<i64>, ) -> Result<StorageList>
Accesses a named list
Sourcepub async fn list_remove<K>(&self, name: K) -> Result<()>
pub async fn list_remove<K>(&self, name: K) -> Result<()>
Removes a named list
Sourcepub async fn list_contains_key<K: AsRef<[u8]> + Sync + Send>(
&self,
key: K,
) -> Result<bool>
pub async fn list_contains_key<K: AsRef<[u8]> + Sync + Send>( &self, key: K, ) -> Result<bool>
Checks if list exists
Sourcepub async fn batch_insert<V>(&self, key_vals: Vec<(Vec<u8>, V)>) -> Result<()>
pub async fn batch_insert<V>(&self, key_vals: Vec<(Vec<u8>, V)>) -> Result<()>
Batch insert of key-value pairs
Sourcepub async fn counter_incr<K>(&self, key: K, increment: isize) -> Result<()>
pub async fn counter_incr<K>(&self, key: K, increment: isize) -> Result<()>
Increments a counter
Sourcepub async fn counter_decr<K>(&self, key: K, decrement: isize) -> Result<()>
pub async fn counter_decr<K>(&self, key: K, decrement: isize) -> Result<()>
Decrements a counter
Sourcepub async fn counter_get<K>(&self, key: K) -> Result<Option<isize>>
pub async fn counter_get<K>(&self, key: K) -> Result<Option<isize>>
Gets counter value
Sourcepub async fn counter_set<K>(&self, key: K, val: isize) -> Result<()>
pub async fn counter_set<K>(&self, key: K, val: isize) -> Result<()>
Sets counter value
Sourcepub async fn contains_key<K: AsRef<[u8]> + Sync + Send>(
&self,
key: K,
) -> Result<bool>
pub async fn contains_key<K: AsRef<[u8]> + Sync + Send>( &self, key: K, ) -> Result<bool>
Checks if key exists
Sourcepub async fn expire_at<K>(&self, key: K, at: i64) -> Result<bool>
pub async fn expire_at<K>(&self, key: K, at: i64) -> Result<bool>
Sets expiration timestamp (requires “ttl” feature)
Sourcepub async fn expire<K>(&self, key: K, dur: i64) -> Result<bool>
pub async fn expire<K>(&self, key: K, dur: i64) -> Result<bool>
Sets expiration duration (requires “ttl” feature)
Sourcepub async fn ttl<K>(&self, key: K) -> Result<Option<i64>>
pub async fn ttl<K>(&self, key: K) -> Result<Option<i64>>
Gets time-to-live (requires “ttl” feature)
Sourcepub async fn map_iter<'a>(
&'a mut self,
) -> Result<Box<dyn AsyncIterator<Item = Result<StorageMap>> + Send + 'a>>
pub async fn map_iter<'a>( &'a mut self, ) -> Result<Box<dyn AsyncIterator<Item = Result<StorageMap>> + Send + 'a>>
Iterates over maps
Sourcepub async fn list_iter<'a>(
&'a mut self,
) -> Result<Box<dyn AsyncIterator<Item = Result<StorageList>> + Send + 'a>>
pub async fn list_iter<'a>( &'a mut self, ) -> Result<Box<dyn AsyncIterator<Item = Result<StorageList>> + Send + 'a>>
Iterates over lists
Trait Implementations§
Source§impl Clone for DefaultStorageDB
impl Clone for DefaultStorageDB
Source§fn clone(&self) -> DefaultStorageDB
fn clone(&self) -> DefaultStorageDB
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for DefaultStorageDB
impl !RefUnwindSafe for DefaultStorageDB
impl Send for DefaultStorageDB
impl Sync for DefaultStorageDB
impl Unpin for DefaultStorageDB
impl !UnwindSafe for DefaultStorageDB
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more