[deps] remove iroh-car, axum-tws, fluent-uri, and nohash-hasher
89 unmodified lines9091929394959697989994959697132 unmodified linesExpand all230231232233240241242243244245246247248249250251252253254255256257234235236237273 unmodified linesExpand all51151251351453951551651751851934 unmodified lines554555556557582558559560561562793 unmodified linesExpand all135613571358135913841360136113621363136412 unmodified lines137713781379138014051381138213831384138518 unmodified lines140414051406140714321408140914101411141263 unmodified lines1476147714781479150414801481148214831484148515111486148714881489149014911492149315201494149514961497149814991500152815011502150315041 unmodified line15061507150815091538151015111512151315141515151615171518154715191520152115221523273 unmodified linesExpand all17971798179918001829183018311832183318341835183618371838183918401841184218431844180118021803180445 unmodified lines185018511852185318981854185518561857185819031859186018611862186310 unmodified lines1874187518761877192218781879188018811882313 unmodified linesExpand all219621972198219922442200220122022203220428 unmodified lines22332234223522362281228222832284228522862237223822392240300 unmodified linesExpand all254125422543254425952545254625472548254913 unmodified lines2563256425652566261725672568256925702571510 unmodified linesExpand all30823083308430853136313731383139314031413142314331443145314631473148308630873088308975 unmodified lines31653166316731683232323332343235323632373169317031713172254 unmodified linesExpand all342734283429343035003431343234333434343519 unmodified lines34553456345734583528352935303531353235333534353535363459346034613462354134633464346534663467354635473548354935503551355235533554355535563468346934703471132 unmodified linesExpand all360436053606360736973608360936103611173 unmodified linesExpand all37853786378737883879388038813882388338843789379037913792602 unmodified linesExpand all89 unmodified linessource = "registry+https://github.com/rust-lang/crates.io-index"checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000"
[[package]]name = "anyhow"version = "1.0.102"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"
[[package]]name = "arc-swap"version = "1.9.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "6a3a1fd6f75306b68087b831f025c712524bcb19aad54e557b1129cfa0a2b207"132 unmodified linesExpand all "syn",]
[[package]]name = "axum-tws"version = "0.6.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "08bf5c1e7d60af9632c55c23bbfa208d0fe08aa59fcda87216c9119e30a9d6d4"dependencies = [ "axum-core", "base64 0.22.1", "bytes", "futures-util", "http", "hyper", "hyper-util", "sha1_smol", "tokio", "tokio-websockets",]
[[package]]name = "backtrace"version = "0.3.76"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6"273 unmodified linesExpand all "multihash", "no_std_io2", "serde", "serde_bytes", "unsigned-varint 0.8.0", "unsigned-varint",]
[[package]]name = "clap"34 unmodified linesversion = "0.3.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1"dependencies = [ "thiserror 2.0.18", "thiserror",]
[[package]]name = "combine"793 unmodified linesExpand all "idna", "ipnet", "jni", "rand 0.10.1", "thiserror 2.0.18", "thiserror", "tinyvec", "tokio", "tracing", "url",12 unmodified lines "once_cell", "prefix-trie", "rand 0.10.1", "ring", "thiserror 2.0.18", "thiserror", "tinyvec", "tracing", "url",]18 unmodified lines "rand 0.10.1", "resolv-conf", "smallvec", "system-configuration", "thiserror 2.0.18", "thiserror", "tokio", "tracing",]
63 unmodified linesdependencies = [ "ahash", "arc-swap", "axum", "axum-tws", "bytes", "chrono", "cid", "criterion", "data-encoding", "fjall", "fluent-uri", "futures", "glob", "hex", "hickory-resolver", "http", "humantime", "hyper", "ipnet", "iroh-car", "jacquard-common", "k256", "libc", "lsm-tree", "miette", "mimalloc", "multibase", "nohash-hasher", "p256", "parking_lot", "rand 0.10.1", "reqwest",1 unmodified line "rustls", "scc", "serde", "serde_bytes", "serde_html_form 0.3.2", "serde_html_form", "serde_ipld_dagcbor 0.6.4", "serde_json", "sha2", "smol_str", "snmalloc-rs", "socket2", "syn", "tempfile", "thiserror 2.0.18", "thiserror", "tikv-jemallocator", "tokio", "tokio-util", "tokio-websockets",273 unmodified linesExpand all "serde",]
[[package]]name = "iroh-car"version = "0.5.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "cb7f8cd4cb9aa083fba8b52e921764252d0b4dcb1cd6d120b809dbfe1106e81a"dependencies = [ "anyhow", "cid", "futures", "serde", "serde_ipld_dagcbor 0.6.4", "thiserror 1.0.69", "tokio", "unsigned-varint 0.7.2",]
[[package]]name = "is_ci"version = "1.2.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45"45 unmodified lines "regex-lite", "rustversion", "serde", "serde_bytes", "serde_html_form 0.4.1", "serde_html_form", "serde_ipld_dagcbor 0.7.0", "serde_json", "smol_str", "spin 0.12.3", "thiserror 2.0.18", "thiserror", "tokio", "tokio-util", "trait-variant", "unicode-segmentation",10 unmodified lines "jni-macros", "jni-sys", "log", "simd_cesu8", "thiserror 2.0.18", "thiserror", "walkdir", "windows-link",]
313 unmodified linesExpand allchecksum = "89ace881e3f514092ce9efbcb8f413d0ad9763860b828981c2de51ddc666936c"dependencies = [ "no_std_io2", "serde", "unsigned-varint 0.8.0", "unsigned-varint",]
[[package]]name = "multiversion_no_op"28 unmodified lines "memchr",]
[[package]]name = "nohash-hasher"version = "0.2.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451"
[[package]]name = "nu-ansi-term"version = "0.50.3"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"300 unmodified linesExpand all "quinn-udp", "rustc-hash", "rustls", "socket2", "thiserror 2.0.18", "thiserror", "tokio", "tracing", "web-time",]13 unmodified lines "rustc-hash", "rustls", "rustls-pki-types", "slab", "thiserror 2.0.18", "thiserror", "tinyvec", "tracing", "web-time",]510 unmodified linesExpand all]
[[package]]name = "serde_html_form"version = "0.3.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "2acf96b1d9364968fce46ebb548f1c0e1d7eceae27bdff73865d42e6c7369d94"dependencies = [ "form_urlencoded", "indexmap", "itoa", "ryu", "serde_core",]
[[package]]name = "serde_html_form"version = "0.4.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "8f0346d7a342ab90f405cfc08f25d15075f944f42fcabbc5eac923829fa6d228"dependencies = [75 unmodified lines "xxhash-rust",]
[[package]]name = "sha1_smol"version = "1.0.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d"
[[package]]name = "sha2"version = "0.10.9"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"254 unmodified linesExpand allsource = "registry+https://github.com/rust-lang/crates.io-index"checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"dependencies = [ "fastrand", "getrandom 0.3.4", "getrandom 0.4.3", "once_cell", "rustix", "windows-sys 0.61.2",]19 unmodified lines]
[[package]]name = "thiserror"version = "1.0.69"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"dependencies = [ "thiserror-impl 1.0.69",]
[[package]]name = "thiserror"version = "2.0.18"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4"dependencies = [ "thiserror-impl 2.0.18", "thiserror-impl",]
[[package]]name = "thiserror-impl"version = "1.0.69"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"dependencies = [ "proc-macro2", "quote", "syn",]
[[package]]name = "thiserror-impl"version = "2.0.18"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5"dependencies = [132 unmodified linesExpand all "httparse", "rand 0.10.1", "rustls-native-certs", "rustls-pki-types", "sha1_smol", "simdutf8", "tokio", "tokio-rustls", "tokio-util",173 unmodified linesExpand allchecksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254"
[[package]]name = "unsigned-varint"version = "0.7.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "6889a77d49f1f013504cec6bf97a2c730394adedaeb1deb5ea08949a50541105"
[[package]]name = "unsigned-varint"version = "0.8.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "eb066959b24b5196ae73cb057f45598450d2c5f71460e98c49b738086eff9c06"
602 unmodified linesExpand all35 unmodified lines36373839404140414243445 unmodified lines5051525355545556575 unmodified lines636465666967686970717572737475767778827980818237 unmodified lines35 unmodified lines
fjall = { git = "https://github.com/90-008/fjall.git", rev = "67604fb3f7454b9e9e4ec9501a5f555c611a8a19", features = ["lz4", "zstd"], version = "3.1.2" }lsm-tree = { git = "https://github.com/90-008/lsm-tree.git", features = ["lz4", "zstd"] }serde_ipld_dagcbor = "0.6"serde_html_form = "0.3"fluent-uri = "0.4.1"serde_html_form = "0.4"zstd = { version = "0.13", optional = true }
bytes = { version = "1.11.1", features = ["serde"] }url = { version = "2.5", features = ["serde"] }5 unmodified lines "gzip", "brotli", "deflate", "zstd",] }axum = { version = "0.8.8", features = ["macros"] }tower-http = { version = "0.6.6", features = ["cors", "trace"] }axum-tws = "0.6.0"
jacquard-common = { git = "https://tangled.org/nonbinary.computer/jacquard", rev = "9046f2822f4685217300c4a03551b4484fcbc31d", default-features = false, features = ["std", "crypto"] }hickory-resolver = { version = "0.26.2", features = ["system-config", "tokio"], default-features = false }chrono = { version = "0.4.43", features = ["serde"] }5 unmodified lineshex = "0.4"scc = "3.6.6"data-encoding = "2.10.0"cid = "0.11.1"iroh-car = "0.5.1"thiserror = "2.0.18"rand = "0.10.0"glob = "0.3"arc-swap = "1.8.2"rustls = { version = "0.23", features = ["aws-lc-rs"] }tokio-websockets = { version = "0.13.2", features = ["client", "server", "rustls-native-roots", "aws_lc_rs", "rand"] }tokio-websockets = { version = "0.13.2", default-features = false, features = ["client", "server", "rustls-native-roots", "aws_lc_rs", "rand"] }multibase = "0.9.2"# asm gates the armv8 sha2 instructions; without it aarch64 hashes in softwaresha2 = { version = "0.10.9", features = ["asm"] }parking_lot = { version = "0.12.5", features = ["arc_lock"] }hyper = "1.8.1"http = "1"nohash-hasher = "0.2.0"ahash = "0.8.12"# statvfs for the free-disk check before a backfill spills, already in the tree through tokiolibc = "0.2"k256 = { version = "0.13", features = ["ecdsa"] }37 unmodified lines314 unmodified linesExpand all315316317318319319320321322323251 unmodified linesExpand all314 unmodified linesExpand all }}
fn write_car<'a>(root: IpldCid, sections: impl Iterator<Item = (IpldCid, &'a Bytes)>) -> Bytes { let header = iroh_car::CarHeader::new_v1(vec![root]) let header = car::CarHeader::new_v1(vec![root]) .encode() .expect("header encodes"); let mut out = Vec::new(); put_uvarint(&mut out, header.len());251 unmodified linesExpand all213 unmodified linesExpand all214215216217218218219220221222286 unmodified linesExpand all213 unmodified linesExpand all }}
fn write_car<'a>(root: IpldCid, sections: impl Iterator<Item = (IpldCid, &'a Bytes)>) -> Bytes { let header = iroh_car::CarHeader::new_v1(vec![root]) let header = car::CarHeader::new_v1(vec![root]) .encode() .expect("header encodes"); let mut out = Vec::new(); put_uvarint(&mut out, header.len());286 unmodified linesExpand all252 unmodified linesExpand all253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332258333334335336337260338339340341342233 unmodified linesExpand all5765775785795025035805815825835845854 unmodified lines5905915925935165175945955965975985999 unmodified lines60961061161253553661361461561661761812 unmodified lines631632633634557558635636637638639140 unmodified linesExpand all780781782783707708784785786787788183 unmodified linesExpand all252 unmodified linesExpand all blocks_start, ))}
#[derive(serde::Serialize, serde::Deserialize)]pub(crate) struct CarHeader { roots: Vec<IpldCid>, version: u64,}
impl CarHeader { #[cfg_attr(not(feature = "indexer"), allow(dead_code))] pub(crate) fn new_v1(roots: Vec<IpldCid>) -> Self { Self { roots, version: 1 } }
#[cfg_attr(not(feature = "indexer"), allow(dead_code))] pub(crate) fn encode(&self) -> std::io::Result<Vec<u8>> { serde_ipld_dagcbor::to_vec(self).map_err(std::io::Error::other) }}
#[cfg_attr(not(feature = "indexer"), allow(dead_code))]pub(crate) struct CarWriter<W> { header: Option<CarHeader>, writer: W, cid_buf: Vec<u8>,}
#[cfg_attr(not(feature = "indexer"), allow(dead_code))]impl<W: tokio::io::AsyncWrite + Unpin> CarWriter<W> { pub(crate) fn new(header: CarHeader, writer: W) -> Self { Self { header: Some(header), writer, cid_buf: Vec::new(), } }
pub(crate) async fn write(&mut self, cid: IpldCid, data: impl AsRef<[u8]>) -> std::io::Result<()> { use tokio::io::AsyncWriteExt as _; if let Some(header) = self.header.take() { let header_bytes = header.encode()?; let mut varint = [0u8; 10]; let n = encode_uvarint(header_bytes.len(), &mut varint); self.writer.write_all(&varint[..n]).await?; self.writer.write_all(&header_bytes).await?; } self.cid_buf.clear(); cid.write_bytes(&mut self.cid_buf) .map_err(std::io::Error::other)?; let data = data.as_ref(); let mut varint = [0u8; 10]; let n = encode_uvarint(self.cid_buf.len() + data.len(), &mut varint); self.writer.write_all(&varint[..n]).await?; self.writer.write_all(&self.cid_buf).await?; self.writer.write_all(data).await?; Ok(()) }
pub(crate) async fn finish(mut self) -> std::io::Result<W> { use tokio::io::AsyncWriteExt as _; self.writer.flush().await?; Ok(self.writer) }}
#[cfg_attr(not(feature = "indexer"), allow(dead_code))]fn encode_uvarint(mut value: usize, buf: &mut [u8; 10]) -> usize { let mut i = 0; while value >= 0x80 { buf[i] = (value as u8) | 0x80; value >>= 7; i += 1; } buf[i] = value as u8; i + 1}
fn header_root(header: &[u8]) -> Result<IpldCid> { let header = iroh_car::CarHeader::decode(header).into_diagnostic()?; let header: CarHeader = serde_ipld_dagcbor::from_slice(header).into_diagnostic()?; if header.version != 1 { miette::bail!("Only CAR file version 1 is supported"); } header .roots() .roots .first() .copied() .ok_or_else(|| miette::miette!("CAR file has no roots"))}233 unmodified linesExpand all #[tokio::test] async fn parses_rootless_block_car() { let cid = cid(1); let mut buf = Vec::new(); let header = iroh_car::CarHeader::new_v1(Vec::new()); let mut writer = iroh_car::CarWriter::new(header, &mut buf); let header = CarHeader::new_v1(Vec::new()); let mut writer = CarWriter::new(header, &mut buf); writer.write(cid, b"block".to_vec()).await.unwrap(); writer.finish().await.unwrap();
let blocks = parse_car_blocks(buf.into(), false).unwrap();4 unmodified lines async fn parses_rooted_car_with_zero_copy_payloads() { let root = cid(1); let block = cid(2); let mut buf = Vec::new(); let header = iroh_car::CarHeader::new_v1(vec![root]); let mut writer = iroh_car::CarWriter::new(header, &mut buf); let header = CarHeader::new_v1(vec![root]); let mut writer = CarWriter::new(header, &mut buf); writer.write(block, b"record".to_vec()).await.unwrap(); writer.finish().await.unwrap();
let data = Bytes::from(buf);9 unmodified lines }
async fn car_with_blocks(blocks: &[(IpldCid, &[u8])]) -> Bytes { let mut buf = Vec::new(); let header = iroh_car::CarHeader::new_v1(vec![blocks[0].0]); let mut writer = iroh_car::CarWriter::new(header, &mut buf); let header = CarHeader::new_v1(vec![blocks[0].0]); let mut writer = CarWriter::new(header, &mut buf); for (cid, bytes) in blocks { writer.write(*cid, bytes.to_vec()).await.unwrap(); } writer.finish().await.unwrap();12 unmodified lines .map(|bytes| (compute_cid(&bytes), bytes)) .collect::<Vec<_>>(); let root = blocks[0].0; let mut buf = Vec::new(); let mut writer = iroh_car::CarWriter::new(iroh_car::CarHeader::new_v1(vec![root]), &mut buf); let mut writer = CarWriter::new(CarHeader::new_v1(vec![root]), &mut buf); for (cid, bytes) in &blocks { writer.write(*cid, bytes).await.unwrap(); } writer.finish().await.unwrap();140 unmodified linesExpand all
#[tokio::test] async fn stream_rejects_a_rootless_car() { let mut buf = Vec::new(); let mut writer = iroh_car::CarWriter::new(iroh_car::CarHeader::new_v1(Vec::new()), &mut buf); let mut writer = CarWriter::new(CarHeader::new_v1(Vec::new()), &mut buf); writer.write(cid(1), b"block".to_vec()).await.unwrap(); writer.finish().await.unwrap();
let streamed = stream_in_chunks(&buf, 4, false).unwrap_err();183 unmodified linesExpand all