pub struct MockDirectoryService {
DirectoryService_expectations: MockDirectoryService_DirectoryService,
}Expand description
The base trait all Directory services need to implement. This is a simple get and put of Directory, returning their digest.
Fields§
§DirectoryService_expectations: MockDirectoryService_DirectoryServiceImplementations§
Source§impl MockDirectoryService
impl MockDirectoryService
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 MockDirectoryService
impl MockDirectoryService
Sourcepub fn expect_get(&mut self) -> &mut Expectation
pub fn expect_get(&mut self) -> &mut Expectation
Create an Expectation for mocking the get method
Sourcepub fn expect_put(&mut self) -> &mut Expectation
pub fn expect_put(&mut self) -> &mut Expectation
Create an Expectation for mocking the put method
Sourcepub fn expect_get_recursive(&mut self) -> &mut Expectation
pub fn expect_get_recursive(&mut self) -> &mut Expectation
Create an Expectation for mocking the get_recursive method
Sourcepub fn expect_put_multiple_start(&mut self) -> &mut Expectation<'static>
pub fn expect_put_multiple_start(&mut self) -> &mut Expectation<'static>
Create an Expectation for mocking the put_multiple_start method
Trait Implementations§
Source§impl Debug for MockDirectoryService
impl Debug for MockDirectoryService
Source§impl Default for MockDirectoryService
impl Default for MockDirectoryService
Source§impl DirectoryService for MockDirectoryService
The base trait all Directory services need to implement.
This is a simple get and put of Directory, returning their
digest.
impl DirectoryService for MockDirectoryService
The base trait all Directory services need to implement. This is a simple get and put of Directory, returning their digest.
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
digest: &'life1 B3Digest,
) -> Pin<Box<dyn Future<Output = Result<Option<Directory>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
digest: &'life1 B3Digest,
) -> Pin<Box<dyn Future<Output = Result<Option<Directory>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Looks up a single Directory message by its digest. The returned Directory message must be valid. In case the directory is not found, Ok(None) is returned.
It is okay for certain implementations to only allow retrieval of Directory digests that are at the “root”, aka the last element that’s sent to a DirectoryPutter. This makes sense for implementations bundling closures of directories together in batches.
Source§fn put<'life0, 'async_trait>(
&'life0 self,
directory: Directory,
) -> Pin<Box<dyn Future<Output = Result<B3Digest, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn put<'life0, 'async_trait>(
&'life0 self,
directory: Directory,
) -> Pin<Box<dyn Future<Output = Result<B3Digest, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Uploads a single Directory message, and returns the calculated digest, or an error. An error must also be returned if the message is not valid.
Source§fn get_recursive(
&self,
root_directory_digest: &B3Digest,
) -> BoxStream<'static, Result<Directory, Error>>
fn get_recursive( &self, root_directory_digest: &B3Digest, ) -> BoxStream<'static, Result<Directory, Error>>
Looks up a closure of Directory.
Ideally this would be a impl Stream<Item = Result<Directory, Error>>,
and we’d be able to add a default implementation for it here, but
we can’t have that yet.
This returns a pinned, boxed stream. The pinning allows for it to be polled easily, and the box allows different underlying stream implementations to be returned since Rust doesn’t support this as a generic in traits yet. This is the same thing that async_trait generates, but for streams instead of futures.
Directories are sent in an order from the root to the leaves, so that the receiving side can validate each message to be connected to the root that has initially been requested.
In case the directory can not be found, this should return an empty stream.
Source§fn put_multiple_start<'a>(&'a self) -> Box<dyn DirectoryPutter + 'a>
fn put_multiple_start<'a>(&'a self) -> Box<dyn DirectoryPutter + 'a>
Allows persisting a closure of Directory, which is a graph of connected Directory messages.
Auto Trait Implementations§
impl Freeze for MockDirectoryService
impl RefUnwindSafe for MockDirectoryService
impl Send for MockDirectoryService
impl Sync for MockDirectoryService
impl Unpin for MockDirectoryService
impl UnsafeUnpin for MockDirectoryService
impl UnwindSafe for MockDirectoryService
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].