feat: add 4 new crates (queue, tracing, http, cli) + enhancements to existing crates

New crates:
- mytheclipse-queue: unified job queue with WorkerPool, retry/backoff, DLQ
  Backends: in-memory (default), Redis, NATS, PostgreSQL
- mytheclipse-tracing: tracing subscriber layers with env filter + OTLP/Jaeger export
- mytheclipse-http: HTTP client/server with timeout + tracing, axum server
- mytheclipse-cli: CLI framework with clap derive, built-in subcommands

Enhancements to existing crates:
- mytheclipse-core: SemaphorePool, LeaderElection, HealthRegistry/HealthCheck
- mytheclipse-cache: AutoRefreshCache (bg refresh on miss), CacheMetrics
- mytheclipse-config: ConfigSchema for JSON Schema generation
- mytheclipse-storage: MultipartUploadDriver trait
- mytheclipse-crypto: PASETO v4.local token support

All features compile with --all-features; tests + clippy pass clean.
This commit is contained in:
asepharyana
2026-08-29 16:05:02 +07:00
parent 2596b357ec
commit 8106f8943e
53 changed files with 3588 additions and 44 deletions
+6
View File
@@ -44,6 +44,9 @@ pub mod s3;
#[cfg(feature = "gcs")]
pub mod gcs;
#[cfg(feature = "multipart")]
pub mod multipart;
pub use traits::{
bytes_stream, read_to_vec, ObjectMeta, ObjectStream, StorageDriver, StorageError,
};
@@ -56,3 +59,6 @@ pub use s3::S3Storage;
#[cfg(feature = "gcs")]
pub use gcs::GcsStorage;
#[cfg(feature = "multipart")]
pub use multipart::{MultipartUpload, MultipartUploadDriver, UploadPart};
@@ -0,0 +1,74 @@
//! Multipart upload trait for large-object uploads in parallel parts.
use async_trait::async_trait;
use std::pin::Pin;
use tokio::io::AsyncRead;
use crate::ObjectStream;
/// A single part of a multipart upload.
#[derive(Debug, Clone)]
pub struct UploadPart {
pub part_number: u32,
pub data: Vec<u8>,
}
/// A handle for an in-progress multipart upload.
pub struct MultipartUpload {
upload_id: String,
path: String,
parts: Vec<UploadPart>,
}
impl MultipartUpload {
/// Creates a new multipart upload handle.
pub fn new(upload_id: String, path: String) -> Self {
Self {
upload_id,
path,
parts: Vec::new(),
}
}
/// Adds a part to the upload.
pub fn add_part(&mut self, part_number: u32, data: Vec<u8>) {
self.parts.push(UploadPart { part_number, data });
}
/// Returns the number of parts staged so far.
pub fn part_count(&self) -> usize {
self.parts.len()
}
/// Returns the upload ID.
pub fn upload_id(&self) -> &str {
&self.upload_id
}
/// Returns the destination path.
pub fn path(&self) -> &str {
&self.path
}
}
/// Trait for backends supporting multipart uploads.
#[async_trait]
pub trait MultipartUploadDriver: Send + Sync {
/// Initiates a multipart upload.
async fn init_multipart(&self, path: &str) -> Result<MultipartUpload, String>;
/// Uploads a single part.
async fn upload_part(
&self,
upload_id: &str,
path: &str,
part_number: u32,
data: ObjectStream,
) -> Result<u64, String>;
/// Completes the multipart upload.
async fn complete_multipart(&self, upload_id: &str, path: &str) -> Result<(), String>;
/// Aborts the multipart upload.
async fn abort_multipart(&self, upload_id: &str, path: &str) -> Result<(), String>;
}