Skip to main content

Crate sz_orm_storage

Crate sz_orm_storage 

Source
Expand description

§SZ-ORM Storage — Object Storage

Provides unified object storage abstraction, supports S3, Aliyun OSS, Qiniu Kodo, Huawei OBS, Tencent COS, UpYun, and local file system, configurable multi-provider via StorageBuilder.

§Production Readiness Notes

The production readiness grading for each provider in this crate is as follows:

ProviderModuleStatus
Local (local filesystem)local✅ Production ready
S3 (AWS S3 compatible)s3_sdk module (feature = “s3-sdk”)✅ Production ready (based on rust-s3 crate)
Aliyun OSSreal (feature = “real-cloud”)✅ Production ready (based on OpenDAL)
Tencent COSreal (feature = “real-cloud”)✅ Production ready (based on OpenDAL)
Huawei OBSreal (feature = “real-cloud”)✅ Production ready (based on OpenDAL)
UpYunreal (feature = “real-cloud”)✅ Production ready (based on OpenDAL)
Qiniu Kodoreal (feature = “real-cloud”)✅ Production ready (official REST API + HMAC-SHA1)
Above clouds (feature not enabled)aliyun tencent qiniu huawei upyun s3⚠️ MOCK-ONLY (in-memory HashMap)

§Using Real Cloud Storage

[dependencies]
sz-orm-storage = { version = "1.2", features = ["real-cloud"] }
use sz_orm_storage::{Storage, StorageBuilder, StorageProvider};

let storage = StorageBuilder::new(StorageProvider::AliyunOss(Default::default()))
    .with_bucket("my-bucket")
    .with_endpoint("oss-cn-hangzhou.aliyuncs.com")
    .with_access_key("AK...")
    .with_secret_key("SK...")
    .build()?;
let url = storage.put("a.txt", b"data", "text/plain").await?;

When real-cloud is enabled, StorageBuilder::build() automatically constructs real cloud client; returns StorageError::InvalidConfig when credentials are not configured, does not silently degrade to Mock.

§Main Modules

Re-exports§

pub use advanced::estimate_remaining_seconds;
pub use advanced::format_size;
pub use advanced::object_age_days;
pub use advanced::BucketLifecycle;
pub use advanced::CdnRefresher;
pub use advanced::LifecycleAction;
pub use advanced::LifecycleEvaluationResult;
pub use advanced::LifecycleRule;
pub use advanced::MultipartUpload;
pub use advanced::MultipartUploadSnapshot;
pub use advanced::Part;
pub use advanced::RefreshRequest;
pub use advanced::RefreshStatus;
pub use advanced::RefreshType;
pub use advanced::ResumableUploadManager;
pub use advanced::UploadStatus;
pub use error::StorageError;
pub use storage::StorageBuilder;
pub use storage::StorageConfig;
pub use storage::StorageProvider;
pub use storage::StorageWrapper;
pub use aliyun::AliyunOssStorage;
pub use huawei::HuaweiObsStorage;
pub use local::LocalStorage;
pub use qiniu::QiniuKodoStorage;
pub use s3::S3Storage;
pub use tencent::TencentCosStorage;
pub use upyun::UpYunStorage;
pub use storage::*;

Modules§

advanced
高级存储功能
aliyun
Aliyun OSS Storage(MOCK-ONLY,非生产可用
error
huawei
Huawei OBS Storage(MOCK-ONLY,非生产可用
local
qiniu
Qiniu Kodo Storage(MOCK-ONLY,非生产可用
s3
S3 Storage(MOCK-ONLY,非生产可用
storage
tencent
Tencent COS Storage(MOCK-ONLY,非生产可用
upyun
UpYun Storage(MOCK-ONLY,非生产可用