Files
mytheclipse/crates/mytheclipse-storage/src/lib.rs
T
asepharyana 4d851c5a58
CI / Rustfmt (push) Canceled after 0s
CI / Clippy (push) Canceled after 0s
CI / Test (workspace all features) (push) Canceled after 0s
CI / Test (workspace default features) (push) Canceled after 0s
CI / Test (mytheclipse / bg only) (push) Canceled after 0s
CI / Test (mytheclipse / compute only) (push) Canceled after 0s
CI / Test (mytheclipse / io only) (push) Canceled after 0s
CI / Test (mytheclipse / lifecycle only) (push) Canceled after 0s
CI / Test (mytheclipse / observability only) (push) Canceled after 0s
CI / Test (mytheclipse / resiliency only) (push) Canceled after 0s
CI / Test (mytheclipse / traffic only) (push) Canceled after 0s
CI / Test (mytheclipse-cache / l2-redis) (push) Canceled after 0s
CI / Test (mytheclipse-cache / l1-moka) (push) Canceled after 0s
CI / Test (mytheclipse-cache / default) (push) Canceled after 0s
CI / Test (mytheclipse-config / default) (push) Canceled after 0s
CI / Test (mytheclipse-crypto / default) (push) Canceled after 0s
CI / Test (mytheclipse-event / amqp) (push) Canceled after 0s
CI / Test (mytheclipse-event / nats) (push) Canceled after 0s
CI / Test (mytheclipse-event / default (mem)) (push) Canceled after 0s
CI / Test (mytheclipse-storage / gcs) (push) Canceled after 0s
CI / Test (mytheclipse-storage / s3) (push) Canceled after 0s
CI / Test (mytheclipse-storage / default (local)) (push) Canceled after 0s
CI / Run mytheclipse example (push) Canceled after 0s
CI / Docs check (push) Canceled after 0s
CI / Cargo package dry-run (mytheclipse) (push) Canceled after 0s
CI / Cargo package dry-run (mytheclipse-cache) (push) Canceled after 0s
CI / Cargo package dry-run (mytheclipse-config) (push) Canceled after 0s
CI / Cargo package dry-run (mytheclipse-crypto) (push) Canceled after 0s
CI / Cargo package dry-run (mytheclipse-event) (push) Canceled after 0s
CI / Cargo package dry-run (mytheclipse-storage) (push) Canceled after 0s
Release / Semantic Release (push) Canceled after 0s
chore: rename corex-* crates to mytheclipse-* namespace
Rename all `corex-cache`, `corex-storage`, `corex-event`, `corex-config`,
and `corex-crypto` crates to `mytheclipse-cache`, `mytheclipse-storage`,
`mytheclipse-event`, `mytheclipse-config`, and `mytheclipse-crypto`
respectively, aligning with the `mytheclipse` root crate naming convention.

- Convert root `Cargo.toml` from a package manifest to a workspace
  manifest with explicit member paths
- Update crate names in each `Cargo.toml` and docs.rs URLs
- Update all import paths, module doc comments, and error/panic messages
  from `corex-*` to `mytheclipse-*` across source and README files
- Update CI workflow and publish script to reference the new crate names<tool_call></think>chore: rename corex-* crates to mytheclipse-* namespace

Rename all `corex-cache`, `corex-storage`, `corex-event`, `corex-config`,
and `corex-crypto` crates to `mytheclipse-cache`, `mytheclipse-storage`,
`mytheclipse-event`, `mytheclipse-config`, and `mytheclipse-crypto`
respectively, aligning with the `mytheclipse` root crate naming convention.

- Convert root `Cargo.toml` from a package manifest to a workspace
  manifest with explicit member paths
- Update crate names in each `Cargo.toml` and docs.rs URLs
- Update all import paths, module doc comments, and error/panic messages
  from `corex-*` to `mytheclipse-*` across source and README files
- Update CI workflow and publish script to reference the new crate names
2026-08-28 22:29:49 +07:00

52 lines
1.6 KiB
Rust

//! # mytheclipse-storage
//!
//! A unified storage & file system abstraction so file handling doesn't get
//! locked to one physical storage location.
//!
//! - **Local disk** ([`local::LocalFileStorage`], feature `local`, default).
//! - **S3-compatible object storage** ([`s3::S3Storage`], feature `s3`) —
//! works with Amazon S3 and any S3-compatible endpoint, including MinIO
//! (pass a custom endpoint via [`s3::S3Storage::connect_with_endpoint`]).
//! - **Google Cloud Storage** ([`gcs::GcsStorage`], feature `gcs`).
//!
//! All operations are stream-based (an [`traits::ObjectStream`] is a boxed
//! [`tokio::io::AsyncRead`]), so uploading/downloading a huge object never
//! requires holding it entirely in memory.
//!
//! ## Example
//!
//! ```
//! use mytheclipse_storage::{LocalFileStorage, StorageDriver, bytes_stream, read_to_vec};
//! # #[tokio::main] async fn main() {
//! # let dir = tempfile::tempdir().unwrap();
//! let storage = LocalFileStorage::new(dir.path());
//! storage.put("hello.txt", bytes_stream(b"hi".to_vec())).await.unwrap();
//! let data = read_to_vec(storage.get("hello.txt").await.unwrap()).await.unwrap();
//! assert_eq!(data, b"hi");
//! # }
//! ```
pub mod traits;
#[cfg(feature = "local")]
pub mod local;
#[cfg(feature = "s3")]
pub mod s3;
#[cfg(feature = "gcs")]
pub mod gcs;
pub use traits::{
bytes_stream, read_to_vec, ObjectMeta, ObjectStream, StorageDriver, StorageError,
};
#[cfg(feature = "local")]
pub use local::LocalFileStorage;
#[cfg(feature = "s3")]
pub use s3::S3Storage;
#[cfg(feature = "gcs")]
pub use gcs::GcsStorage;