CloudStorage

Trait CloudStorage 

Source
pub trait CloudStorage: Send + Sync {
Show 14 methods // Required methods fn get_object<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CloudError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn put_object<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, key: &'life1 str, data: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = Result<(), CloudError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait; fn delete_object<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), CloudError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn list_objects<'life0, 'life1, 'async_trait>( &'life0 self, prefix: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, CloudError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn get_object_metadata<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<ObjectMetadata, CloudError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; // Provided methods fn get_object_with_options<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, key: &'life1 str, options: &'life2 GetObjectOptions, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CloudError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait { ... } fn put_object_with_options<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, key: &'life1 str, data: &'life2 [u8], options: &'life3 PutObjectOptions, ) -> Pin<Box<dyn Future<Output = Result<(), CloudError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait { ... } fn list_objects_with_limit<'life0, 'life1, 'async_trait>( &'life0 self, prefix: &'life1 str, max_results: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, CloudError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait { ... } fn object_exists<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, CloudError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait { ... } fn copy_object<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, from_key: &'life1 str, to_key: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), CloudError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait { ... } fn move_object<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, from_key: &'life1 str, to_key: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), CloudError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait { ... } fn provider_name(&self) -> &str { ... } fn delete_objects<'life0, 'life1, 'async_trait>( &'life0 self, keys: &'life1 [String], ) -> Pin<Box<dyn Future<Output = Result<(), CloudError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait { ... } fn list_objects_with_metadata<'life0, 'life1, 'async_trait>( &'life0 self, prefix: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<ObjectMetadata>, CloudError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait { ... }
}
Expand description

Unified trait for cloud object storage.

This trait provides a consistent interface for object storage operations across different cloud providers (AWS S3, GCP Cloud Storage, Azure Blob Storage).

Required Methods§

Source

fn get_object<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CloudError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Gets an object by key.

§Arguments
  • key - The object key/path
§Returns

Returns the object data as bytes.

§Errors

Returns CloudError::StorageObjectNotFound if the object doesn’t exist. Returns CloudError::StorageFetch if the fetch operation fails.

Source

fn put_object<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, key: &'life1 str, data: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = Result<(), CloudError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Puts an object with key.

§Arguments
  • key - The object key/path
  • data - The object data
§Errors

Returns CloudError::StoragePut if the put operation fails.

Source

fn delete_object<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), CloudError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Deletes an object.

§Arguments
  • key - The object key/path to delete
§Errors

Returns CloudError::StorageDelete if the delete operation fails.

Source

fn list_objects<'life0, 'life1, 'async_trait>( &'life0 self, prefix: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, CloudError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Lists objects with a given prefix.

§Arguments
  • prefix - The prefix to filter objects
§Returns

Returns a vector of object keys/paths.

§Errors

Returns CloudError::StorageList if the list operation fails.

Source

fn get_object_metadata<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<ObjectMetadata, CloudError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Gets object metadata without fetching the full object.

§Arguments
  • key - The object key/path
§Returns

Returns metadata about the object.

§Errors

Returns CloudError::StorageObjectNotFound if the object doesn’t exist. Returns CloudError::StorageFetch if the metadata fetch fails.

Provided Methods§

Source

fn get_object_with_options<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, key: &'life1 str, options: &'life2 GetObjectOptions, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CloudError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Gets an object with options.

§Arguments
  • key - The object key/path
  • options - Fetch options (range, conditional fetch, etc.)
§Returns

Returns the object data as bytes.

§Errors

Returns CloudError::StorageFetch if the fetch operation fails.

Source

fn put_object_with_options<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, key: &'life1 str, data: &'life2 [u8], options: &'life3 PutObjectOptions, ) -> Pin<Box<dyn Future<Output = Result<(), CloudError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

Puts an object with options.

§Arguments
  • key - The object key/path
  • data - The object data
  • options - Upload options (content type, encryption, etc.)
§Errors

Returns CloudError::StoragePut if the put operation fails.

Source

fn list_objects_with_limit<'life0, 'life1, 'async_trait>( &'life0 self, prefix: &'life1 str, max_results: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, CloudError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Lists objects with a given prefix and limit.

§Arguments
  • prefix - The prefix to filter objects
  • max_results - Maximum number of results to return
§Returns

Returns a vector of object keys/paths.

§Errors

Returns CloudError::StorageList if the list operation fails.

Source

fn object_exists<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, CloudError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Checks if an object exists.

§Arguments
  • key - The object key/path to check
§Returns

Returns true if the object exists, false otherwise.

§Errors

Returns CloudError::StorageFetch if the check operation fails (but not if the object simply doesn’t exist).

Source

fn copy_object<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, from_key: &'life1 str, to_key: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), CloudError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Copies an object within the same storage.

§Arguments
  • from_key - Source object key/path
  • to_key - Destination object key/path
§Errors

Returns CloudError::StorageFetch if the source doesn’t exist. Returns CloudError::StoragePut if the copy operation fails.

Source

fn move_object<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, from_key: &'life1 str, to_key: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), CloudError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Moves an object (copy then delete).

§Arguments
  • from_key - Source object key/path
  • to_key - Destination object key/path
§Errors

Returns errors from copy or delete operations.

Source

fn provider_name(&self) -> &str

Gets the storage provider name (e.g., “s3”, “gcs”, “azure”).

Source

fn delete_objects<'life0, 'life1, 'async_trait>( &'life0 self, keys: &'life1 [String], ) -> Pin<Box<dyn Future<Output = Result<(), CloudError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Deletes multiple objects in batch.

§Arguments
  • keys - Vector of object keys/paths to delete
§Errors

Returns CloudError::StorageDelete if the batch delete fails.

Source

fn list_objects_with_metadata<'life0, 'life1, 'async_trait>( &'life0 self, prefix: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<ObjectMetadata>, CloudError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Lists objects with metadata.

§Arguments
  • prefix - The prefix to filter objects
§Returns

Returns a vector of (key, metadata) tuples.

§Errors

Returns CloudError::StorageList if the list operation fails.

Implementors§