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

source

pub fn new(config: MockClientConfig) -> Self

Create a new MockClient with the given config

source

pub fn add_object(&self, key: &str, value: MockObject)

Add an object to this mock client’s bucket

source

pub fn remove_object(&self, key: &str)

Remove object for the mock client’s bucket

source

pub fn contains_key(&self, key: &str) -> bool

Returns true if this mock client’s bucket contains the specified key

source

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

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

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,

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,

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,

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,

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,

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,

Retrieves all the metadata from an object without returning the object contents.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more