feat: provide rusty manifest

This commit is contained in:
DecDuck
2025-12-13 21:28:20 +11:00
parent ed0b7bcf42
commit e37e3f620b
3 changed files with 7 additions and 8 deletions
+1 -1
View File
@@ -219,7 +219,7 @@ dependencies = [
[[package]]
name = "droplet-rs"
version = "0.11.0"
version = "0.11.1"
dependencies = [
"anyhow",
"async-trait",
+1 -1
View File
@@ -2,7 +2,7 @@
edition = "2021"
authors = ["Drop-OSS"]
name = "droplet-rs"
version = "0.11.0"
version = "0.11.1"
license = "AGPL-3.0-only"
description = "Droplet is a `napi.rs` Rust/Node.js package full of high-performance and low-level utils for Drop"
+5 -6
View File
@@ -18,7 +18,7 @@ use sha2::{Digest as _, Sha256};
use tokio::{io::AsyncReadExt as _, join, sync::Mutex};
#[derive(Serialize, Clone)]
struct FileEntry {
pub struct FileEntry {
filename: String,
start: usize,
length: usize,
@@ -26,13 +26,13 @@ struct FileEntry {
}
#[derive(Serialize, Clone)]
struct ChunkData {
pub struct ChunkData {
files: Vec<FileEntry>,
checksum: String,
}
#[derive(Serialize)]
struct Manifest {
pub struct Manifest {
version: String,
chunks: HashMap<String, ChunkData>,
size: u64,
@@ -47,7 +47,7 @@ pub async fn generate_manifest_rusty<T: Fn(String), V: Fn(f32)>(
dir: &Path,
progress_sfn: V,
log_sfn: T,
) -> anyhow::Result<String> {
) -> anyhow::Result<Manifest> {
let mut backend =
create_backend_constructor(dir).ok_or(anyhow!("Could not create backend for path."))?()?;
@@ -222,10 +222,9 @@ pub async fn generate_manifest_rusty<T: Fn(String), V: Fn(f32)>(
let manifest = manifest.lock().await;
let manifest = manifest.clone();
Ok(json!(Manifest {
Ok(Manifest {
version: "2".to_string(),
chunks: manifest,
size: total_manifest_length.fetch_add(0, Ordering::Relaxed)
})
.to_string())
}