Skip to main content

MemStorage

Struct MemStorage 

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

In-memory blob store. Cheap to clone via Arc.

Implementations§

Source§

impl MemStorage

Source

pub fn new() -> Self

Trait Implementations§

Source§

impl Default for MemStorage

Source§

fn default() -> MemStorage

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

impl StorageBackend for MemStorage

Source§

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

Fetch an object by key. Returns Ok(None) if the key doesn’t exist.
Source§

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

Write an object. Overwrites if the key exists.
Source§

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

Delete an object. Missing keys are not an error.
Source§

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

List object keys with a given prefix. Read more
Source§

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

Check whether an object exists. Cheaper than a full get for backends that support HEAD requests.
Source§

fn put_if_absent<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, key: &'life1 str, data: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = Result<CasResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Write iff the key does not exist. Read more
Source§

fn put_if_match<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, key: &'life1 str, data: &'life2 [u8], etag: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<CasResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Write iff the current etag matches. Read more
Source§

fn range_get<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, start: u64, len: u32, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Byte-range GET. Default implementation fetches the full object and slices. Override when the backend supports Range headers (S3, HTTP).
Source§

fn backend_name(&self) -> &str

Short human-readable identifier for this backend. Used in logs.
Source§

fn delete_many<'life0, 'life1, 'async_trait>( &'life0 self, keys: &'life1 [String], ) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Batch delete. Default is serial delete calls; override for backends with native batch primitives (S3 DeleteObjects, HTTP bulk endpoints). Read more
Source§

fn put_many<'life0, 'life1, 'async_trait>( &'life0 self, entries: &'life1 [(String, Vec<u8>)], ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Batch put. Default is serial put calls; override for backends with parallelism (HTTP with concurrent uploads, S3 with multipart).

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.