pub trait Storage:
Debug
+ Display
+ Sealed
+ Sync
+ Send
+ Serialize
+ Deserialize {
Show 20 methods
// Required methods
fn storage_info(&self) -> StorageInfo;
fn can_write<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_object_range<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
ctx: &'life1 StorageContext<'life2>,
path: &'life3 str,
range: Option<&'life4 Range<u64>>,
) -> Pin<Box<dyn Future<Output = StorageResult<(Pin<Box<dyn Stream<Item = Result<Bytes, StorageError>> + Send>>, VersionInfo)>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait;
fn put_object<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
ctx: &'life1 StorageContext<'life2>,
path: &'life3 str,
bytes: Bytes,
content_type: Option<&'life4 str>,
metadata: Vec<(String, String)>,
previous_version: Option<&'life5 VersionInfo>,
) -> Pin<Box<dyn Future<Output = StorageResult<VersionedUpdateResult>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait;
fn copy_object<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'async_trait>(
&'life0 self,
ctx: &'life1 StorageContext<'life2>,
from: &'life3 str,
to: &'life4 str,
content_type: Option<&'life5 str>,
version: &'life6 VersionInfo,
) -> Pin<Box<dyn Future<Output = StorageResult<VersionedUpdateResult>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
'life6: 'async_trait;
fn list_objects<'a, 'life0, 'life1, 'life2, 'async_trait>(
&'a self,
ctx: &'life0 StorageContext<'life1>,
prefix: &'life2 str,
) -> Pin<Box<dyn Future<Output = StorageResult<BoxStream<'a, StorageResult<ListInfo<String>>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn delete_batch<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 StorageContext<'life2>,
prefix: &'life3 str,
batch: Vec<(String, u64)>,
) -> Pin<Box<dyn Future<Output = StorageResult<DeleteObjectsResult>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn get_object_last_modified<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 StorageContext<'life2>,
path: &'life3 str,
) -> Pin<Box<dyn Future<Output = StorageResult<DateTime<Utc>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn get_object_conditional<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
ctx: &'life1 StorageContext<'life2>,
path: &'life3 str,
previous_version: Option<&'life4 VersionInfo>,
) -> Pin<Box<dyn Future<Output = StorageResult<GetModifiedResult>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait;
// Provided methods
fn default_settings<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<Settings>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn can_create_repository<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<RepositoryCreation>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn create_location_if_needed<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_object<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
ctx: &'life1 StorageContext<'life2>,
path: &'life3 str,
range: Option<&'life4 Range<u64>>,
) -> Pin<Box<dyn Future<Output = StorageResult<(Pin<Box<dyn AsyncBufRead + Send>>, VersionInfo)>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait { ... }
fn get_object_range_read<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
ctx: &'life1 StorageContext<'life2>,
path: &'life3 str,
range: Option<&'life4 Range<u64>>,
) -> Pin<Box<dyn Future<Output = StorageResult<(Pin<Box<dyn AsyncBufRead + Send>>, VersionInfo)>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait { ... }
fn list_objects_with_id_prefixes<'a, 'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'a self,
ctx: &'life0 StorageContext<'life1>,
prefix: &'life2 str,
id_prefixes: &'life3 [String],
) -> Pin<Box<dyn Future<Output = StorageResult<BoxStream<'a, StorageResult<ListInfo<String>>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn lists_id_prefixes_natively(&self) -> bool { ... }
fn delete_objects<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
ctx: &'life1 StorageContext<'life2>,
prefix: &'life3 str,
ids: BoxStream<'life4, (String, u64)>,
) -> Pin<Box<dyn Future<Output = StorageResult<DeleteObjectsResult>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait { ... }
fn root_is_clean<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 StorageContext<'life2>,
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn get_object_concurrently_multiple<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 StorageContext<'life2>,
key: &'life3 str,
parts: Vec<Range<u64>>,
) -> Pin<Box<dyn Future<Output = StorageResult<(Pin<Box<dyn AsyncBufRead + Send>>, VersionInfo)>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn get_object_concurrently<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
ctx: &'life1 StorageContext<'life2>,
key: &'life3 str,
range: &'life4 Range<u64>,
) -> Pin<Box<dyn Future<Output = StorageResult<(Pin<Box<dyn AsyncBufRead + Send>>, VersionInfo)>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait { ... }
}Expand description
Implementations are free to assume files are never overwritten.
Required Methods§
Sourcefn storage_info(&self) -> StorageInfo
fn storage_info(&self) -> StorageInfo
Return structured metadata about this storage backend for display/repr.
fn can_write<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_object_range<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
ctx: &'life1 StorageContext<'life2>,
path: &'life3 str,
range: Option<&'life4 Range<u64>>,
) -> Pin<Box<dyn Future<Output = StorageResult<(Pin<Box<dyn Stream<Item = Result<Bytes, StorageError>> + Send>>, VersionInfo)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn put_object<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
ctx: &'life1 StorageContext<'life2>,
path: &'life3 str,
bytes: Bytes,
content_type: Option<&'life4 str>,
metadata: Vec<(String, String)>,
previous_version: Option<&'life5 VersionInfo>,
) -> Pin<Box<dyn Future<Output = StorageResult<VersionedUpdateResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
fn copy_object<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'async_trait>(
&'life0 self,
ctx: &'life1 StorageContext<'life2>,
from: &'life3 str,
to: &'life4 str,
content_type: Option<&'life5 str>,
version: &'life6 VersionInfo,
) -> Pin<Box<dyn Future<Output = StorageResult<VersionedUpdateResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
'life6: 'async_trait,
Sourcefn list_objects<'a, 'life0, 'life1, 'life2, 'async_trait>(
&'a self,
ctx: &'life0 StorageContext<'life1>,
prefix: &'life2 str,
) -> Pin<Box<dyn Future<Output = StorageResult<BoxStream<'a, StorageResult<ListInfo<String>>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn list_objects<'a, 'life0, 'life1, 'life2, 'async_trait>(
&'a self,
ctx: &'life0 StorageContext<'life1>,
prefix: &'life2 str,
) -> Pin<Box<dyn Future<Output = StorageResult<BoxStream<'a, StorageResult<ListInfo<String>>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
List objects in storage whose keys start with the given prefix.
Returns a stream of ListInfo entries, each containing the object’s key and size in bytes.
Pass an empty prefix to list all objects in the repository’s storage root.
fn delete_batch<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 StorageContext<'life2>,
prefix: &'life3 str,
batch: Vec<(String, u64)>,
) -> Pin<Box<dyn Future<Output = StorageResult<DeleteObjectsResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn get_object_last_modified<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 StorageContext<'life2>,
path: &'life3 str,
) -> Pin<Box<dyn Future<Output = StorageResult<DateTime<Utc>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn get_object_conditional<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
ctx: &'life1 StorageContext<'life2>,
path: &'life3 str,
previous_version: Option<&'life4 VersionInfo>,
) -> Pin<Box<dyn Future<Output = StorageResult<GetModifiedResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Provided Methods§
fn default_settings<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<Settings>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn can_create_repository<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<RepositoryCreation>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn can_create_repository<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<RepositoryCreation>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Whether a repository may be created at this storage location.
Sourcefn create_location_if_needed<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create_location_if_needed<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Ensure the storage location is ready to receive writes.
Called by [Repository::create] before any other I/O. The default
implementation is a no-op; backends that need to materialize the
location (e.g. the local filesystem creating the directory) override
this. Read paths like open never call it, so a missing location
stays missing.
fn get_object<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
ctx: &'life1 StorageContext<'life2>,
path: &'life3 str,
range: Option<&'life4 Range<u64>>,
) -> Pin<Box<dyn Future<Output = StorageResult<(Pin<Box<dyn AsyncBufRead + Send>>, VersionInfo)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn get_object_range_read<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
ctx: &'life1 StorageContext<'life2>,
path: &'life3 str,
range: Option<&'life4 Range<u64>>,
) -> Pin<Box<dyn Future<Output = StorageResult<(Pin<Box<dyn AsyncBufRead + Send>>, VersionInfo)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Sourcefn list_objects_with_id_prefixes<'a, 'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'a self,
ctx: &'life0 StorageContext<'life1>,
prefix: &'life2 str,
id_prefixes: &'life3 [String],
) -> Pin<Box<dyn Future<Output = StorageResult<BoxStream<'a, StorageResult<ListInfo<String>>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn list_objects_with_id_prefixes<'a, 'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'a self,
ctx: &'life0 StorageContext<'life1>,
prefix: &'life2 str,
id_prefixes: &'life3 [String],
) -> Pin<Box<dyn Future<Output = StorageResult<BoxStream<'a, StorageResult<ListInfo<String>>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Like Storage::list_objects, limited to ids that start with one of id_prefixes.
Unordered. Override to list each prefix concurrently; the default filters.
Sourcefn lists_id_prefixes_natively(&self) -> bool
fn lists_id_prefixes_natively(&self) -> bool
Whether list_objects_with_id_prefixes lists each prefix on the server
rather than filtering a full listing. Callers fan out only when true.
Sourcefn delete_objects<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
ctx: &'life1 StorageContext<'life2>,
prefix: &'life3 str,
ids: BoxStream<'life4, (String, u64)>,
) -> Pin<Box<dyn Future<Output = StorageResult<DeleteObjectsResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn delete_objects<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
ctx: &'life1 StorageContext<'life2>,
prefix: &'life3 str,
ids: BoxStream<'life4, (String, u64)>,
) -> Pin<Box<dyn Future<Output = StorageResult<DeleteObjectsResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Delete a stream of objects, by their id string representations Input stream includes sizes to get as result the total number of bytes deleted
fn root_is_clean<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 StorageContext<'life2>,
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_object_concurrently_multiple<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 StorageContext<'life2>,
key: &'life3 str,
parts: Vec<Range<u64>>,
) -> Pin<Box<dyn Future<Output = StorageResult<(Pin<Box<dyn AsyncBufRead + Send>>, VersionInfo)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn get_object_concurrently<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
ctx: &'life1 StorageContext<'life2>,
key: &'life3 str,
range: &'life4 Range<u64>,
) -> Pin<Box<dyn Future<Output = StorageResult<(Pin<Box<dyn AsyncBufRead + Send>>, VersionInfo)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Trait Implementations§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".