1
0
Fork 0
mirror of https://github.com/zhaofengli/attic.git synced 2024-12-14 11:57:30 +00:00

Move chunking to attic crate

This commit is contained in:
Zhaofeng Li 2024-08-19 14:49:56 -04:00
parent 956d6915a5
commit deff31a850
7 changed files with 11 additions and 6 deletions

2
Cargo.lock generated
View file

@ -236,6 +236,7 @@ dependencies = [
"digest",
"displaydoc",
"ed25519-compact",
"fastcdc",
"futures",
"hex",
"lazy_static",
@ -309,7 +310,6 @@ dependencies = [
"digest",
"displaydoc",
"enum-as-inner",
"fastcdc",
"futures",
"hex",
"http-body-util",

View file

@ -11,6 +11,7 @@ bytes = "1.4.0"
displaydoc = "0.2.4"
digest = "0.10.7"
ed25519-compact = "2.0.4"
fastcdc = "3.0.3"
futures = "0.3.28"
hex = "0.4.3"
lazy_static = "1.4.0"
@ -51,11 +52,15 @@ version-compare = "0.2.0"
[features]
default = [
"chunking",
"nix_store",
"stream",
"tokio",
]
# Chunking.
chunking = ["tokio", "dep:async-stream"]
# Native libnixstore bindings.
#
# When disabled, the native Rust portions of nix_store can still be used.

View file

@ -9,7 +9,7 @@ use fastcdc::ronomon::FastCDC;
use futures::stream::Stream;
use tokio::io::AsyncRead;
use attic::stream::read_chunk_async;
use crate::stream::read_chunk_async;
/// Splits a streams into content-defined chunks.
///

View file

@ -17,6 +17,8 @@
pub mod api;
pub mod cache;
#[cfg(feature = "chunking")]
pub mod chunking;
pub mod error;
pub mod hash;
pub mod mime;

View file

@ -19,7 +19,7 @@ path = "src/adm/main.rs"
doc = false
[dependencies]
attic = { path = "../attic", default-features = false, features = ["stream", "tokio"] }
attic = { path = "../attic", default-features = false, features = ["chunking", "stream", "tokio"] }
attic-token = { path = "../token" }
anyhow = "1.0.71"
@ -37,7 +37,6 @@ derivative = "2.2.0"
digest = "0.10.7"
displaydoc = "0.2.4"
enum-as-inner = "0.6.0"
fastcdc = "3.0.3"
futures = "0.3.28"
hex = "0.4.3"
http-body-util = "0.1.1"

View file

@ -37,11 +37,11 @@ use attic::api::v1::upload_path::{
UploadPathNarInfo, UploadPathResult, UploadPathResultKind, ATTIC_NAR_INFO,
ATTIC_NAR_INFO_PREAMBLE_SIZE,
};
use attic::chunking::chunk_stream;
use attic::hash::Hash;
use attic::stream::{read_chunk_async, StreamHasher};
use attic::util::Finally;
use crate::chunking::chunk_stream;
use crate::database::entity::cache;
use crate::database::entity::chunk::{self, ChunkState, Entity as Chunk};
use crate::database::entity::chunkref::{self, Entity as ChunkRef};

View file

@ -15,7 +15,6 @@
pub mod access;
mod api;
mod chunking;
pub mod config;
pub mod database;
pub mod error;