src/backup/dynamic_index.rs: introduce ReadChunk trait

This commit is contained in:
Dietmar Maurer
2019-06-28 16:35:00 +02:00
parent 09d7dc5024
commit d48a9955a5
2 changed files with 54 additions and 39 deletions

View File

@ -112,7 +112,9 @@ impl DataStore {
pub fn open_dynamic_reader<P: AsRef<Path>>(&self, filename: P) -> Result<DynamicIndexReader, Error> {
let index = DynamicIndexReader::open(self.chunk_store.clone(), filename.as_ref())?;
let full_path = self.chunk_store.relative_path(filename.as_ref());
let index = DynamicIndexReader::open(&full_path)?;
Ok(index)
}
@ -257,6 +259,10 @@ impl DataStore {
Ok(())
}
pub fn chunk_path(&self, digest:&[u8; 32]) -> (PathBuf, String) {
self.chunk_store.chunk_path(digest)
}
pub fn insert_chunk(
&self,
chunk: &DataChunk,