pub trait ObjectOps: Send + Sync {
// Required methods
fn put<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Path,
bytes: Bytes,
req: PutRequest,
) -> Pin<Box<dyn Future<Output = Result<PutOutcome, ObjectStoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn put_from_path<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 Path,
src: &'life2 Path,
threshold: u64,
chunk_size: usize,
req: PutRequest,
) -> Pin<Box<dyn Future<Output = Result<PutOutcome, ObjectStoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Bytes, ObjectStoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_capped<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Path,
max_bytes: u64,
) -> Pin<Box<dyn Future<Output = Result<Bytes, ObjectStoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_range<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Path,
range: GetRange,
) -> Pin<Box<dyn Future<Output = Result<Bytes, ObjectStoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn head<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<ObjectMeta, ObjectStoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn list<'life0, 'async_trait>(
&'life0 self,
prefix: Option<Path>,
) -> Pin<Box<dyn Future<Output = Result<Vec<ObjectMeta>, ObjectStoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn list_stream(
&self,
prefix: Option<Path>,
) -> BoxStream<'static, Result<ObjectMeta, ObjectStoreError>>;
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<(), ObjectStoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Async object-store operations. The trait is Send + Sync, so tasks can
share it.
The trait stays dyn-safe and #[automock]-able. It expresses multipart
upload as ObjectOps::put_from_path over a filesystem path, not over a
generic reader. The trait thus mocks cleanly for mutation-testable IO
decision logic.
Required Methods§
Sourcefn put<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Path,
bytes: Bytes,
req: PutRequest,
) -> Pin<Box<dyn Future<Output = Result<PutOutcome, ObjectStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn put<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Path,
bytes: Bytes,
req: PutRequest,
) -> Pin<Box<dyn Future<Output = Result<PutOutcome, ObjectStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Single-PUT an in-memory payload under the preconditions in req.
Sourcefn put_from_path<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 Path,
src: &'life2 Path,
threshold: u64,
chunk_size: usize,
req: PutRequest,
) -> Pin<Box<dyn Future<Output = Result<PutOutcome, ObjectStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn put_from_path<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 Path,
src: &'life2 Path,
threshold: u64,
chunk_size: usize,
req: PutRequest,
) -> Pin<Box<dyn Future<Output = Result<PutOutcome, ObjectStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Upload a local file. The method uses single-PUT below threshold
bytes, and streaming multipart in chunk_size parts at or above
threshold.
Sourcefn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Bytes, ObjectStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Bytes, ObjectStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetch a whole object.
Sourcefn get_capped<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Path,
max_bytes: u64,
) -> Pin<Box<dyn Future<Output = Result<Bytes, ObjectStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_capped<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Path,
max_bytes: u64,
) -> Pin<Box<dyn Future<Output = Result<Bytes, ObjectStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetch a whole object with a byte limit enforced before buffering its body.
Bind the GET to the HEAD version or etag when the backend provides one, and reject an oversized response while streaming even without either.
Sourcefn get_range<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Path,
range: GetRange,
) -> Pin<Box<dyn Future<Output = Result<Bytes, ObjectStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_range<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Path,
range: GetRange,
) -> Pin<Box<dyn Future<Output = Result<Bytes, ObjectStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetch a byte range of an object.
Sourcefn head<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<ObjectMeta, ObjectStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn head<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<ObjectMeta, ObjectStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetch object metadata, such as the size and the etag.
Sourcefn list<'life0, 'async_trait>(
&'life0 self,
prefix: Option<Path>,
) -> Pin<Box<dyn Future<Output = Result<Vec<ObjectMeta>, ObjectStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list<'life0, 'async_trait>(
&'life0 self,
prefix: Option<Path>,
) -> Pin<Box<dyn Future<Output = Result<Vec<ObjectMeta>, ObjectStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List objects under an optional prefix, collecting the whole listing.
A prefix holding millions of keys costs that much memory here. Prefer
ObjectOps::list_stream whenever the caller can consume the listing
as it arrives.
Sourcefn list_stream(
&self,
prefix: Option<Path>,
) -> BoxStream<'static, Result<ObjectMeta, ObjectStoreError>>
fn list_stream( &self, prefix: Option<Path>, ) -> BoxStream<'static, Result<ObjectMeta, ObjectStoreError>>
List objects under an optional prefix as a stream, one object at a time, so a caller never holds the whole listing at once.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".