pub struct MemBlobStore { /* private fields */ }Expand description
In-memory blob store for testing.
Implementations§
Source§impl MemBlobStore
impl MemBlobStore
pub fn new() -> MemBlobStore
Trait Implementations§
Source§impl BlobStore for MemBlobStore
impl BlobStore for MemBlobStore
Source§fn blob_len(
&self,
index_name: &str,
file_name: &str,
) -> Result<Option<u64>, Error>
fn blob_len( &self, index_name: &str, file_name: &str, ) -> Result<Option<u64>, Error>
Size of a blob in bytes WITHOUT loading it, when the backend can
answer cheaply (
LENGTH(_data) in SQL, HEAD on S3…). Ok(None) —
the default — means “unknown”: lazy consumers then fall back to
materialising the file on first open instead of first byte read.Source§fn load_range(
&self,
index_name: &str,
file_name: &str,
range: Range<u64>,
) -> Result<Option<Vec<u8>>, Error>
fn load_range( &self, index_name: &str, file_name: &str, range: Range<u64>, ) -> Result<Option<Vec<u8>>, Error>
Read a byte range of a blob without loading it whole, when the
backend can (
SUBSTRING(_data FROM … FOR …) in SQL, ranged GET on
S3…). Ok(None) — the default — means “unsupported”: lazy consumers
then materialise the whole blob instead. Out-of-bounds ranges are the
caller’s bug; backends may truncate or error.Source§fn load(&self, index_name: &str, file_name: &str) -> Result<Vec<u8>, Error>
fn load(&self, index_name: &str, file_name: &str) -> Result<Vec<u8>, Error>
Load a blob. Returns
NotFound if it doesn’t exist.Source§fn save(
&self,
index_name: &str,
file_name: &str,
data: &[u8],
) -> Result<(), Error>
fn save( &self, index_name: &str, file_name: &str, data: &[u8], ) -> Result<(), Error>
Save a blob (create or overwrite).
Source§fn delete(&self, index_name: &str, file_name: &str) -> Result<(), Error>
fn delete(&self, index_name: &str, file_name: &str) -> Result<(), Error>
Delete a blob. Returns Ok(()) even if the blob didn’t exist.
Source§impl Clone for MemBlobStore
impl Clone for MemBlobStore
Source§fn clone(&self) -> MemBlobStore
fn clone(&self) -> MemBlobStore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MemBlobStore
impl Debug for MemBlobStore
Source§impl Default for MemBlobStore
impl Default for MemBlobStore
Source§fn default() -> MemBlobStore
fn default() -> MemBlobStore
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MemBlobStore
impl RefUnwindSafe for MemBlobStore
impl Send for MemBlobStore
impl Sync for MemBlobStore
impl Unpin for MemBlobStore
impl UnsafeUnpin for MemBlobStore
impl UnwindSafe for MemBlobStore
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