mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-22 12:54:26 +01:00
Declare the auth path in the index scheduler
This commit is contained in:
parent
eec43ec953
commit
89e127e4f4
@ -560,7 +560,7 @@ impl IndexScheduler {
|
||||
// 1. Snapshot the version file.
|
||||
// TODO where can I find the path of this file and do we create it anyway?
|
||||
// let dst = temp_snapshot_dir.path().join(VERSION_FILE_NAME);
|
||||
// let src = self.src_path.join(VERSION_FILE_NAME);
|
||||
// let src = self.base_path.join(VERSION_FILE_NAME);
|
||||
// fs::copy(src, dst)?;
|
||||
|
||||
// TODO what is a meta-env in the previous version of the scheduler?
|
||||
@ -618,9 +618,7 @@ impl IndexScheduler {
|
||||
// 4. Snapshot the auth LMDB env
|
||||
let dst = temp_snapshot_dir.path().join("auth").join("data.mdb");
|
||||
fs::create_dir_all(&dst)?;
|
||||
// TODO find a better way to get the auth database path
|
||||
let auth_path = self.env.path().join("..").join("auth");
|
||||
let auth = milli::heed::EnvOpenOptions::new().open(auth_path)?;
|
||||
let auth = milli::heed::EnvOpenOptions::new().open(&self.auth_path)?;
|
||||
auth.copy_to_path(dst, CompactionOption::Enabled)?;
|
||||
|
||||
todo!("tar-gz and append .snapshot at the end of the file");
|
||||
|
@ -27,6 +27,7 @@ pub fn snapshot_index_scheduler(scheduler: &IndexScheduler) -> String {
|
||||
wake_up: _,
|
||||
dumps_path: _,
|
||||
snapshots_path: _,
|
||||
auth_path: _,
|
||||
test_breakpoint_sdr: _,
|
||||
planned_failures: _,
|
||||
run_loop_iteration: _,
|
||||
|
@ -245,6 +245,9 @@ pub struct IndexScheduler {
|
||||
/// The path used to create the snapshots.
|
||||
pub(crate) snapshots_path: PathBuf,
|
||||
|
||||
/// The path to the folder containing the auth LMDB env.
|
||||
pub(crate) auth_path: PathBuf,
|
||||
|
||||
// ================= test
|
||||
// The next entry is dedicated to the tests.
|
||||
/// Provide a way to set a breakpoint in multiple part of the scheduler.
|
||||
@ -282,6 +285,7 @@ impl IndexScheduler {
|
||||
autobatching_enabled: self.autobatching_enabled,
|
||||
snapshots_path: self.snapshots_path.clone(),
|
||||
dumps_path: self.dumps_path.clone(),
|
||||
auth_path: self.auth_path.clone(),
|
||||
#[cfg(test)]
|
||||
test_breakpoint_sdr: self.test_breakpoint_sdr.clone(),
|
||||
#[cfg(test)]
|
||||
@ -306,9 +310,11 @@ pub enum Breakpoint {
|
||||
}
|
||||
|
||||
impl IndexScheduler {
|
||||
// TODO create a struct of options with a documented field for each required option instead
|
||||
/// Create an index scheduler and start its run loop.
|
||||
///
|
||||
/// ## Arguments
|
||||
/// - `auth_path`: the path to the folder containing the auth LMDB env
|
||||
/// - `tasks_path`: the path to the folder containing the task databases
|
||||
/// - `update_file_path`: the path to the file store containing the files associated to the tasks
|
||||
/// - `indexes_path`: the path to the folder containing meilisearch's indexes
|
||||
@ -320,6 +326,7 @@ impl IndexScheduler {
|
||||
/// together, to process multiple tasks at once.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
auth_path: PathBuf,
|
||||
tasks_path: PathBuf,
|
||||
update_file_path: PathBuf,
|
||||
indexes_path: PathBuf,
|
||||
@ -363,6 +370,7 @@ impl IndexScheduler {
|
||||
autobatching_enabled,
|
||||
dumps_path,
|
||||
snapshots_path,
|
||||
auth_path,
|
||||
|
||||
#[cfg(test)]
|
||||
test_breakpoint_sdr,
|
||||
|
@ -110,6 +110,8 @@ pub fn setup_meilisearch(opt: &Opt) -> anyhow::Result<(IndexScheduler, AuthContr
|
||||
let auth_controller_builder = || AuthController::new(&opt.db_path, &opt.master_key);
|
||||
let index_scheduler_builder = || {
|
||||
IndexScheduler::new(
|
||||
// TODO find a better way to have the path of the auth store
|
||||
opt.db_path.join("auth"),
|
||||
opt.db_path.join("tasks"),
|
||||
opt.db_path.join("update_files"),
|
||||
opt.db_path.join("indexes"),
|
||||
|
Loading…
Reference in New Issue
Block a user