From bb6448dc2ea7fa22998e95cf3a3e9454eaa43063 Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Thu, 22 Jun 2023 23:10:22 +0200 Subject: [PATCH] Compute instance features from CLI options --- meilisearch/src/lib.rs | 2 ++ meilisearch/src/option.rs | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/meilisearch/src/lib.rs b/meilisearch/src/lib.rs index bee53f6f8..a9bd68934 100644 --- a/meilisearch/src/lib.rs +++ b/meilisearch/src/lib.rs @@ -221,6 +221,7 @@ fn open_or_create_database_unchecked( // we don't want to create anything in the data.ms yet, thus we // wrap our two builders in a closure that'll be executed later. let auth_controller = AuthController::new(&opt.db_path, &opt.master_key); + let instance_features = opt.to_instance_features(); let index_scheduler_builder = || -> anyhow::Result<_> { Ok(IndexScheduler::new(IndexSchedulerOptions { version_file_path: opt.db_path.join(VERSION_FILE_NAME), @@ -238,6 +239,7 @@ fn open_or_create_database_unchecked( max_number_of_tasks: 1_000_000, index_growth_amount: byte_unit::Byte::from_str("10GiB").unwrap().get_bytes() as usize, index_count: DEFAULT_INDEX_COUNT, + instance_features, })?) }; diff --git a/meilisearch/src/option.rs b/meilisearch/src/option.rs index 0511b5033..eaf96ee0c 100644 --- a/meilisearch/src/option.rs +++ b/meilisearch/src/option.rs @@ -12,6 +12,7 @@ use std::{env, fmt, fs}; use byte_unit::{Byte, ByteError}; use clap::Parser; +use meilisearch_types::features::InstanceTogglableFeatures; use meilisearch_types::milli::update::IndexerConfig; use rustls::server::{ AllowAnyAnonymousOrAuthenticatedClient, AllowAnyAuthenticatedClient, ServerSessionMemoryCache, @@ -486,6 +487,10 @@ impl Opt { Ok(None) } } + + pub(crate) fn to_instance_features(&self) -> InstanceTogglableFeatures { + InstanceTogglableFeatures { metrics: self.experimental_enable_metrics } + } } #[derive(Debug, Default, Clone, Parser, Deserialize)]