Trait object_store::ObjectStore
source · [−]pub trait ObjectStore: Display + Send + Sync + Debug + 'static {
Show 14 methods
fn put<'life0, 'life1, 'async_trait>(
&'life0 self,
location: &'life1 Path,
bytes: Bytes
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn put_multipart<'life0, 'life1, 'async_trait>(
&'life0 self,
location: &'life1 Path
) -> Pin<Box<dyn Future<Output = Result<(MultipartId, Box<dyn AsyncWrite + Unpin + Send>)>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn abort_multipart<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
location: &'life1 Path,
multipart_id: &'life2 MultipartId
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
location: &'life1 Path
) -> Pin<Box<dyn Future<Output = Result<GetResult>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn get_range<'life0, 'life1, 'async_trait>(
&'life0 self,
location: &'life1 Path,
range: Range<usize>
) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn head<'life0, 'life1, 'async_trait>(
&'life0 self,
location: &'life1 Path
) -> Pin<Box<dyn Future<Output = Result<ObjectMeta>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
location: &'life1 Path
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: Option<&'life1 Path>
) -> Pin<Box<dyn Future<Output = Result<BoxStream<'_, Result<ObjectMeta>>>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn list_with_delimiter<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: Option<&'life1 Path>
) -> Pin<Box<dyn Future<Output = Result<ListResult>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn copy<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
from: &'life1 Path,
to: &'life2 Path
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
fn copy_if_not_exists<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
from: &'life1 Path,
to: &'life2 Path
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
fn get_ranges<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
location: &'life1 Path,
ranges: &'life2 [Range<usize>]
) -> Pin<Box<dyn Future<Output = Result<Vec<Bytes>>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
{ ... }
fn rename<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
from: &'life1 Path,
to: &'life2 Path
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
{ ... }
fn rename_if_not_exists<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
from: &'life1 Path,
to: &'life2 Path
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
{ ... }
}
Expand description
Universal API to multiple object store services.
Required Methods
Save the provided bytes to the specified location.
sourcefn put_multipart<'life0, 'life1, 'async_trait>(
&'life0 self,
location: &'life1 Path
) -> Pin<Box<dyn Future<Output = Result<(MultipartId, Box<dyn AsyncWrite + Unpin + Send>)>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn put_multipart<'life0, 'life1, 'async_trait>(
&'life0 self,
location: &'life1 Path
) -> Pin<Box<dyn Future<Output = Result<(MultipartId, Box<dyn AsyncWrite + Unpin + Send>)>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Get a multi-part upload that allows writing data in chunks
Most cloud-based uploads will buffer and upload parts in parallel.
To complete the upload, AsyncWrite::poll_shutdown must be called to completion.
For some object stores (S3, GCS, and local in particular), if the writer fails or panics, you must call ObjectStore::abort_multipart to clean up partially written data.
sourcefn abort_multipart<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
location: &'life1 Path,
multipart_id: &'life2 MultipartId
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn abort_multipart<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
location: &'life1 Path,
multipart_id: &'life2 MultipartId
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Cleanup an aborted upload.
See documentation for individual stores for exact behavior, as capabilities vary by object store.
Return the bytes that are stored at the specified location.
Return the bytes that are stored at the specified location in the given byte range
Return the metadata for the specified location
Delete the object at the specified location.
List all the objects with the given prefix.
Prefixes are evaluated on a path segment basis, i.e. foo/bar/
is a prefix of foo/bar/x
but not of
foo/bar_baz/x
.
sourcefn list_with_delimiter<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: Option<&'life1 Path>
) -> Pin<Box<dyn Future<Output = Result<ListResult>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn list_with_delimiter<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: Option<&'life1 Path>
) -> Pin<Box<dyn Future<Output = Result<ListResult>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
List objects with the given prefix and an implementation specific delimiter. Returns common prefixes (directories) in addition to object metadata.
Prefixes are evaluated on a path segment basis, i.e. foo/bar/
is a prefix of foo/bar/x
but not of
foo/bar_baz/x
.
Copy an object from one path to another in the same object store.
If there exists an object at the destination, it will be overwritten.
Copy an object from one path to another, only if destination is empty.
Will return an error if the destination already has an object.
Performs an atomic operation if the underlying object storage supports it. If atomic operations are not supported by the underlying object storage (like S3) it will return an error.
Provided Methods
Return the bytes that are stored at the specified location in the given byte ranges
Move an object from one path to another in the same object store.
By default, this is implemented as a copy and then delete source. It may not check when deleting source that it was the same object that was originally copied.
If there exists an object at the destination, it will be overwritten.
Move an object from one path to another in the same object store.
Will return an error if the destination already has an object.