InMemoryBackend

Struct InMemoryBackend 

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

In-memory Backend backed by a HashMap.

Removes the need for filesystem tempdir management in unit tests. The backend is Clone so tests can hold a handle for direct inspection while the service owns a boxed copy.

Implementations§

Source§

impl InMemoryBackend

Source

pub fn new(name: &'static str) -> Self

Creates a new InMemoryBackend with the given diagnostic name.

Source

pub fn get(&self, id: &ObjectId) -> Entry

Returns the stored entry for id, for direct inspection in tests.

Source

pub fn contains(&self, id: &ObjectId) -> bool

Returns true if the backend contains an entry for the given id.

Source

pub fn is_empty(&self) -> bool

Returns true if the backend has no stored objects.

Source

pub fn remove(&self, id: &ObjectId)

Removes an entry directly, bypassing the Backend trait.

Useful for simulating partial failures (e.g. orphan tombstones).

Trait Implementations§

Source§

impl Backend for InMemoryBackend

Source§

fn name(&self) -> &'static str

The backend name, used for diagnostics.
Source§

fn put_object<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 ObjectId, metadata: &'life2 Metadata, stream: ClientStream, ) -> Pin<Box<dyn Future<Output = Result<PutResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Stores an object at the given path with the given metadata.
Source§

fn get_object<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 ObjectId, ) -> Pin<Box<dyn Future<Output = Result<GetResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieves an object at the given path, returning its metadata and a stream of bytes.
Source§

fn delete_object<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 ObjectId, ) -> Pin<Box<dyn Future<Output = Result<DeleteResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Deletes the object at the given path.
Source§

fn get_metadata<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 ObjectId, ) -> Pin<Box<dyn Future<Output = Result<MetadataResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieves only the metadata for an object, without the payload.
Source§

fn join<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Waits for any outstanding background operations to complete before shutdown. Read more
Source§

impl Clone for InMemoryBackend

Source§

fn clone(&self) -> InMemoryBackend

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for InMemoryBackend

Source§

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

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

impl HighVolumeBackend for InMemoryBackend

Source§

fn put_non_tombstone<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 ObjectId, metadata: &'life2 Metadata, payload: Bytes, ) -> Pin<Box<dyn Future<Output = Result<Option<Tombstone>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Writes the object only if NO redirect tombstone exists at this key. Read more
Source§

fn get_tiered_object<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 ObjectId, ) -> Pin<Box<dyn Future<Output = Result<TieredGet>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieves an object with explicit tombstone awareness. Read more
Source§

fn get_tiered_metadata<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 ObjectId, ) -> Pin<Box<dyn Future<Output = Result<TieredMetadata>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieves only metadata with explicit tombstone awareness. Read more
Source§

fn delete_non_tombstone<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 ObjectId, ) -> Pin<Box<dyn Future<Output = Result<Option<Tombstone>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Deletes the object only if it is NOT a redirect tombstone. Read more
Source§

fn compare_and_write<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 ObjectId, current: Option<&'life2 ObjectId>, write: TieredWrite, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Atomically mutates the row if the current redirect state matches. 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<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.

§

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

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

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

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

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.

§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
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 = 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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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