diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2022-11-06 21:49:49 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2022-11-06 21:49:49 -0800 |
commit | 55cad7251ecdda15989842d3b686e46d0b42df0e (patch) | |
tree | 97ca052a4ef26e96a018fa70fe8eecebf1f5273d /adenosine-pds/src/vendored/iroh_car | |
parent | 6111c481fac3d5c305a379b3be8afb87190db3d5 (diff) | |
download | adenosine-55cad7251ecdda15989842d3b686e46d0b42df0e.tar.gz adenosine-55cad7251ecdda15989842d3b686e46d0b42df0e.zip |
pds: wrangle 'iroh_car' in to PDS code
Diffstat (limited to 'adenosine-pds/src/vendored/iroh_car')
-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 |
6 files changed, 28 insertions, 16 deletions
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> { |