From 3cd799a74442985347720b2c16a0686667711b67 Mon Sep 17 00:00:00 2001 From: mpostma Date: Wed, 3 Mar 2021 14:39:44 +0100 Subject: [PATCH] fix update files created in the wrong place --- src/data/mod.rs | 2 ++ .../actor_index_controller/index_actor.rs | 4 ++-- src/index_controller/actor_index_controller/mod.rs | 2 +- .../actor_index_controller/update_actor.rs | 9 ++++++--- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/data/mod.rs b/src/data/mod.rs index f2798c868..aa601a670 100644 --- a/src/data/mod.rs +++ b/src/data/mod.rs @@ -59,7 +59,9 @@ impl ApiKeys { impl Data { pub fn new(options: Opt) -> anyhow::Result { let path = options.db_path.clone(); + //let indexer_opts = options.indexer_options.clone(); + create_dir_all(&path)?; let index_controller = IndexController::new(&path); diff --git a/src/index_controller/actor_index_controller/index_actor.rs b/src/index_controller/actor_index_controller/index_actor.rs index 48b10c8a3..04920260e 100644 --- a/src/index_controller/actor_index_controller/index_actor.rs +++ b/src/index_controller/actor_index_controller/index_actor.rs @@ -196,10 +196,10 @@ pub struct IndexActorHandle { } impl IndexActorHandle { - pub fn new() -> Self { + pub fn new(path: impl AsRef) -> Self { let (sender, receiver) = mpsc::channel(100); - let store = MapIndexStore::new("data.ms"); + let store = MapIndexStore::new(path); let actor = IndexActor::new(receiver, store); tokio::task::spawn(actor.run()); Self { sender } diff --git a/src/index_controller/actor_index_controller/mod.rs b/src/index_controller/actor_index_controller/mod.rs index be63b42d4..882b20963 100644 --- a/src/index_controller/actor_index_controller/mod.rs +++ b/src/index_controller/actor_index_controller/mod.rs @@ -33,7 +33,7 @@ enum IndexControllerMsg { impl IndexController { pub fn new(path: impl AsRef) -> Self { let uuid_resolver = uuid_resolver::UuidResolverHandle::new(); - let index_actor = index_actor::IndexActorHandle::new(); + let index_actor = index_actor::IndexActorHandle::new(&path); let update_handle = update_actor::UpdateActorHandle::new(index_actor.clone(), &path); Self { uuid_resolver, index_handle: index_actor, update_handle } } diff --git a/src/index_controller/actor_index_controller/update_actor.rs b/src/index_controller/actor_index_controller/update_actor.rs index 1541cd4f7..e82f01092 100644 --- a/src/index_controller/actor_index_controller/update_actor.rs +++ b/src/index_controller/actor_index_controller/update_actor.rs @@ -112,9 +112,12 @@ where D: AsRef<[u8]> + Sized + 'static, let (sender, receiver) = mpsc::channel(100); let mut options = heed::EnvOpenOptions::new(); options.map_size(4096 * 100_000); - let mut path = PathBuf::new(); - path.push("data.ms"); - path.push("updates"); + + let path = path + .as_ref() + .to_owned() + .join("updates"); + create_dir_all(&path).unwrap(); let index_handle_clone = index_handle.clone(); let store = UpdateStore::open(options, &path, move |meta, file| {