- Implemented PanicTracker to log panics using tracing within a dedicated span. - Introduced PanicInfo struct to capture panic details. - Added tests for panic catching and hook restoration. feat: implement token-bucket rate limiter - Created RateLimiter to manage token consumption with configurable rates and burst capacity. - Added methods for acquiring tokens and checking available tokens. - Included tests for rate limiting behavior and token availability. feat: add automatic retry with exponential backoff - Developed retry function to handle transient errors with configurable retry strategies. - Introduced RetryConfig for customizing retry behavior and jitter. - Added tests for various retry scenarios and error handling. feat: implement graceful shutdown coordination - Created ShutdownManager to manage shutdown signals and task completion. - Introduced ShutdownSignal for tasks to observe shutdown requests. - Added tests for shutdown request handling and task draining. feat: add timeout functionality for async operations - Implemented with_timeout function to enforce execution time limits on futures. - Created Timeout struct for wrapping futures with a deadline. - Added tests for timeout behavior and error mapping.
65 lines
3.1 KiB
Markdown
65 lines
3.1 KiB
Markdown
# mytheclipse
|
|
|
|
A personal collection of Rust abstractions for building resource-aware,
|
|
resilient, and well-instrumented applications without hand-rolling the same
|
|
plumbing every time — organized as a Cargo workspace, one focused crate per
|
|
concern.
|
|
|
|
[](crates/mytheclipse/LICENSE-MIT)
|
|
|
|
## Crates
|
|
|
|
| Crate | Description | Docs |
|
|
| :--- | :--- | :--- |
|
|
| [`mytheclipse`](crates/mytheclipse) | Resource-aware execution primitives (async I/O, compute, background queues), resiliency (retry, circuit breaker, timeout), traffic control (rate limiter, backpressure, concurrency limiter), lifecycle (graceful shutdown, cron), and observability (metrics, panic tracking). | [README](crates/mytheclipse/README.md) |
|
|
| [`corex-cache`](crates/corex-cache) | Unified multi-layer (L1/L2) cache abstraction: in-memory or Moka L1, Redis/Valkey L2, cache-aside read-through. | [README](crates/corex-cache/README.md) |
|
|
| [`corex-storage`](crates/corex-storage) | Unified storage & file system abstraction: one driver interface over local disk, S3/MinIO, and Google Cloud Storage, stream-based. | [README](crates/corex-storage/README.md) |
|
|
| [`corex-event`](crates/corex-event) | Unified events & message bus abstraction: in-memory pub/sub dispatcher plus RabbitMQ and NATS broker adapters behind one trait. | [README](crates/corex-event/README.md) |
|
|
| [`corex-config`](crates/corex-config) | Type-safe, dynamic configuration engine: load `.env`/YAML/JSON/TOML into typed structs, with hot-reload. | [README](crates/corex-config/README.md) |
|
|
| [`corex-crypto`](crates/corex-crypto) | Safe hashing (Argon2id), encryption (AES-256-GCM), and JWT tokens, with key rotation support. | [README](crates/corex-crypto/README.md) |
|
|
|
|
Every crate follows the same philosophy: **one small interface, pluggable
|
|
backends behind feature flags, and a working default that needs no external
|
|
service to build or test.** Distributed backends (Redis, S3, GCS, RabbitMQ,
|
|
NATS) are feature-gated and their integration tests are `#[ignore]`d unless
|
|
the corresponding environment variables point at a live service.
|
|
|
|
## Getting started
|
|
|
|
Each crate is published independently; add the ones you need:
|
|
|
|
```toml
|
|
[dependencies]
|
|
mytheclipse = { version = "1", features = ["full"] }
|
|
corex-cache = "0.1"
|
|
corex-storage = { version = "0.1", features = ["s3"] }
|
|
corex-event = { version = "0.1", features = ["nats"] }
|
|
corex-config = "0.1"
|
|
corex-crypto = "0.1"
|
|
```
|
|
|
|
See each crate's own README (linked above) for usage examples and the full
|
|
feature-flag list.
|
|
|
|
## Development
|
|
|
|
This is a Cargo workspace; run commands from the repository root:
|
|
|
|
```bash
|
|
cargo build --workspace --all-features
|
|
cargo test --workspace --all-features
|
|
cargo clippy --workspace --all-features -- -D warnings
|
|
cargo fmt --all --check
|
|
```
|
|
|
|
Or target a single crate with `-p <name>`, e.g. `cargo test -p corex-cache`.
|
|
|
|
## License
|
|
|
|
Licensed under either of:
|
|
|
|
- Apache License, Version 2.0 ([LICENSE-APACHE](crates/mytheclipse/LICENSE-APACHE) or <http://www.apache.org/licenses/LICENSE-2.0>)
|
|
- MIT license ([LICENSE-MIT](crates/mytheclipse/LICENSE-MIT) or <http://opensource.org/licenses/MIT>)
|
|
|
|
at your option.
|