Milestone 2: persistent blob store, add/materialize/gc

iroh-blobs 0.35 fs store under <store_dir>/blobs. Add imports files or
whole directory trees (as Collections, deterministic order), Materialize
exports them with a real FICLONE reflink attempt and streaming-copy
fallback, Gc is an explicit mark-and-sweep rooted at the pins. Pins,
trusted peers and hash formats persist in meta.json (atomic writes).
Store reads run on a LocalPool because iroh-blobs entry readers are not
Send. Integration tests drive the real daemon binary: directory round
trip byte-identical, gc keeps pinned/drops unpinned, reflink verified on
the repo's own filesystem (XFS), plus a 32-case proptest round trip.

Dependencies: iroh-blobs =0.35.0 (the store itself; pinned per spec),
iroh-io (AsyncSliceReader traits to read store entries), reflink-copy
(FICLONE with copy fallback, per spec), proptest (dev-only, round-trip
property test).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-14 20:47:11 +02:00
parent 4e1a95613b
commit e256f73439
12 changed files with 5816 additions and 50 deletions
+8 -7
View File
@@ -5,19 +5,20 @@
pub mod config;
pub mod daemon;
pub mod meta;
pub mod server;
pub mod store;
use std::sync::Arc;
use anyhow::{Context, Result};
use anyhow::Result;
/// Run a daemon with the given config until the future is dropped or the
/// listener fails. Binds the socket before returning control to the
/// runtime so callers can rely on it existing once this future is polled.
/// listener fails. The socket is bound before the accept loop starts, so
/// once this future has been polled the socket path exists.
pub async fn run(config: config::Config) -> Result<()> {
std::fs::create_dir_all(&config.store_dir)
.with_context(|| format!("creating store directory {}", config.store_dir.display()))?;
let listener = server::bind_socket(&config.socket_path)?;
let daemon = Arc::new(daemon::Daemon::new(config));
let socket_path = config.socket_path.clone();
let daemon = Arc::new(daemon::Daemon::open(config).await?);
let listener = server::bind_socket(&socket_path)?;
server::serve(listener, daemon).await
}