Expand description
§xtax-blob-storage
Experimental blob storage abstraction for Rust with filesystem and S3 backends, streaming uploads, optional encryption, and composable layers.
A compact, builder-driven blob storage abstraction. See the crate-level README for the full rationale and comparisons.
§Status
Experimental / learning project. Not production-ready.
§Architecture
BlobStore trait ← everyone implements this
↑
┌────┴──────────────┐
│ FsBlobStore │ filesystem backend (feature = "fs")
│ S3BlobStore │ S3/Garage backend (feature = "s3")
└────┬──────────────┘
│
┌────┴───────────────────────────────┐
│ PrefixBlobStore │ key prefix manipulation
│ EncryptedBlobStore │ encryption
│ BlobCleanup │ cleanup by predicate
└────┬───────────────────────────────┘
│
BlobStore trait ← still the same trait, fully composable§Quick start
use xtax_blob_storage::{BlobStoreBuilder, BlobInput};
let store = BlobStoreBuilder::new()
.with_fs("/tmp/data")
.with_prefix("my-app/")
.build()
.await?;
use tokio::io::AsyncReadExt;
store.put(vec![BlobInput::new("hello.txt", b"data".as_slice())]).await?;
let mut reader = store.get("hello.txt").await?;
let mut buf = String::new();
reader.read_to_string(&mut buf).await?;
assert_eq!(buf, "data");§AI contribution note
This library was developed with LLM assistance under continuous human supervision.
Re-exports§
pub use validate::validate_blob_key;
Modules§
Structs§
- Background
Cancellation - Read-only cancellation token for background scheduling loops.
- Background
Context - Context provided to a
BackgroundStrategyduringschedule(). - Batch
Error - Batch error — returned when at least one key in a batch operation failed.
- Blob
Cleanup - Layer that provides cleanup functionality over a
BlobStore. - Blob
Input - A single blob to store — key + data stream.
- Blob
Meta - Metadata about a stored blob.
- Blob
Store Builder - Typestate builder for constructing a
BlobStorewith optional layers. - Cleanup
Result - Result of a cleanup operation.
- Encrypted
Blob Store - Transparent encryption layer over a
BlobStore. - KeyError
- A single failed key in a batch operation, with its categorised error.
- Maintenance
Trigger - A handle that can enqueue maintenance tasks.
- Manual
- Strategy that only runs the task when
trigger()is called. - NotFilter
- Inverse of another filter.
- OnStart
- Strategy that runs the task once immediately.
- Periodic
- Strategy that runs the task immediately, then repeats periodically.
- Prefix
Filter - Filter blobs whose key starts with a given prefix.
- PutResult
- Result of a put operation.
- Rekey
Result - Result of a rekey operation.
- Suffix
Filter - Filter blobs whose key ends with a given suffix.
Enums§
- Blob
Storage Error - Blob storage error.
- Encryption
Error - Encryption provider — abstracts the encryption operations needed
by
EncryptedBlobStore. - PerKey
Error - Categorised error for a single key in a batch operation.
Constants§
- KEY_
SEPARATOR - Separator used between key components.
Traits§
- Background
Strategy - Trait for scheduling background maintenance tasks (cleanup, rekey).
- Blob
Store - Generic blob storage abstraction.
- Blob
Visitor - Pluggable visitor for streaming
visit()operations. - Encryption
Provider - Encryption provider — abstracts the encryption operations needed
by
EncryptedBlobStore. - List
Filter - Pluggable filter for
list()operations.
Type Aliases§
- Cleanup
Predicate - Predicate for deciding which blobs to delete during cleanup.
- Encryption
Result - Encryption provider — abstracts the encryption operations needed
by
EncryptedBlobStore. - Result