pub struct CountingBackend { /* private fields */ }Expand description
A Backend decorator that counts each operation performed for COGS.
See the module documentation for how it should be used.
Implementations§
Source§impl CountingBackend
impl CountingBackend
Sourcepub fn new(inner: Box<dyn Backend>) -> Self
pub fn new(inner: Box<dyn Backend>) -> Self
Creates a CountingBackend that wraps inner and increments cogs.usage
before delegating operations to it.
Trait Implementations§
Source§impl Backend for CountingBackend
impl Backend for CountingBackend
Source§fn upload_granularity(&self) -> u64
fn upload_granularity(&self) -> u64
Returns the upload granularity for sessions opened by this backend, in bytes. Read more
Source§fn put_object<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 ObjectId,
metadata: &'life2 Metadata,
stream: ClientStream,
access_time: Timestamp,
) -> Pin<Box<dyn Future<Output = Result<PutResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn put_object<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 ObjectId,
metadata: &'life2 Metadata,
stream: ClientStream,
access_time: Timestamp,
) -> Pin<Box<dyn Future<Output = Result<PutResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Stores an object at the given path with the given metadata.
Source§fn get_object<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ObjectId,
access_time: Timestamp,
range: Option<ByteRange>,
) -> Pin<Box<dyn Future<Output = Result<GetResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_object<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ObjectId,
access_time: Timestamp,
range: Option<ByteRange>,
) -> Pin<Box<dyn Future<Output = Result<GetResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieves (part of) an object at the given path, returning its metadata, a description of
the part being returned, and the payload.
Source§fn get_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ObjectId,
access_time: Timestamp,
) -> Pin<Box<dyn Future<Output = Result<MetadataResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ObjectId,
access_time: Timestamp,
) -> Pin<Box<dyn Future<Output = Result<MetadataResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieves only the metadata for an object, without the payload.
Source§fn set_expiry<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ObjectId,
target: ExpiryUpdate,
access_time: Timestamp,
) -> Pin<Box<dyn Future<Output = Result<SetExpiryResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn set_expiry<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ObjectId,
target: ExpiryUpdate,
access_time: Timestamp,
) -> Pin<Box<dyn Future<Output = Result<SetExpiryResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Extends the deadline of an existing object with expiration policy. Read more
Source§fn delete_object<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ObjectId,
access_time: Timestamp,
) -> Pin<Box<dyn Future<Output = Result<DeleteResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_object<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ObjectId,
access_time: Timestamp,
) -> Pin<Box<dyn Future<Output = Result<DeleteResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Deletes the object at the given path.
Source§fn join<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn join<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Waits for any outstanding background operations to complete before shutdown. Read more
Source§fn create_upload_session<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 ObjectId,
metadata: &'life2 Metadata,
upload_length: NonZeroU64,
) -> Pin<Box<dyn Future<Output = Result<Option<BackendToken>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn create_upload_session<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 ObjectId,
metadata: &'life2 Metadata,
upload_length: NonZeroU64,
) -> Pin<Box<dyn Future<Output = Result<Option<BackendToken>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Creates a resumable upload session for the object at
id. Read moreSource§fn put_chunk<'life0, 'life1, 'async_trait>(
&'life0 self,
session: &'life1 Session,
offset: u64,
content_length: u64,
stream: ClientStream,
) -> Pin<Box<dyn Future<Output = Result<UploadProgress>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn put_chunk<'life0, 'life1, 'async_trait>(
&'life0 self,
session: &'life1 Session,
offset: u64,
content_length: u64,
stream: ClientStream,
) -> Pin<Box<dyn Future<Output = Result<UploadProgress>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn upload_offset<'life0, 'life1, 'async_trait>(
&'life0 self,
session: &'life1 Session,
) -> Pin<Box<dyn Future<Output = Result<UploadProgress>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn upload_offset<'life0, 'life1, 'async_trait>(
&'life0 self,
session: &'life1 Session,
) -> Pin<Box<dyn Future<Output = Result<UploadProgress>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Reports how far the session has progressed. Read more
Source§fn cancel_upload<'life0, 'life1, 'async_trait>(
&'life0 self,
session: &'life1 Session,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn cancel_upload<'life0, 'life1, 'async_trait>(
&'life0 self,
session: &'life1 Session,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Cancels an upload session, discarding whatever was uploaded. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for CountingBackend
impl !UnwindSafe for CountingBackend
impl Freeze for CountingBackend
impl Send for CountingBackend
impl Sync for CountingBackend
impl Unpin for CountingBackend
impl UnsafeUnpin for CountingBackend
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
Converts
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> ⓘ
Converts
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>
Wrap the input message
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>,
Applies the layer to a service and wraps it in [
Layered].