feat: add corex-storage crate for unified storage abstraction

- Introduced corex-storage crate with support for local disk, S3-compatible, and Google Cloud Storage backends.
- Implemented StorageDriver trait for various storage backends.
- Added LocalFileStorage for local disk operations.
- Added S3Storage for S3-compatible object storage with multipart upload support.
- Added GcsStorage for Google Cloud Storage operations.
- Included error handling for storage operations.
- Added tests for each storage backend to ensure functionality.
- Created README.md for documentation and usage examples.
- Added Apache and MIT licenses for open-source compliance.
This commit is contained in:
asepharyana
2026-08-28 22:24:18 +07:00
parent 6a4b2b8f54
commit db4f277336
47 changed files with 0 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
# corex-event
A unified events & message bus abstraction so component-to-component (or
service-to-service) communication isn't locked to one transport.
- **In-memory dispatcher** (default) — `tokio::sync::broadcast`-backed
pub/sub for communication inside a single process (monolith).
- **Distributed broker backends** — RabbitMQ (`amqp`) and NATS (`nats`)
behind the same `EventBus` trait, so swapping the backend doesn't change
handler code.
- **Typed convenience** — `TypedEventBus` layers JSON encoding on top.
## Features
- `mem` (default) — in-memory dispatcher.
- `amqp` — RabbitMQ via `lapin` (pure Rust AMQP 0.9.1 client).
- `nats` — NATS via `async-nats`.
## Usage
```rust
use corex_event::{InMemoryEventBus, TypedEventBus};
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct OrderCreated { id: u64 }
let bus = TypedEventBus::new(InMemoryEventBus::default());
let mut sub = bus.subscribe::<OrderCreated>("orders").await?;
bus.publish("orders", &OrderCreated { id: 42 }).await?;
let event = sub.recv().await?;
```
Swap `InMemoryEventBus::default()` for `AmqpEventBus::connect(url, "exchange").await?`
or `NatsEventBus::connect(url).await?` to move to a distributed broker without
touching handler code.