Skip to main content

InMemoryObjectStore

Struct InMemoryObjectStore 

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

An in-memory ObjectClient with real ETag and conditional-write semantics, for building and testing the object-storage backend without a cloud dependency.

Implementations§

Source§

impl InMemoryObjectStore

Source

pub fn new() -> Self

Creates an empty in-memory object store.

Trait Implementations§

Source§

impl Debug for InMemoryObjectStore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InMemoryObjectStore

Source§

fn default() -> InMemoryObjectStore

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

impl ObjectClient for InMemoryObjectStore

Source§

fn get<'op>(&'op self, key: &str) -> ObjectFuture<'op, Option<Arc<[u8]>>>

Reads the whole object, or None when the key is absent.
Source§

fn get_range<'op>( &'op self, key: &str, offset: u64, len: u64, ) -> ObjectFuture<'op, Arc<[u8]>>

Reads len bytes starting at offset; errors for an absent key or an out-of-bounds range.
Source§

fn put<'op>(&'op self, key: &str, bytes: Arc<[u8]>) -> ObjectFuture<'op, ETag>

Stores the object unconditionally, returning its new ETag.
Source§

fn delete<'op>(&'op self, key: &str) -> ObjectFuture<'op, ()>

Deletes the object (idempotent: deleting an absent key succeeds).
Source§

fn list<'op>(&'op self, prefix: &str) -> ObjectFuture<'op, Vec<ObjectMeta>>

Lists objects whose key starts with prefix, in key order.
Source§

fn head<'op>(&'op self, key: &str) -> ObjectFuture<'op, Option<ObjectMeta>>

Returns the object’s metadata (size + ETag) without its bytes, or None when the key is absent (like S3 HEAD).
Source§

fn put_if<'op>( &'op self, key: &str, bytes: Arc<[u8]>, precondition: Precondition, ) -> ObjectFuture<'op, PutIf>

Conditional write (compare-and-swap): stores bytes only if precondition holds, otherwise reports PutIf::PreconditionFailed with the current ETag. This is the manifest commit point; it must be a real CAS.

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.