image_index.rs:write idx of chunks (use mmap)

This commit is contained in:
Dietmar Maurer
2018-12-15 14:51:05 +01:00
parent f8838fe913
commit 606ce64bb0
5 changed files with 105 additions and 6 deletions

View File

@ -20,7 +20,7 @@ pub struct ChunkStore {
const HEX_CHARS: &'static [u8; 16] = b"0123456789abcdef";
fn u256_to_hex(digest: &[u8; 32]) -> String {
pub fn u256_to_hex(digest: &[u8; 32]) -> String {
let mut buf = Vec::<u8>::with_capacity(64);
@ -158,7 +158,7 @@ impl ChunkStore {
let mut digest = [0u8; 32];
self.hasher.result(&mut digest);
println!("DIGEST {}", u256_to_hex(&digest));
//println!("DIGEST {}", u256_to_hex(&digest));
let mut chunk_path = self.base.clone();
let prefix = u256_to_prefix(&digest);
@ -198,6 +198,13 @@ impl ChunkStore {
Ok((false, digest))
}
pub fn relative_path(&self, path: &Path) -> PathBuf {
let mut full_path = self.base.clone();
full_path.push(path);
full_path
}
}