mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 03:55:07 +08: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.
|
// 1. Snapshot the version file.
|
||||||
// TODO where can I find the path of this file and do we create it anyway?
|
// 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 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)?;
|
// fs::copy(src, dst)?;
|
||||||
|
|
||||||
// TODO what is a meta-env in the previous version of the scheduler?
|
// 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
|
// 4. Snapshot the auth LMDB env
|
||||||
let dst = temp_snapshot_dir.path().join("auth").join("data.mdb");
|
let dst = temp_snapshot_dir.path().join("auth").join("data.mdb");
|
||||||
fs::create_dir_all(&dst)?;
|
fs::create_dir_all(&dst)?;
|
||||||
// TODO find a better way to get the auth database path
|
let auth = milli::heed::EnvOpenOptions::new().open(&self.auth_path)?;
|
||||||
let auth_path = self.env.path().join("..").join("auth");
|
|
||||||
let auth = milli::heed::EnvOpenOptions::new().open(auth_path)?;
|
|
||||||
auth.copy_to_path(dst, CompactionOption::Enabled)?;
|
auth.copy_to_path(dst, CompactionOption::Enabled)?;
|
||||||
|
|
||||||
todo!("tar-gz and append .snapshot at the end of the file");
|
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: _,
|
wake_up: _,
|
||||||
dumps_path: _,
|
dumps_path: _,
|
||||||
snapshots_path: _,
|
snapshots_path: _,
|
||||||
|
auth_path: _,
|
||||||
test_breakpoint_sdr: _,
|
test_breakpoint_sdr: _,
|
||||||
planned_failures: _,
|
planned_failures: _,
|
||||||
run_loop_iteration: _,
|
run_loop_iteration: _,
|
||||||
|
@ -245,6 +245,9 @@ pub struct IndexScheduler {
|
|||||||
/// The path used to create the snapshots.
|
/// The path used to create the snapshots.
|
||||||
pub(crate) snapshots_path: PathBuf,
|
pub(crate) snapshots_path: PathBuf,
|
||||||
|
|
||||||
|
/// The path to the folder containing the auth LMDB env.
|
||||||
|
pub(crate) auth_path: PathBuf,
|
||||||
|
|
||||||
// ================= test
|
// ================= test
|
||||||
// The next entry is dedicated to the tests.
|
// The next entry is dedicated to the tests.
|
||||||
/// Provide a way to set a breakpoint in multiple part of the scheduler.
|
/// Provide a way to set a breakpoint in multiple part of the scheduler.
|
||||||
@ -282,6 +285,7 @@ impl IndexScheduler {
|
|||||||
autobatching_enabled: self.autobatching_enabled,
|
autobatching_enabled: self.autobatching_enabled,
|
||||||
snapshots_path: self.snapshots_path.clone(),
|
snapshots_path: self.snapshots_path.clone(),
|
||||||
dumps_path: self.dumps_path.clone(),
|
dumps_path: self.dumps_path.clone(),
|
||||||
|
auth_path: self.auth_path.clone(),
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
test_breakpoint_sdr: self.test_breakpoint_sdr.clone(),
|
test_breakpoint_sdr: self.test_breakpoint_sdr.clone(),
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@ -306,9 +310,11 @@ pub enum Breakpoint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl IndexScheduler {
|
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.
|
/// Create an index scheduler and start its run loop.
|
||||||
///
|
///
|
||||||
/// ## Arguments
|
/// ## Arguments
|
||||||
|
/// - `auth_path`: the path to the folder containing the auth LMDB env
|
||||||
/// - `tasks_path`: the path to the folder containing the task databases
|
/// - `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
|
/// - `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
|
/// - `indexes_path`: the path to the folder containing meilisearch's indexes
|
||||||
@ -320,6 +326,7 @@ impl IndexScheduler {
|
|||||||
/// together, to process multiple tasks at once.
|
/// together, to process multiple tasks at once.
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn new(
|
pub fn new(
|
||||||
|
auth_path: PathBuf,
|
||||||
tasks_path: PathBuf,
|
tasks_path: PathBuf,
|
||||||
update_file_path: PathBuf,
|
update_file_path: PathBuf,
|
||||||
indexes_path: PathBuf,
|
indexes_path: PathBuf,
|
||||||
@ -363,6 +370,7 @@ impl IndexScheduler {
|
|||||||
autobatching_enabled,
|
autobatching_enabled,
|
||||||
dumps_path,
|
dumps_path,
|
||||||
snapshots_path,
|
snapshots_path,
|
||||||
|
auth_path,
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
test_breakpoint_sdr,
|
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 auth_controller_builder = || AuthController::new(&opt.db_path, &opt.master_key);
|
||||||
let index_scheduler_builder = || {
|
let index_scheduler_builder = || {
|
||||||
IndexScheduler::new(
|
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("tasks"),
|
||||||
opt.db_path.join("update_files"),
|
opt.db_path.join("update_files"),
|
||||||
opt.db_path.join("indexes"),
|
opt.db_path.join("indexes"),
|
||||||
|
Loading…
Reference in New Issue
Block a user