diff options
Diffstat (limited to 'adenosine-pds/src')
-rw-r--r-- | adenosine-pds/src/car.rs | 2 | ||||
-rw-r--r-- | adenosine-pds/src/lib.rs | 1 | ||||
-rw-r--r-- | adenosine-pds/src/vendored.rs | 1 | ||||
-rw-r--r-- | adenosine-pds/src/vendored/iroh_car/error.rs | 3 | ||||
-rw-r--r-- | adenosine-pds/src/vendored/iroh_car/header.rs | 15 | ||||
-rw-r--r-- | adenosine-pds/src/vendored/iroh_car/mod.rs | 10 | ||||
-rw-r--r-- | adenosine-pds/src/vendored/iroh_car/reader.rs | 10 | ||||
-rw-r--r-- | adenosine-pds/src/vendored/iroh_car/util.rs | 2 | ||||
-rw-r--r-- | adenosine-pds/src/vendored/iroh_car/writer.rs | 4 |
9 files changed, 31 insertions, 17 deletions
diff --git a/adenosine-pds/src/car.rs b/adenosine-pds/src/car.rs index b14d0b1..43b4e1f 100644 --- a/adenosine-pds/src/car.rs +++ b/adenosine-pds/src/car.rs @@ -1,8 +1,8 @@ use anyhow::Result; +use crate::vendored::iroh_car::CarReader; use futures::TryStreamExt; use ipfs_sqlite_block_store::BlockStore; -use iroh_car::CarReader; use libipld::{Block, Cid}; use std::path::PathBuf; use tokio::fs::File; diff --git a/adenosine-pds/src/lib.rs b/adenosine-pds/src/lib.rs index 4071570..ac3868a 100644 --- a/adenosine-pds/src/lib.rs +++ b/adenosine-pds/src/lib.rs @@ -20,6 +20,7 @@ mod models; pub mod mst; mod repo; mod ucan_p256; +mod vendored; pub use car::{load_car_to_blockstore, load_car_to_sqlite}; pub use crypto::{KeyPair, PubKey}; diff --git a/adenosine-pds/src/vendored.rs b/adenosine-pds/src/vendored.rs new file mode 100644 index 0000000..74584ad --- /dev/null +++ b/adenosine-pds/src/vendored.rs @@ -0,0 +1 @@ +pub mod iroh_car; diff --git a/adenosine-pds/src/vendored/iroh_car/error.rs b/adenosine-pds/src/vendored/iroh_car/error.rs index 3579413..1edcefe 100644 --- a/adenosine-pds/src/vendored/iroh_car/error.rs +++ b/adenosine-pds/src/vendored/iroh_car/error.rs @@ -1,3 +1,4 @@ +use libipld::cid; use thiserror::Error; /// Car utility error @@ -10,7 +11,7 @@ pub enum Error { #[error("Io error: {0}")] Io(#[from] std::io::Error), #[error("Cbor encoding error: {0}")] - Cbor(#[from] ipld::error::Error), + Cbor(#[from] libipld::error::Error), #[error("ld read too large {0}")] LdReadTooLarge(usize), } diff --git a/adenosine-pds/src/vendored/iroh_car/header.rs b/adenosine-pds/src/vendored/iroh_car/header.rs index c004e35..051d2cc 100644 --- a/adenosine-pds/src/vendored/iroh_car/header.rs +++ b/adenosine-pds/src/vendored/iroh_car/header.rs @@ -1,8 +1,9 @@ -use cid::Cid; -use ipld::codec::Codec; -use ipld_cbor::DagCborCodec; +use libipld::cbor::DagCborCodec; +use libipld::codec::Codec; +use libipld::ipld; +use libipld::Cid; -use crate::error::Error; +use super::error::Error; /// A car header. #[derive(Debug, Clone, PartialEq, Eq)] @@ -57,7 +58,7 @@ impl CarHeader { } /// CAR file header version 1. -#[derive(Debug, Clone, Default, ipld::DagCbor, PartialEq, Eq)] +#[derive(Debug, Clone, Default, libipld::DagCbor, PartialEq, Eq)] pub struct CarHeaderV1 { #[ipld] pub roots: Vec<Cid>, @@ -80,8 +81,8 @@ impl From<Vec<Cid>> for CarHeaderV1 { #[cfg(test)] mod tests { - use ipld::codec::{Decode, Encode}; - use ipld_cbor::DagCborCodec; + use libipld::cbor::DagCborCodec; + use libipld::codec::{Decode, Encode}; use multihash::MultihashDigest; use super::*; diff --git a/adenosine-pds/src/vendored/iroh_car/mod.rs b/adenosine-pds/src/vendored/iroh_car/mod.rs new file mode 100644 index 0000000..b40e046 --- /dev/null +++ b/adenosine-pds/src/vendored/iroh_car/mod.rs @@ -0,0 +1,10 @@ +/// Module version of lib.rs +mod error; +mod header; +mod reader; +mod util; +mod writer; + +pub use header::CarHeader; +pub use reader::CarReader; +pub use writer::CarWriter; diff --git a/adenosine-pds/src/vendored/iroh_car/reader.rs b/adenosine-pds/src/vendored/iroh_car/reader.rs index c0209be..916f27e 100644 --- a/adenosine-pds/src/vendored/iroh_car/reader.rs +++ b/adenosine-pds/src/vendored/iroh_car/reader.rs @@ -1,8 +1,8 @@ -use cid::Cid; use futures::Stream; +use libipld::Cid; use tokio::io::AsyncRead; -use crate::{ +use super::{ error::Error, header::CarHeader, util::{ld_read, read_node}, @@ -61,12 +61,12 @@ where mod tests { use std::io::Cursor; - use cid::Cid; use futures::TryStreamExt; - use ipld_cbor::DagCborCodec; + use libipld::cbor::DagCborCodec; + use libipld::Cid; use multihash::MultihashDigest; - use crate::{header::CarHeaderV1, writer::CarWriter}; + use super::super::{header::CarHeaderV1, writer::CarWriter}; use super::*; diff --git a/adenosine-pds/src/vendored/iroh_car/util.rs b/adenosine-pds/src/vendored/iroh_car/util.rs index 25be761..90435b1 100644 --- a/adenosine-pds/src/vendored/iroh_car/util.rs +++ b/adenosine-pds/src/vendored/iroh_car/util.rs @@ -1,5 +1,5 @@ -use cid::Cid; use integer_encoding::VarIntAsyncReader; +use libipld::Cid; use tokio::io::{AsyncRead, AsyncReadExt}; use super::error::Error; diff --git a/adenosine-pds/src/vendored/iroh_car/writer.rs b/adenosine-pds/src/vendored/iroh_car/writer.rs index 9f17eb9..4299b5d 100644 --- a/adenosine-pds/src/vendored/iroh_car/writer.rs +++ b/adenosine-pds/src/vendored/iroh_car/writer.rs @@ -1,8 +1,8 @@ -use cid::Cid; use integer_encoding::VarIntAsyncWriter; +use libipld::Cid; use tokio::io::{AsyncWrite, AsyncWriteExt}; -use crate::{error::Error, header::CarHeader}; +use super::{error::Error, header::CarHeader}; #[derive(Debug)] pub struct CarWriter<W> { |