15 releases

0.2.6 Feb 9, 2026
0.2.5 Feb 2, 2026
0.2.4 Jan 31, 2026
0.2.1 Dec 27, 2025
0.1.9 Dec 26, 2025

#3 in #s3-compatible

MIT license

275KB
6K SLoC

S3-backed storage for hashtree with non-blocking uploads.

This crate provides an S3 storage backend that:

  • Stores data locally first (fast writes)
  • Syncs to S3 in the background (non-blocking)
  • Falls back to S3 if data not in local cache

Example

use hashtree_s3::{S3Store, S3Config};
use hashtree_core::store::MemoryStore;
use std::sync::Arc;

let local_store = Arc::new(MemoryStore::new());
let config = S3Config {
    bucket: "my-bucket".to_string(),
    prefix: Some("blobs/".to_string()),
    region: None, // Uses AWS_REGION env var
    endpoint: None, // For S3-compatible services
};

let s3_store = S3Store::new(local_store, config).await?;

hashtree-s3

S3 storage backend for hashtree with non-blocking uploads.

Store hashtree blobs in Amazon S3 or compatible object storage (MinIO, R2, etc.).

Usage

use hashtree_s3::S3Store;
use hashtree_core::Store;

let store = S3Store::new(
    "my-bucket",
    "us-east-1",
    Some("https://s3.example.com"),  // Optional custom endpoint
).await?;

// Store a blob
store.put(&hash, &data).await?;

// Retrieve a blob
let data = store.get(&hash).await?;

Features

  • Non-blocking async uploads
  • Compatible with S3-compatible services (MinIO, Cloudflare R2, etc.)
  • Optional feature in hashtree-cli: cargo install hashtree-cli --features s3

Part of hashtree-rs.

Dependencies

~43MB
~589K SLoC