load index dump

This commit is contained in:
Marin Postma 2021-05-26 22:52:06 +02:00
parent e818c33fec
commit b924e897f1
No known key found for this signature in database
GPG key ID: D5241F0C0C865F30
11 changed files with 261 additions and 279 deletions

View file

@ -1,8 +1,3 @@
mod actor;
mod handle_impl;
mod message;
mod loaders;
use std::{fs::File, path::Path};
use log::error;
@ -18,6 +13,15 @@ pub use actor::DumpActor;
pub use handle_impl::*;
pub use message::DumpMsg;
use crate::option::IndexerOpts;
use super::uuid_resolver::store::UuidStore;
mod actor;
mod handle_impl;
mod loaders;
mod message;
pub type DumpResult<T> = std::result::Result<T, DumpError>;
#[derive(Error, Debug)]
@ -117,11 +121,12 @@ impl DumpInfo {
}
}
pub fn load_dump(
pub fn load_dump<U: UuidStore>(
dst_path: impl AsRef<Path>,
src_path: impl AsRef<Path>,
_index_db_size: u64,
_update_db_size: u64,
indexer_opts: &IndexerOpts,
) -> anyhow::Result<()> {
let meta_path = src_path.as_ref().join("metadat.json");
let mut meta_file = File::open(&meta_path)?;
@ -129,7 +134,7 @@ pub fn load_dump(
match meta {
Metadata::V1 { meta } => meta.load_dump(src_path, dst_path)?,
Metadata::V2 { meta } => meta.load_dump(src_path, dst_path)?,
Metadata::V2 { meta } => meta.load_dump(src_path.as_ref(), dst_path.as_ref(), indexer_opts)?,
}
Ok(())