Skip to main content

MemoryBlobStore

Struct MemoryBlobStore 

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

In-process BlobStore backed by a map. For tests and development; state is lost on drop and is not crash-durable.

Implementations§

Source§

impl MemoryBlobStore

Source

pub fn new() -> Self

Create an empty store.

Source

pub fn object_count(&self) -> usize

Number of stored objects (lets tests assert PUT-count / cost invariants).

Source

pub fn total_bytes(&self) -> usize

Total stored bytes across all objects.

Trait Implementations§

Source§

impl BlobStore for MemoryBlobStore

Source§

fn put<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, value: Bytes, ) -> Pin<Box<dyn Future<Output = Result<(), ObjectLogError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Durably store value at key (see the trait-level durability note). value may be arbitrarily large; a network adapter should chunk it (e.g. S3 multipart) rather than rely on a single request.
Source§

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

Fetch the whole object at key, or None if absent.
Source§

fn get_range<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, range: Range<u64>, ) -> Pin<Box<dyn Future<Output = Result<Option<Bytes>, ObjectLogError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read a byte sub-range of an object without fetching the whole thing. None if the key is absent. range.end > len or range.start > range.end is ObjectLogError::RangeOutOfBounds; an empty n..n returns Ok(Some(<empty>)). No integrity check is performed — payloads are opaque.
Source§

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

List keys beginning with prefix.
Source§

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

Delete an object; deleting a missing key is a no-op success.
Source§

fn take_media_op_stats(&self) -> Option<MediaOpStats>

Snapshot and reset media-op counters since the previous take. Read more
Source§

fn put_chunks<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, chunks: Vec<Bytes>, ) -> Pin<Box<dyn Future<Output = Result<(), ObjectLogError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Durably store a logical object assembled from immutable byte chunks. Read more
Source§

impl Clone for MemoryBlobStore

Source§

fn clone(&self) -> MemoryBlobStore

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 MemoryBlobStore

Source§

fn default() -> MemoryBlobStore

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<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, 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> 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.