wip big download
This commit is contained in:
@@ -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)]
|
||||
|
||||
Reference in New Issue
Block a user