pub struct MemoryBlobStore { /* private fields */ }Expand description
An in-memory BlobStore for one keyspace. Clones share the blobs.
Implementations§
Source§impl MemoryBlobStore
impl MemoryBlobStore
Sourcepub fn new(keyspace: impl Into<String>) -> Self
pub fn new(keyspace: impl Into<String>) -> Self
An empty store for keyspace (packs for pack uploads).
Sourcepub fn with_single_put_limit(self, limit: u64) -> Self
pub fn with_single_put_limit(self, limit: u64) -> Self
Cap what one begin upload may carry, as a bounded backend does, so
larger objects take the multipart path. For tests.
Sourcepub fn with_fault(self, fault: MemoryFault) -> Self
pub fn with_fault(self, fault: MemoryFault) -> Self
Arm a one-shot MemoryFault (BlobWrite or BlobCommit).
Trait Implementations§
Source§impl BlobStore for MemoryBlobStore
impl BlobStore for MemoryBlobStore
Source§type Sink = MemoryPackSink
type Sink = MemoryPackSink
The upload handle
Self::begin returns.Source§async fn begin(
&self,
key: BlobKey,
len: u64,
) -> Result<MemoryPackSink, StoreError>
async fn begin( &self, key: BlobKey, len: u64, ) -> Result<MemoryPackSink, StoreError>
Start writing blob
key of len bytes.Source§async fn get(
&self,
key: &BlobKey,
range: Option<ByteRange>,
) -> Result<Option<BlobBody>, StoreError>
async fn get( &self, key: &BlobKey, range: Option<ByteRange>, ) -> Result<Option<BlobBody>, StoreError>
The blob’s bytes, or
range of them. A body longer than
MAX_BLOB_PIECE_BYTES MUST be a BlobBody::Stream whose pieces
are each at most MAX_BLOB_PIECE_BYTES (an adapter re-chunks its
backend’s stream); a backend never buffers a whole pack. A range
starting at or past the end is StoreError::RangeNotSatisfiable.Source§impl Clone for MemoryBlobStore
impl Clone for MemoryBlobStore
Source§impl Debug for MemoryBlobStore
impl Debug for MemoryBlobStore
Source§impl Default for MemoryBlobStore
The packs keyspace.
impl Default for MemoryBlobStore
The packs keyspace.
Source§impl MultipartBlobStore for MemoryBlobStore
impl MultipartBlobStore for MemoryBlobStore
Source§type PartSink = MemoryPartSink
type PartSink = MemoryPartSink
The upload handle returned by
Self::begin_part.Source§fn supports_multipart(&self) -> bool
fn supports_multipart(&self) -> bool
Whether this backend can start a multipart upload now.
Source§async fn begin_multipart(
&self,
key: BlobKey,
len: u64,
part_size: u64,
) -> Result<Vec<u8>, StoreError>
async fn begin_multipart( &self, key: BlobKey, len: u64, part_size: u64, ) -> Result<Vec<u8>, StoreError>
Open a new storage session for a pack.
Source§async fn begin_part(
&self,
key: BlobKey,
session: &[u8],
plan: &PartPlan,
index: u32,
expected_cv: [u8; 32],
) -> Result<MemoryPartSink, StoreError>
async fn begin_part( &self, key: BlobKey, session: &[u8], plan: &PartPlan, index: u32, expected_cv: [u8; 32], ) -> Result<MemoryPartSink, StoreError>
Start one part in an existing storage session.
Source§async fn complete(
&self,
key: BlobKey,
session: &[u8],
plan: &PartPlan,
parts: &[PartRef],
) -> Result<CommitOutcome, StoreError>
async fn complete( &self, key: BlobKey, session: &[u8], plan: &PartPlan, parts: &[PartRef], ) -> Result<CommitOutcome, StoreError>
Atomically make the verified pack visible.
Source§async fn complete_with_root(
&self,
key: BlobKey,
session: &[u8],
plan: &PartPlan,
parts: &[PartRef],
content_root: Hash,
) -> Result<CommitOutcome, StoreError>
async fn complete_with_root( &self, key: BlobKey, session: &[u8], plan: &PartPlan, parts: &[PartRef], content_root: Hash, ) -> Result<CommitOutcome, StoreError>
Atomically make a verified object visible: the parts’ merged BLAKE3
root must equal
content_root (the object key is an object id, not a
content hash). Plain Self::complete refuses object keys, as
PackSink::commit does. WP-4.10.Source§fn single_put_limit(&self) -> Option<u64>
fn single_put_limit(&self) -> Option<u64>
The most bytes one
BlobStore::begin upload can carry, or None
when unbounded. Objects longer than this are extracted in parts.Source§async fn abort(&self, key: BlobKey, session: &[u8]) -> Result<(), StoreError>
async fn abort(&self, key: BlobKey, session: &[u8]) -> Result<(), StoreError>
Reclaim an incomplete session. Repeated aborts succeed.
Source§fn begin_multipart_for_ticket(
&self,
key: BlobKey,
len: u64,
part_size: u64,
_ticket_id: [u8; 32],
) -> impl Future<Output = Result<Vec<u8>, StoreError>> + MaybeSend
fn begin_multipart_for_ticket( &self, key: BlobKey, len: u64, part_size: u64, _ticket_id: [u8; 32], ) -> impl Future<Output = Result<Vec<u8>, StoreError>> + MaybeSend
Open a session for a known ticket. Backends that do not use the
ticket id as their storage session keep their existing session format.
Auto Trait Implementations§
impl Freeze for MemoryBlobStore
impl RefUnwindSafe for MemoryBlobStore
impl Send for MemoryBlobStore
impl Sync for MemoryBlobStore
impl Unpin for MemoryBlobStore
impl UnsafeUnpin for MemoryBlobStore
impl UnwindSafe for MemoryBlobStore
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