Skip to main content

Storage

Trait Storage 

Source
pub trait Storage:
    Debug
    + Display
    + Sealed
    + Sync
    + Send
    + Serialize
    + Deserialize {
Show 19 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, 'async_trait>( &'life0 self, settings: &'life1 Settings, path: &'life2 str, range: Option<&'life3 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; fn put_object<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, settings: &'life1 Settings, path: &'life2 str, bytes: Bytes, content_type: Option<&'life3 str>, metadata: Vec<(String, String)>, previous_version: Option<&'life4 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; fn copy_object<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 self, settings: &'life1 Settings, from: &'life2 str, to: &'life3 str, content_type: Option<&'life4 str>, version: &'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 list_objects<'a, 'life0, 'life1, 'async_trait>( &'a self, settings: &'life0 Settings, prefix: &'life1 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; fn delete_batch<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, settings: &'life1 Settings, prefix: &'life2 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; fn get_object_last_modified<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, path: &'life1 str, settings: &'life2 Settings, ) -> Pin<Box<dyn Future<Output = StorageResult<DateTime<Utc>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn get_object_conditional<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, settings: &'life1 Settings, path: &'life2 str, previous_version: Option<&'life3 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; // 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, 'async_trait>( &'life0 self, settings: &'life1 Settings, path: &'life2 str, range: Option<&'life3 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_range_read<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, settings: &'life1 Settings, path: &'life2 str, range: Option<&'life3 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 list_objects_with_id_first_chars<'a, 'life0, 'life1, 'life2, 'async_trait>( &'a self, settings: &'life0 Settings, prefix: &'life1 str, first_chars: &'life2 HashSet<char>, ) -> 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_objects<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, settings: &'life1 Settings, prefix: &'life2 str, ids: BoxStream<'life3, (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 root_is_clean<'life0, 'life1, 'async_trait>( &'life0 self, settings: &'life1 Settings, ) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn get_object_concurrently_multiple<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, settings: &'life1 Settings, key: &'life2 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 { ... } fn get_object_concurrently<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, settings: &'life1 Settings, key: &'life2 str, range: &'life3 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 { ... }
}
Expand description

Implementations are free to assume files are never overwritten.

Required Methods§

Source

fn storage_info(&self) -> StorageInfo

Return structured metadata about this storage backend for display/repr.

Source

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,

Source

fn get_object_range<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, settings: &'life1 Settings, path: &'life2 str, range: Option<&'life3 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,

Source

fn put_object<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, settings: &'life1 Settings, path: &'life2 str, bytes: Bytes, content_type: Option<&'life3 str>, metadata: Vec<(String, String)>, previous_version: Option<&'life4 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,

Source

fn copy_object<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 self, settings: &'life1 Settings, from: &'life2 str, to: &'life3 str, content_type: Option<&'life4 str>, version: &'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,

Source

fn list_objects<'a, 'life0, 'life1, 'async_trait>( &'a self, settings: &'life0 Settings, prefix: &'life1 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,

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.

Source

fn delete_batch<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, settings: &'life1 Settings, prefix: &'life2 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,

Source

fn get_object_last_modified<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, path: &'life1 str, settings: &'life2 Settings, ) -> Pin<Box<dyn Future<Output = StorageResult<DateTime<Utc>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn get_object_conditional<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, settings: &'life1 Settings, path: &'life2 str, previous_version: Option<&'life3 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,

Provided Methods§

Source

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,

Source

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.

Source

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.

Source

fn get_object<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, settings: &'life1 Settings, path: &'life2 str, range: Option<&'life3 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,

Source

fn get_object_range_read<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, settings: &'life1 Settings, path: &'life2 str, range: Option<&'life3 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,

Source

fn list_objects_with_id_first_chars<'a, 'life0, 'life1, 'life2, 'async_trait>( &'a self, settings: &'life0 Settings, prefix: &'life1 str, first_chars: &'life2 HashSet<char>, ) -> 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,

Like Storage::list_objects, limited to ids whose first character is in first_chars. Unordered. Override to list each character concurrently; the default filters.

Source

fn delete_objects<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, settings: &'life1 Settings, prefix: &'life2 str, ids: BoxStream<'life3, (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,

Delete a stream of objects, by their id string representations Input stream includes sizes to get as result the total number of bytes deleted

Source

fn root_is_clean<'life0, 'life1, 'async_trait>( &'life0 self, settings: &'life1 Settings, ) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn get_object_concurrently_multiple<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, settings: &'life1 Settings, key: &'life2 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,

Source

fn get_object_concurrently<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, settings: &'life1 Settings, key: &'life2 str, range: &'life3 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,

Trait Implementations§

Source§

impl<'typetag> Serialize for dyn Storage + 'typetag

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'typetag> Serialize for dyn Storage + Send + 'typetag

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'typetag> Serialize for dyn Storage + Sync + 'typetag

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'typetag> Serialize for dyn Storage + Send + Sync + 'typetag

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§