src/backup/archive_index.rs: first try

This commit is contained in:
Dietmar Maurer
2018-12-31 17:30:08 +01:00
parent cbdd8c54ae
commit 0433db1949
6 changed files with 152 additions and 30 deletions

View File

@ -8,6 +8,7 @@ use std::sync::{Mutex, Arc};
use crate::config::datastore;
use super::chunk_store::*;
use super::image_index::*;
use super::archive_index::*;
pub struct DataStore {
chunk_store: ChunkStore,
@ -76,6 +77,16 @@ impl DataStore {
Ok(index)
}
pub fn create_archive_writer<P: AsRef<Path>>(
&self, filename: P,
chunk_size: usize
) -> Result<ArchiveIndexWriter, Error> {
let index = ArchiveIndexWriter::create(&self.chunk_store, filename.as_ref(), chunk_size)?;
Ok(index)
}
pub fn list_images(&self) -> Result<Vec<PathBuf>, Error> {
let base = self.chunk_store.base_path();