pub trait ObjectStore: Send + Sync {
type StreamingUploader: StreamingUploader;
// Required methods
fn get_object_prefix(
&self,
obj_id: u64,
use_new_object_prefix_strategy: bool,
) -> String;
fn upload<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
obj: Bytes,
) -> Pin<Box<dyn Future<Output = ObjectResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn streaming_upload<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = ObjectResult<Self::StreamingUploader>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn read<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
range: impl 'async_trait + ObjectRangeBounds,
) -> Pin<Box<dyn Future<Output = ObjectResult<Bytes>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn streaming_read<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
read_range: Range<usize>,
) -> Pin<Box<dyn Future<Output = ObjectResult<ObjectDataStream>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = ObjectResult<ObjectMetadata>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = ObjectResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn delete_objects<'life0, 'life1, 'async_trait>(
&'life0 self,
paths: &'life1 [String],
) -> Pin<Box<dyn Future<Output = ObjectResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 str,
start_after: Option<String>,
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = ObjectResult<ObjectMetadataIter>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn store_media_type(&self) -> &'static str;
// Provided methods
fn monitored(
self,
metrics: Arc<ObjectStoreMetrics>,
config: Arc<ObjectStoreConfig>,
) -> MonitoredObjectStore<Self>
where Self: Sized { ... }
fn support_streaming_upload(&self) -> bool { ... }
}
Expand description
The implementation must be thread-safe.
Required Associated Types§
Required Methods§
sourcefn get_object_prefix(
&self,
obj_id: u64,
use_new_object_prefix_strategy: bool,
) -> String
fn get_object_prefix( &self, obj_id: u64, use_new_object_prefix_strategy: bool, ) -> String
Get the key prefix for object, the prefix is determined by the type of object store and devise_object_prefix
.
sourcefn upload<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
obj: Bytes,
) -> Pin<Box<dyn Future<Output = ObjectResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn upload<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
obj: Bytes,
) -> Pin<Box<dyn Future<Output = ObjectResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Uploads the object to ObjectStore
.
fn streaming_upload<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = ObjectResult<Self::StreamingUploader>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
sourcefn read<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
range: impl 'async_trait + ObjectRangeBounds,
) -> Pin<Box<dyn Future<Output = ObjectResult<Bytes>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
range: impl 'async_trait + ObjectRangeBounds,
) -> Pin<Box<dyn Future<Output = ObjectResult<Bytes>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
If objects are PUT using a multipart upload, it’s a good practice to GET them in the same part sizes (or at least aligned to part boundaries) for best performance. https://d1.awsstatic.com/whitepapers/AmazonS3BestPractices.pdf?stod_obj2
sourcefn streaming_read<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
read_range: Range<usize>,
) -> Pin<Box<dyn Future<Output = ObjectResult<ObjectDataStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn streaming_read<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
read_range: Range<usize>,
) -> Pin<Box<dyn Future<Output = ObjectResult<ObjectDataStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Returns a stream reading the object specified in path
. If given, the stream starts at the
byte with index start_pos
(0-based). As far as possible, the stream only loads the amount
of data into memory that is read from the stream.
sourcefn metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = ObjectResult<ObjectMetadata>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = ObjectResult<ObjectMetadata>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Obtains the object metadata.
sourcefn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = ObjectResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = ObjectResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Deletes blob permanently.
sourcefn delete_objects<'life0, 'life1, 'async_trait>(
&'life0 self,
paths: &'life1 [String],
) -> Pin<Box<dyn Future<Output = ObjectResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_objects<'life0, 'life1, 'async_trait>(
&'life0 self,
paths: &'life1 [String],
) -> Pin<Box<dyn Future<Output = ObjectResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Deletes the objects with the given paths permanently from the storage. If an object specified in the request is not found, it will be considered as successfully deleted.