pub struct CompressedKvStore<S: KvStore> { /* private fields */ }Expand description
Compressed KV store wrapper
Wraps any KvStore implementation and transparently compresses/decompresses values.
§Example
use trueno_db::kv::{CompressedKvStore, Compression, MemoryKvStore, KvStore};
let inner = MemoryKvStore::new();
let store = CompressedKvStore::new(inner, Compression::Lz4);
// Values are transparently compressed
store.set("key", vec![0u8; 10000]).await?;
let value = store.get("key").await?;Implementations§
Source§impl<S: KvStore> CompressedKvStore<S>
impl<S: KvStore> CompressedKvStore<S>
Sourcepub const fn new(inner: S, compression: Compression) -> Self
pub const fn new(inner: S, compression: Compression) -> Self
Create a new compressed KV store wrapping the given store
Sourcepub const fn compression(&self) -> Compression
pub const fn compression(&self) -> Compression
Get compression algorithm
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for CompressedKvStore<S>where
S: Freeze,
impl<S> RefUnwindSafe for CompressedKvStore<S>where
S: RefUnwindSafe,
impl<S> Send for CompressedKvStore<S>
impl<S> Sync for CompressedKvStore<S>
impl<S> Unpin for CompressedKvStore<S>where
S: Unpin,
impl<S> UnsafeUnpin for CompressedKvStore<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for CompressedKvStore<S>where
S: UnwindSafe,
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