Skip to main content

MemoryBackend

Struct MemoryBackend 

Source
pub struct MemoryBackend { /* private fields */ }
Expand description

The storage seam, muniment’s (2026-07-12).

Eidetic used to declare its own Store trait — get/put/delete/list over &str -> Vec<u8>, async, one method per operation. That was muniment::Backend written twice: eidetic poured its own floor before muniment existed. It now consumes the real one, and Store remains as an alias so every layer above (manifests, schemas, sealing, engrams) reads unchanged.

What the swap buys beyond deleting a duplicate: backends take &self, delete/list are required rather than Err-by-default, muniment’s scan (ordered range) and apply (atomic batch) come along, and every muniment backend (memory, redb) is now an eidetic store — while eidetic-fjall becomes a backend the whole family can reuse. An in-memory Backend, the deterministic test and development floor. Not durable: state lives only as long as the handle. Cheap to clone (a shared handle), so one instance can seed both a SlotStore and a BlobStore, the way a real filesystem or OPFS handle is cheap to clone.

Implementations§

Source§

impl MemoryBackend

Source

pub fn new() -> MemoryBackend

A fresh, empty backend.

Source

pub fn len(&self) -> usize

The number of stored keys.

Source

pub fn is_empty(&self) -> bool

Whether the backend holds no keys.

Trait Implementations§

Source§

impl Backend for MemoryBackend

Source§

fn apply<'life0, 'life1, 'async_trait>( &'life0 self, ops: &'life1 [WriteOp], ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, MemoryBackend: 'async_trait,

Atomic under the single mutex: the whole batch applies while the lock is held, so no reader observes a partial batch.

Source§

fn get<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, StoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, MemoryBackend: 'async_trait,

The bytes at key, or None if absent.
Source§

fn put<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, key: &'life1 str, bytes: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, MemoryBackend: 'async_trait,

Write bytes at key, overwriting any previous value.
Source§

fn delete<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, MemoryBackend: 'async_trait,

Remove key. Absent keys are not an error.
Source§

fn list<'life0, 'life1, 'async_trait>( &'life0 self, prefix: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, StoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, MemoryBackend: 'async_trait,

Every key beginning with prefix, in unspecified order.
Source§

fn scan<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, start: &'life1 str, end: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, StoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, MemoryBackend: 'async_trait,

Keys in the half-open lexicographic range [start, end), in ascending order. This is the ordered read a log needs: a per-author log lives at contiguous fixed-width keys, so [lo, hi) returns its entries in seq order. Implementations back this with a native ordered index (redb ranges, IndexedDB cursors), or filter and sort list where none exists. Read more
Source§

impl Clone for MemoryBackend

Source§

fn clone(&self) -> MemoryBackend

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for MemoryBackend

Source§

fn default() -> MemoryBackend

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more