diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2022-11-06 21:44:13 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2022-11-06 21:44:14 -0800 |
commit | 6111c481fac3d5c305a379b3be8afb87190db3d5 (patch) | |
tree | 4232ed843813cd9661ab16e25ccb7a05611fb2a2 | |
parent | 40cb22e75314f73b1f9292190b786ac04fc58b67 (diff) | |
download | adenosine-6111c481fac3d5c305a379b3be8afb87190db3d5.tar.gz adenosine-6111c481fac3d5c305a379b3be8afb87190db3d5.zip |
iroh-car: move vendoring into sub-module of pds crate
So we don't need to re-publish this as a separate crate.
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | adenosine-pds/src/vendored/iroh_car/README.md (renamed from iroh-car/README.md) | 0 | ||||
-rw-r--r-- | adenosine-pds/src/vendored/iroh_car/error.rs (renamed from iroh-car/src/error.rs) | 0 | ||||
-rw-r--r-- | adenosine-pds/src/vendored/iroh_car/header.rs (renamed from iroh-car/src/header.rs) | 0 | ||||
-rw-r--r-- | adenosine-pds/src/vendored/iroh_car/lib.rs (renamed from iroh-car/src/lib.rs) | 0 | ||||
-rw-r--r-- | adenosine-pds/src/vendored/iroh_car/reader.rs (renamed from iroh-car/src/reader.rs) | 0 | ||||
-rw-r--r-- | adenosine-pds/src/vendored/iroh_car/util.rs (renamed from iroh-car/src/util.rs) | 0 | ||||
-rw-r--r-- | adenosine-pds/src/vendored/iroh_car/writer.rs (renamed from iroh-car/src/writer.rs) | 0 | ||||
-rw-r--r-- | iroh-car/Cargo.toml | 23 | ||||
-rw-r--r-- | iroh-car/tests/car_file_test.rs | 74 | ||||
-rw-r--r-- | iroh-car/tests/carv1_basic.car | bin | 715 -> 0 bytes | |||
-rw-r--r-- | iroh-car/tests/testv1.car | bin | 5090 -> 0 bytes |
12 files changed, 1 insertions, 98 deletions
@@ -1,5 +1,5 @@ [workspace] -members = ["adenosine-cli", "adenosine-pds", "iroh-car"] +members = ["adenosine-cli", "adenosine-pds"] # NOTE: [workspace.package] did not work with some plugins and build tools diff --git a/iroh-car/README.md b/adenosine-pds/src/vendored/iroh_car/README.md index 0cad81b..0cad81b 100644 --- a/iroh-car/README.md +++ b/adenosine-pds/src/vendored/iroh_car/README.md diff --git a/iroh-car/src/error.rs b/adenosine-pds/src/vendored/iroh_car/error.rs index 3579413..3579413 100644 --- a/iroh-car/src/error.rs +++ b/adenosine-pds/src/vendored/iroh_car/error.rs diff --git a/iroh-car/src/header.rs b/adenosine-pds/src/vendored/iroh_car/header.rs index c004e35..c004e35 100644 --- a/iroh-car/src/header.rs +++ b/adenosine-pds/src/vendored/iroh_car/header.rs diff --git a/iroh-car/src/lib.rs b/adenosine-pds/src/vendored/iroh_car/lib.rs index d4e5f66..d4e5f66 100644 --- a/iroh-car/src/lib.rs +++ b/adenosine-pds/src/vendored/iroh_car/lib.rs diff --git a/iroh-car/src/reader.rs b/adenosine-pds/src/vendored/iroh_car/reader.rs index c0209be..c0209be 100644 --- a/iroh-car/src/reader.rs +++ b/adenosine-pds/src/vendored/iroh_car/reader.rs diff --git a/iroh-car/src/util.rs b/adenosine-pds/src/vendored/iroh_car/util.rs index 25be761..25be761 100644 --- a/iroh-car/src/util.rs +++ b/adenosine-pds/src/vendored/iroh_car/util.rs diff --git a/iroh-car/src/writer.rs b/adenosine-pds/src/vendored/iroh_car/writer.rs index 9f17eb9..9f17eb9 100644 --- a/iroh-car/src/writer.rs +++ b/adenosine-pds/src/vendored/iroh_car/writer.rs diff --git a/iroh-car/Cargo.toml b/iroh-car/Cargo.toml deleted file mode 100644 index 64fc6f0..0000000 --- a/iroh-car/Cargo.toml +++ /dev/null @@ -1,23 +0,0 @@ -[package] -name = "iroh-car" -version = "0.1.0-vendored.0" -edition = "2021" -authors = ["Friedel Ziegelmayer <me@dignifiedquire.com>"] -license = "Apache-2.0/MIT" -repository = "https://github.com/n0-computer/iroh" -description = "Implementation the car files for iroh" - -[dependencies] -cid = "*" -ipld = { package = "libipld", version = "0.14"} -ipld-cbor = { package = "libipld-cbor", version = "0.14" } -thiserror = "1.0" -futures = "0.3" -integer-encoding = { version = "3", features = ["tokio_async"] } -multihash = "0.16" -tokio = { version = "1", features = ["io-util"] } - -[dev-dependencies] -tokio = { version = "1", features = ["macros", "sync", "rt", "fs", "io-util"] } - -[features] diff --git a/iroh-car/tests/car_file_test.rs b/iroh-car/tests/car_file_test.rs deleted file mode 100644 index 28340d4..0000000 --- a/iroh-car/tests/car_file_test.rs +++ /dev/null @@ -1,74 +0,0 @@ -use futures::TryStreamExt; -use iroh_car::*; -use tokio::fs::{self, File}; -use tokio::io::BufReader; - -#[tokio::test] -async fn roundtrip_carv1_test_file() { - let file = File::open("tests/testv1.car").await.unwrap(); - let buf_reader = BufReader::new(file); - - let car_reader = CarReader::new(buf_reader).await.unwrap(); - let header = car_reader.header().clone(); - let files: Vec<_> = car_reader.stream().try_collect().await.unwrap(); - assert_eq!(files.len(), 35); - - let mut buffer = Vec::new(); - let mut writer = CarWriter::new(header, &mut buffer); - for (cid, data) in &files { - writer.write(*cid, data).await.unwrap(); - } - writer.finish().await.unwrap(); - - let file = fs::read("tests/testv1.car").await.unwrap(); - assert_eq!(file, buffer); -} - -#[tokio::test] -async fn roundtrip_carv1_basic_fixtures_file() { - let file = File::open("tests/carv1_basic.car").await.unwrap(); - let buf_reader = BufReader::new(file); - - let car_reader = CarReader::new(buf_reader).await.unwrap(); - let header = car_reader.header().clone(); - - assert_eq!( - car_reader.header().roots(), - [ - "bafyreihyrpefhacm6kkp4ql6j6udakdit7g3dmkzfriqfykhjw6cad5lrm" - .parse() - .unwrap(), - "bafyreidj5idub6mapiupjwjsyyxhyhedxycv4vihfsicm2vt46o7morwlm" - .parse() - .unwrap() - ] - ); - - let files: Vec<_> = car_reader.stream().try_collect().await.unwrap(); - assert_eq!(files.len(), 8); - - let cids = [ - "bafyreihyrpefhacm6kkp4ql6j6udakdit7g3dmkzfriqfykhjw6cad5lrm", - "QmNX6Tffavsya4xgBi2VJQnSuqy9GsxongxZZ9uZBqp16d", - "bafkreifw7plhl6mofk6sfvhnfh64qmkq73oeqwl6sloru6rehaoujituke", - "QmWXZxVQ9yZfhQxLD35eDR8LiMRsYtHxYqTFCBbJoiJVys", - "bafkreiebzrnroamgos2adnbpgw5apo3z4iishhbdx77gldnbk57d4zdio4", - "QmdwjhxpxzcMsR3qUuj7vUL8pbA7MgR3GAxWi2GLHjsKCT", - "bafkreidbxzk2ryxwwtqxem4l3xyyjvw35yu4tcct4cqeqxwo47zhxgxqwq", - "bafyreidj5idub6mapiupjwjsyyxhyhedxycv4vihfsicm2vt46o7morwlm", - ]; - - for (expected_cid, (cid, _)) in cids.iter().zip(&files) { - assert_eq!(*cid, expected_cid.parse().unwrap()); - } - - let mut buffer = Vec::new(); - let mut writer = CarWriter::new(header, &mut buffer); - for (cid, data) in &files { - writer.write(*cid, data).await.unwrap(); - } - writer.finish().await.unwrap(); - - let file = fs::read("tests/carv1_basic.car").await.unwrap(); - assert_eq!(file, buffer); -} diff --git a/iroh-car/tests/carv1_basic.car b/iroh-car/tests/carv1_basic.car Binary files differdeleted file mode 100644 index 48c67a3..0000000 --- a/iroh-car/tests/carv1_basic.car +++ /dev/null diff --git a/iroh-car/tests/testv1.car b/iroh-car/tests/testv1.car Binary files differdeleted file mode 100644 index cdc9a13..0000000 --- a/iroh-car/tests/testv1.car +++ /dev/null |