Struct mountpoint_s3_client::mock_client::MockClient
source · pub struct MockClient { /* private fields */ }Expand description
A mock implementation of an object client that we can manually add objects to, and then query via the ObjectClient APIs.
Implementations§
source§impl MockClient
impl MockClient
sourcepub fn new(config: MockClientConfig) -> Self
pub fn new(config: MockClientConfig) -> Self
Create a new MockClient with the given config
sourcepub fn add_object(&self, key: &str, value: MockObject)
pub fn add_object(&self, key: &str, value: MockObject)
Add an object to this mock client’s bucket
sourcepub fn remove_object(&self, key: &str)
pub fn remove_object(&self, key: &str)
Remove object for the mock client’s bucket
sourcepub fn contains_key(&self, key: &str) -> bool
pub fn contains_key(&self, key: &str) -> bool
Returns true if this mock client’s bucket contains the specified key
sourcepub fn contains_prefix(&self, prefix: &str) -> bool
pub fn contains_prefix(&self, prefix: &str) -> bool
Returns true if this mock client’s bucket contains the specified common prefix
Trait Implementations§
source§impl Debug for MockClient
impl Debug for MockClient
source§impl ObjectClient for MockClient
impl ObjectClient for MockClient
type GetObjectResult = GetObjectResult
type ClientError = MockClientError
source§fn delete_object<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
bucket: &'life1 str,
key: &'life2 str
) -> Pin<Box<dyn Future<Output = ObjectClientResult<DeleteObjectResult, DeleteObjectError, Self::ClientError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn delete_object<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, bucket: &'life1 str, key: &'life2 str ) -> Pin<Box<dyn Future<Output = ObjectClientResult<DeleteObjectResult, DeleteObjectError, Self::ClientError>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,
Delete a single object from the object store. Read more
source§fn get_object<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
bucket: &'life1 str,
key: &'life2 str,
range: Option<Range<u64>>,
if_match: Option<ETag>
) -> Pin<Box<dyn Future<Output = ObjectClientResult<Self::GetObjectResult, GetObjectError, Self::ClientError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_object<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, bucket: &'life1 str, key: &'life2 str, range: Option<Range<u64>>, if_match: Option<ETag> ) -> Pin<Box<dyn Future<Output = ObjectClientResult<Self::GetObjectResult, GetObjectError, Self::ClientError>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,
Get an object from the object store. Returns a stream of body parts of the object. Parts are
guaranteed to be returned by the stream in order and contiguously.
source§fn head_object<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
bucket: &'life1 str,
key: &'life2 str
) -> Pin<Box<dyn Future<Output = ObjectClientResult<HeadObjectResult, HeadObjectError, Self::ClientError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn head_object<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, bucket: &'life1 str, key: &'life2 str ) -> Pin<Box<dyn Future<Output = ObjectClientResult<HeadObjectResult, HeadObjectError, Self::ClientError>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,
Retrieve object metadata without retrieving the object contents
source§fn list_objects<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
bucket: &'life1 str,
continuation_token: Option<&'life2 str>,
delimiter: &'life3 str,
max_keys: usize,
prefix: &'life4 str
) -> Pin<Box<dyn Future<Output = ObjectClientResult<ListObjectsResult, ListObjectsError, Self::ClientError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn list_objects<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, bucket: &'life1 str, continuation_token: Option<&'life2 str>, delimiter: &'life3 str, max_keys: usize, prefix: &'life4 str ) -> Pin<Box<dyn Future<Output = ObjectClientResult<ListObjectsResult, ListObjectsError, Self::ClientError>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,
List the objects in a bucket under a given prefix
source§fn put_object<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
bucket: &'life1 str,
key: &'life2 str,
_params: &'life3 PutObjectParams,
contents: impl 'async_trait + Stream<Item = impl 'async_trait + AsRef<[u8]> + Send> + Send
) -> Pin<Box<dyn Future<Output = ObjectClientResult<PutObjectResult, PutObjectError, Self::ClientError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn put_object<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, bucket: &'life1 str, key: &'life2 str, _params: &'life3 PutObjectParams, contents: impl 'async_trait + Stream<Item = impl 'async_trait + AsRef<[u8]> + Send> + Send ) -> Pin<Box<dyn Future<Output = ObjectClientResult<PutObjectResult, PutObjectError, Self::ClientError>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,
Put an object into the object store.
The contents are provided by the client as an async stream of buffers.
source§fn get_object_attributes<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
bucket: &'life1 str,
key: &'life2 str,
_max_parts: Option<usize>,
_part_number_marker: Option<usize>,
object_attributes: &'life3 [ObjectAttribute]
) -> Pin<Box<dyn Future<Output = ObjectClientResult<GetObjectAttributesResult, GetObjectAttributesError, Self::ClientError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn get_object_attributes<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, bucket: &'life1 str, key: &'life2 str, _max_parts: Option<usize>, _part_number_marker: Option<usize>, object_attributes: &'life3 [ObjectAttribute] ) -> Pin<Box<dyn Future<Output = ObjectClientResult<GetObjectAttributesResult, GetObjectAttributesError, Self::ClientError>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,
Retrieves all the metadata from an object without returning the object contents.
Auto Trait Implementations§
impl RefUnwindSafe for MockClient
impl Send for MockClient
impl Sync for MockClient
impl Unpin for MockClient
impl UnwindSafe for MockClient
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