pub struct MemoryBackend { /* private fields */ }Expand description
In-memory bytes backend backed by parking_lot::Mutex<HashMap<String, Vec<u8>>>. All operations are synchronous and in-process. Useful for
tests, hot tiers, and as the default backend for the memory_*
convenience factories.
Default uses "memory" as the diagnostic name; use Self::with_name
to set a different one (the per-tier-name pattern from the TS impl —
helps disambiguate multiple in-process tiers in diagnostics).
Implementations§
Trait Implementations§
Source§impl Debug for MemoryBackend
impl Debug for MemoryBackend
Source§impl Default for MemoryBackend
impl Default for MemoryBackend
Source§impl StorageBackend for MemoryBackend
impl StorageBackend for MemoryBackend
Source§fn name(&self) -> &str
fn name(&self) -> &str
Diagnostic name (e.g.
"memory", "file:./checkpoints"). Surfaces
in error messages and tier Display impls.Source§fn read(&self, key: &str) -> Result<Option<Vec<u8>>, StorageError>
fn read(&self, key: &str) -> Result<Option<Vec<u8>>, StorageError>
Read raw bytes; returns
Ok(None) on miss.Source§fn delete(&self, key: &str) -> Result<(), StorageError>
fn delete(&self, key: &str) -> Result<(), StorageError>
Optional delete-by-key. Default is no-op so append-only or read-only
backends can stay quiet.
Source§fn list(&self, prefix: &str) -> Result<Vec<String>, StorageError>
fn list(&self, prefix: &str) -> Result<Vec<String>, StorageError>
Enumerate keys matching
prefix (lex-ASC). Empty prefix enumerates
all keys. Default returns BackendNoListSupport — backends that don’t
support enumeration surface the diagnostic here at first call, NOT at
attach (mirrors TS lazy-throw semantics for list_by_prefix).Auto Trait Implementations§
impl !Freeze for MemoryBackend
impl !RefUnwindSafe for MemoryBackend
impl Send for MemoryBackend
impl Sync for MemoryBackend
impl Unpin for MemoryBackend
impl UnsafeUnpin for MemoryBackend
impl UnwindSafe for MemoryBackend
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