ad69f7d884
The 0.35 pin's rationale ("the post-0.35 rewrite is not yet production
quality") expired when iroh hit 1.0 in June 2026: the rewrite line
(0.103) is now the production line and the only one receiving fixes.
The rewrite replaced wrappable store traits with an irpc-based API, so
the seams moved:
- shaped.rs: the 440-line ShapedStore trait wrapper becomes a provider
event handler. Trust gating (untrusted peers see only openly-served
hashes) now intercepts requests before any bytes move; upload rate
limiting rides the provider's Throttle hook; upload progress events
come from per-request update streams. The TokenBucket is unchanged.
- store.rs: FsStore's API handle replaces the store traits, and the
LocalPool machinery for non-Send futures is gone. GC is now the
store's built-in periodic mark-and-sweep, fed by a pin-roots snapshot
via the protect callback (new config knob gc_interval_secs, default
300); the on-demand Gc request answers Unimplemented, and the gc
conformance test polls the sweep instead.
- transfer.rs: BlobsProtocol + Router replace handle_connection, the
new multi-provider Downloader replaces the old queue, and mdns
discovery moved to the iroh-mdns-address-lookup crate (it left iroh
core in 1.0). Ticket-embedded provider addresses feed a MemoryLookup
address book. Endpoint presets: Minimal (LAN-only default) or N0
(wan_upload), preserving the old relay posture.
- Node* became Endpoint* throughout; announcement signatures use iroh's
own Signature type (ed25519-dalek dep dropped); iroh-io dropped.
Known regression: max_download_bytes_per_sec is currently not enforced
— download shaping rode the old store's batch writer and 0.103's
downloader has no equivalent seam yet.
Announcement wire format note: EndpointAddr serializes differently than
NodeAddr, so pre- and post-migration daemons won't parse each other's
LAN announcements. Announcements are live-only, nothing stored breaks.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
63 lines
2.1 KiB
Rust
63 lines
2.1 KiB
Rust
//! Milestone 1: `varde-ctl status` round-trips against a real daemon.
|
|
|
|
use std::process::Command;
|
|
use std::time::Duration;
|
|
|
|
use varde_daemon::config::Config;
|
|
|
|
/// Start an in-process daemon on an ephemeral socket, then run the real
|
|
/// varde-ctl binary against it.
|
|
#[test]
|
|
fn ctl_status_round_trips() {
|
|
let dir = tempfile::tempdir().expect("tempdir");
|
|
let socket_path = dir.path().join("varde.sock");
|
|
let config = Config {
|
|
store_dir: dir.path().join("store"),
|
|
socket_path: socket_path.clone(),
|
|
max_upload_bytes_per_sec: 0,
|
|
max_download_bytes_per_sec: 0,
|
|
discovery: false,
|
|
wan_upload: false,
|
|
gc_interval_secs: 300,
|
|
};
|
|
|
|
let rt = tokio::runtime::Builder::new_multi_thread()
|
|
.worker_threads(2)
|
|
.enable_all()
|
|
.build()
|
|
.expect("tokio runtime");
|
|
let _daemon = rt.spawn(varde_daemon::run(config));
|
|
|
|
// run() binds the socket synchronously at first poll; give it a beat.
|
|
let deadline = std::time::Instant::now() + Duration::from_secs(10);
|
|
while !socket_path.exists() && std::time::Instant::now() < deadline {
|
|
std::thread::sleep(Duration::from_millis(20));
|
|
}
|
|
|
|
let output = Command::new(env!("CARGO_BIN_EXE_varde-ctl"))
|
|
.args(["--socket", socket_path.to_str().unwrap(), "status"])
|
|
.output()
|
|
.expect("running varde-ctl");
|
|
let stdout = String::from_utf8_lossy(&output.stdout);
|
|
let stderr = String::from_utf8_lossy(&output.stderr);
|
|
assert!(output.status.success(), "varde-ctl failed: {stderr}");
|
|
assert!(
|
|
stdout.contains("varde-daemon"),
|
|
"unexpected output: {stdout}"
|
|
);
|
|
|
|
let output = Command::new(env!("CARGO_BIN_EXE_varde-ctl"))
|
|
.args([
|
|
"--socket",
|
|
socket_path.to_str().unwrap(),
|
|
"--json",
|
|
"status",
|
|
])
|
|
.output()
|
|
.expect("running varde-ctl --json");
|
|
assert!(output.status.success());
|
|
let json: serde_json::Value =
|
|
serde_json::from_slice(&output.stdout).expect("--json output is JSON");
|
|
assert_eq!(json["ok"], true);
|
|
}
|