Skip to main content

Crate reinhardt_storages

Crate reinhardt_storages 

Source
Expand description

§reinhardt-storages

Cloud storage backend abstraction for the Reinhardt framework.

This crate provides a unified interface for interacting with multiple cloud storage providers (Amazon S3, Google Cloud Storage, Azure Blob Storage) and local file system.

§Features

  • Unified API: Single StorageBackend trait for all storage providers
  • Settings-first configuration: StorageSettings composes with the Reinhardt #[settings] macro
  • Async I/O: All operations are asynchronous using Tokio
  • Feature Flags: Enable only the backends you need
  • Temporary URLs: Generate S3 presigned URLs, GCS V4 signed URLs, and Azure SAS URLs for secure file sharing
  • Provider boundary: S3 uses reinhardt-providers for minimal HTTP and SigV4 support instead of depending on the full AWS SDK

§Example

use reinhardt_storages::{StorageSettings, create_storage_from_settings};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let settings: StorageSettings = toml::from_str(r#"
backend = "local"

[local]
base_path = "media"
"#)?;

    let storage = create_storage_from_settings(&settings).await?;
    storage.save("example.txt", b"Hello, world!").await?;
    let content = storage.open("example.txt").await?;

    Ok(())
}

§Compatibility

StorageConfig and provider-specific XxxConfig structs are deprecated. Use StorageSettings with create_storage_from_settings() for new code.

Re-exports§

pub use backend::StorageBackend;
pub use config::BackendType;
pub use config::StorageConfig;Deprecated
pub use error::Result;
pub use error::StorageError;
pub use factory::create_storage;
pub use factory::create_storage_from_settings;
pub use settings::LocalStorageSettings;
pub use settings::S3StorageSettings;
pub use settings::StorageSettings;

Modules§

backend
Storage backend trait definition.
backends
Storage backend implementations.
config
Compatibility configuration types for storage backends.
error
Error types for storage operations.
factory
Factory functions for creating storage backends.
settings
Settings fragment for storage backends.