pub struct MemoryBlob { /* private fields */ }Expand description
An in-memory reference backend. Correct unless built with MemoryBlob::with_defect.
Implementations§
Source§impl MemoryBlob
impl MemoryBlob
Sourcepub fn with_defect(defect: Defect) -> Self
pub fn with_defect(defect: Defect) -> Self
A store that is wrong in exactly one way.
Trait Implementations§
Source§impl BlobBackend for MemoryBlob
impl BlobBackend for MemoryBlob
Source§async fn read(&self, key: &str) -> Result<Option<Vec<u8>>, BlobError>
async fn read(&self, key: &str) -> Result<Option<Vec<u8>>, BlobError>
The value at
key, or None if absent.Source§async fn write(&self, key: &str, bytes: Vec<u8>) -> Result<(), BlobError>
async fn write(&self, key: &str, bytes: Vec<u8>) -> Result<(), BlobError>
Store
bytes at key, replacing any earlier value. Atomicity is not implied; that is
blob.replace_atomic.Source§async fn delete(&self, key: &str) -> Result<(), BlobError>
async fn delete(&self, key: &str) -> Result<(), BlobError>
Remove
key. Removing an absent key is Ok.Source§async fn stat(&self, key: &str) -> Result<Option<Entry>, BlobError>
async fn stat(&self, key: &str) -> Result<Option<Entry>, BlobError>
The entry at
key without reading its value, or None if absent.Source§async fn list(
&self,
prefix: &str,
after: Option<&str>,
limit: usize,
) -> Result<Page, BlobError>
async fn list( &self, prefix: &str, after: Option<&str>, limit: usize, ) -> Result<Page, BlobError>
Up to
limit entries whose key starts with the literal prefix, in ascending bytewise
key order, strictly after after if given.Source§async fn create_exclusive(
&self,
key: &str,
bytes: Vec<u8>,
) -> Result<bool, BlobError>
async fn create_exclusive( &self, key: &str, bytes: Vec<u8>, ) -> Result<bool, BlobError>
Write
bytes at key only if nothing is there. Ok(true) created it, Ok(false) found
a value and changed nothing. Of any number of concurrent callers for one key, exactly one
gets Ok(true) (blob.create_exclusive). A backend that cannot promise that returns
BlobError::Unsupported; the default does.Source§async fn replace_atomic(
&self,
key: &str,
bytes: Vec<u8>,
) -> Result<(), BlobError>
async fn replace_atomic( &self, key: &str, bytes: Vec<u8>, ) -> Result<(), BlobError>
Replace the value at
key so that a concurrent reader sees the whole old value or the
whole new one, never a mix (blob.replace_atomic.concurrent_read). A backend that cannot
promise that returns BlobError::Unsupported; the default does.Source§async fn append(&self, key: &str, bytes: Vec<u8>) -> Result<(), BlobError>
async fn append(&self, key: &str, bytes: Vec<u8>) -> Result<(), BlobError>
Add
bytes after the existing bytes of key, in call order (blob.append). Of
concurrent calls, each call’s bytes arrive whole and exactly once
(blob.append.concurrent_whole). A backend that cannot promise that returns
BlobError::Unsupported; the default does.Source§impl Debug for MemoryBlob
impl Debug for MemoryBlob
Auto Trait Implementations§
impl !Freeze for MemoryBlob
impl RefUnwindSafe for MemoryBlob
impl Send for MemoryBlob
impl Sync for MemoryBlob
impl Unpin for MemoryBlob
impl UnsafeUnpin for MemoryBlob
impl UnwindSafe for MemoryBlob
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more