pub struct MemoryStorage { /* private fields */ }Expand description
A storage that keeps entries in memory for the lifetime of the process.
Used where nothing durable is available (no-std, or a cache root that can’t be opened). Entries do not survive a restart, so an imported bundle has to be imported again on the next run, which costs nothing but time.
Implementations§
Source§impl MemoryStorage
impl MemoryStorage
Sourcepub fn new(namespace: &str) -> Self
pub fn new(namespace: &str) -> Self
The in-memory storage for namespace, shared process-wide across every
environment.
The environment-bound path uses in_environment instead, which
isolates the entries per environment so a switch doesn’t
serve the previous one’s data. This unscoped constructor is for explicit
storages that aren’t tied to an environment (tests, benches).
Sourcepub fn namespaces() -> Vec<NamespaceSummary>
pub fn namespaces() -> Vec<NamespaceSummary>
Every namespace the active environment holds in memory.
Only the active environment’s entries are reported: the process-wide map also holds other environments’ entries and unscoped explicit storages, but a summary is always about the environment in effect right now.
Trait Implementations§
Source§impl Clone for MemoryStorage
impl Clone for MemoryStorage
Source§impl Debug for MemoryStorage
impl Debug for MemoryStorage
Source§impl Storage for MemoryStorage
impl Storage for MemoryStorage
Source§fn insert(&self, key: &[u8], value: Bytes, origin: Origin) -> Insertion
fn insert(&self, key: &[u8], value: Bytes, origin: Origin) -> Insertion
value under key. See the trait contract for when the write
is declined.Source§fn scan(&self, visit: &mut dyn FnMut(&[u8], &[u8]))
fn scan(&self, visit: &mut dyn FnMut(&[u8], &[u8]))
Source§fn purge_key(&self, key: &[u8])
fn purge_key(&self, key: &[u8])
key, durably. Same failure contract as
purge.