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:
parent
956d6915a5
commit
deff31a850
7 changed files with 11 additions and 6 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -236,6 +236,7 @@ dependencies = [
|
||||||
"digest",
|
"digest",
|
||||||
"displaydoc",
|
"displaydoc",
|
||||||
"ed25519-compact",
|
"ed25519-compact",
|
||||||
|
"fastcdc",
|
||||||
"futures",
|
"futures",
|
||||||
"hex",
|
"hex",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
|
@ -309,7 +310,6 @@ dependencies = [
|
||||||
"digest",
|
"digest",
|
||||||
"displaydoc",
|
"displaydoc",
|
||||||
"enum-as-inner",
|
"enum-as-inner",
|
||||||
"fastcdc",
|
|
||||||
"futures",
|
"futures",
|
||||||
"hex",
|
"hex",
|
||||||
"http-body-util",
|
"http-body-util",
|
||||||
|
|
|
@ -11,6 +11,7 @@ bytes = "1.4.0"
|
||||||
displaydoc = "0.2.4"
|
displaydoc = "0.2.4"
|
||||||
digest = "0.10.7"
|
digest = "0.10.7"
|
||||||
ed25519-compact = "2.0.4"
|
ed25519-compact = "2.0.4"
|
||||||
|
fastcdc = "3.0.3"
|
||||||
futures = "0.3.28"
|
futures = "0.3.28"
|
||||||
hex = "0.4.3"
|
hex = "0.4.3"
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
|
@ -51,11 +52,15 @@ version-compare = "0.2.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = [
|
default = [
|
||||||
|
"chunking",
|
||||||
"nix_store",
|
"nix_store",
|
||||||
"stream",
|
"stream",
|
||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Chunking.
|
||||||
|
chunking = ["tokio", "dep:async-stream"]
|
||||||
|
|
||||||
# Native libnixstore bindings.
|
# Native libnixstore bindings.
|
||||||
#
|
#
|
||||||
# When disabled, the native Rust portions of nix_store can still be used.
|
# When disabled, the native Rust portions of nix_store can still be used.
|
||||||
|
|
|
@ -9,7 +9,7 @@ use fastcdc::ronomon::FastCDC;
|
||||||
use futures::stream::Stream;
|
use futures::stream::Stream;
|
||||||
use tokio::io::AsyncRead;
|
use tokio::io::AsyncRead;
|
||||||
|
|
||||||
use attic::stream::read_chunk_async;
|
use crate::stream::read_chunk_async;
|
||||||
|
|
||||||
/// Splits a streams into content-defined chunks.
|
/// Splits a streams into content-defined chunks.
|
||||||
///
|
///
|
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
pub mod api;
|
pub mod api;
|
||||||
pub mod cache;
|
pub mod cache;
|
||||||
|
#[cfg(feature = "chunking")]
|
||||||
|
pub mod chunking;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
pub mod hash;
|
pub mod hash;
|
||||||
pub mod mime;
|
pub mod mime;
|
||||||
|
|
|
@ -19,7 +19,7 @@ path = "src/adm/main.rs"
|
||||||
doc = false
|
doc = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
attic = { path = "../attic", default-features = false, features = ["stream", "tokio"] }
|
attic = { path = "../attic", default-features = false, features = ["chunking", "stream", "tokio"] }
|
||||||
attic-token = { path = "../token" }
|
attic-token = { path = "../token" }
|
||||||
|
|
||||||
anyhow = "1.0.71"
|
anyhow = "1.0.71"
|
||||||
|
@ -37,7 +37,6 @@ derivative = "2.2.0"
|
||||||
digest = "0.10.7"
|
digest = "0.10.7"
|
||||||
displaydoc = "0.2.4"
|
displaydoc = "0.2.4"
|
||||||
enum-as-inner = "0.6.0"
|
enum-as-inner = "0.6.0"
|
||||||
fastcdc = "3.0.3"
|
|
||||||
futures = "0.3.28"
|
futures = "0.3.28"
|
||||||
hex = "0.4.3"
|
hex = "0.4.3"
|
||||||
http-body-util = "0.1.1"
|
http-body-util = "0.1.1"
|
||||||
|
|
|
@ -37,11 +37,11 @@ use attic::api::v1::upload_path::{
|
||||||
UploadPathNarInfo, UploadPathResult, UploadPathResultKind, ATTIC_NAR_INFO,
|
UploadPathNarInfo, UploadPathResult, UploadPathResultKind, ATTIC_NAR_INFO,
|
||||||
ATTIC_NAR_INFO_PREAMBLE_SIZE,
|
ATTIC_NAR_INFO_PREAMBLE_SIZE,
|
||||||
};
|
};
|
||||||
|
use attic::chunking::chunk_stream;
|
||||||
use attic::hash::Hash;
|
use attic::hash::Hash;
|
||||||
use attic::stream::{read_chunk_async, StreamHasher};
|
use attic::stream::{read_chunk_async, StreamHasher};
|
||||||
use attic::util::Finally;
|
use attic::util::Finally;
|
||||||
|
|
||||||
use crate::chunking::chunk_stream;
|
|
||||||
use crate::database::entity::cache;
|
use crate::database::entity::cache;
|
||||||
use crate::database::entity::chunk::{self, ChunkState, Entity as Chunk};
|
use crate::database::entity::chunk::{self, ChunkState, Entity as Chunk};
|
||||||
use crate::database::entity::chunkref::{self, Entity as ChunkRef};
|
use crate::database::entity::chunkref::{self, Entity as ChunkRef};
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
|
|
||||||
pub mod access;
|
pub mod access;
|
||||||
mod api;
|
mod api;
|
||||||
mod chunking;
|
|
||||||
pub mod config;
|
pub mod config;
|
||||||
pub mod database;
|
pub mod database;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
|
|
Loading…
Reference in a new issue