wip big download

This commit is contained in:
TIBERGHIEN corentin
2026-01-24 16:50:56 +01:00
parent 31b26e96b0
commit c928d98b56
7 changed files with 124 additions and 33 deletions

View File

@@ -8,6 +8,8 @@ use std::io::{self, Write};
use std::env;
use crate::data;
// --- Constants ---
pub const MAX_CHUNK_DATA_SIZE: usize = 1024;
pub const MAX_DIRECTORY_ENTRIES: usize = 16;
@@ -30,9 +32,9 @@ pub enum MerkleNode {
// 0 to 16 directory entries.
Directory(DirectoryNode) = 1,
// list of 2 to 32 hashes pointing to Chunk or Big nodes.
Big(BigNode) = 3,
Big(BigNode) = 2,
// list of 2 to 32 hashes pointing to Directory or BigDirectory nodes.
BigDirectory(BigDirectoryNode) = 4,
BigDirectory(BigDirectoryNode) = 3,
}
#[derive(Debug, Clone)]
@@ -45,6 +47,9 @@ impl MerkleTree {
pub fn new(data: HashMap<NodeHash, MerkleNode>, root: NodeHash) -> MerkleTree {
MerkleTree { data, root }
}
pub fn clear_data(&mut self) {
self.data.clear();
}
}
#[derive(Debug, Clone)]