pub struct MockBlobService {
BlobService_expectations: MockBlobService_BlobService,
}Expand description
The base trait all BlobService services need to implement. It provides functions to check whether a given blob exists, a way to read (and seek) a blob, and a method to create a blobwriter handle, which will implement a writer interface, and also provides a close function, to finalize a blob and get its digest.
Fields§
§BlobService_expectations: MockBlobService_BlobServiceImplementations§
Source§impl MockBlobService
impl MockBlobService
Sourcepub fn checkpoint(&mut self)
pub fn checkpoint(&mut self)
Validate that all current expectations for all methods have been satisfied, and discard them.
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new mock object with no expectations.
This method will not be generated if the real struct
already has a new method. However, it will be
generated if the struct implements a trait with a new
method. The trait’s new method can still be called
like <MockX as TraitY>::new
Source§impl MockBlobService
impl MockBlobService
Sourcepub fn expect_has(&mut self) -> &mut Expectation
pub fn expect_has(&mut self) -> &mut Expectation
Create an Expectation for mocking the has method
Sourcepub fn expect_open_read(&mut self) -> &mut Expectation
pub fn expect_open_read(&mut self) -> &mut Expectation
Create an Expectation for mocking the open_read method
Sourcepub fn expect_open_write(&mut self) -> &mut Expectation
pub fn expect_open_write(&mut self) -> &mut Expectation
Create an Expectation for mocking the open_write method
Sourcepub fn expect_chunks(&mut self) -> &mut Expectation
pub fn expect_chunks(&mut self) -> &mut Expectation
Create an Expectation for mocking the chunks method
Trait Implementations§
Source§impl BlobService for MockBlobService
The base trait all BlobService services need to implement.
It provides functions to check whether a given blob exists,
a way to read (and seek) a blob, and a method to create a blobwriter handle,
which will implement a writer interface, and also provides a close function,
to finalize a blob and get its digest.
impl BlobService for MockBlobService
The base trait all BlobService services need to implement. It provides functions to check whether a given blob exists, a way to read (and seek) a blob, and a method to create a blobwriter handle, which will implement a writer interface, and also provides a close function, to finalize a blob and get its digest.
Source§fn has<'life0, 'life1, 'async_trait>(
&'life0 self,
digest: &'life1 B3Digest,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn has<'life0, 'life1, 'async_trait>(
&'life0 self,
digest: &'life1 B3Digest,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if the service has the blob, by its content hash. On implementations returning chunks, this must also work for chunks.
Source§fn open_read<'life0, 'life1, 'async_trait>(
&'life0 self,
digest: &'life1 B3Digest,
) -> Pin<Box<dyn Future<Output = Result<Option<Box<dyn BlobReader>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn open_read<'life0, 'life1, 'async_trait>(
&'life0 self,
digest: &'life1 B3Digest,
) -> Pin<Box<dyn Future<Output = Result<Option<Box<dyn BlobReader>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Request a blob from the store, by its content hash. On implementations returning chunks, this must also work for chunks.
Source§fn open_write<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Box<dyn BlobWriter>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn open_write<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Box<dyn BlobWriter>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Insert a new blob into the store. Returns a BlobWriter, which implements tokio::io::AsyncWrite and a BlobWriter::close to finalize the blob and get its digest.
Source§fn chunks<'life0, 'life1, 'async_trait>(
&'life0 self,
digest: &'life1 B3Digest,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<ChunkMeta>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn chunks<'life0, 'life1, 'async_trait>(
&'life0 self,
digest: &'life1 B3Digest,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<ChunkMeta>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Return a list of chunks for a given blob. There’s a distinction between returning Ok(None) and Ok(Some(vec![])). The former return value is sent in case the blob is not present at all, while the second one is sent in case there’s no more granular chunks (or the backend does not support chunking). A default implementation checking for existence and then returning it does not have more granular chunks available is provided.
Source§impl Debug for MockBlobService
impl Debug for MockBlobService
Auto Trait Implementations§
impl Freeze for MockBlobService
impl RefUnwindSafe for MockBlobService
impl Send for MockBlobService
impl Sync for MockBlobService
impl Unpin for MockBlobService
impl UnsafeUnpin for MockBlobService
impl UnwindSafe for MockBlobService
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].