mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 04:17:10 +02:00
Merge b853de9584
into 904b82a61d
This commit is contained in:
commit
faa3d466b4
20 changed files with 41 additions and 21 deletions
|
@ -103,7 +103,7 @@ impl ReopenableIndex {
|
|||
return Ok(());
|
||||
}
|
||||
map.unavailable.remove(&self.uuid);
|
||||
map.create(&self.uuid, path, None, self.enable_mdb_writemap, self.map_size)?;
|
||||
map.create(None, &self.uuid, path, None, self.enable_mdb_writemap, self.map_size)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
@ -167,6 +167,7 @@ impl IndexMap {
|
|||
///
|
||||
pub fn create(
|
||||
&mut self,
|
||||
name: Option<String>,
|
||||
uuid: &Uuid,
|
||||
path: &Path,
|
||||
date: Option<(OffsetDateTime, OffsetDateTime)>,
|
||||
|
@ -176,7 +177,7 @@ impl IndexMap {
|
|||
if !matches!(self.get_unavailable(uuid), Missing) {
|
||||
panic!("Attempt to open an index that was unavailable");
|
||||
}
|
||||
let index = create_or_open_index(path, date, enable_mdb_writemap, map_size)?;
|
||||
let index = create_or_open_index(name, path, date, enable_mdb_writemap, map_size)?;
|
||||
match self.available.insert(*uuid, index.clone()) {
|
||||
InsertionOutcome::InsertedNew => (),
|
||||
InsertionOutcome::Evicted(evicted_uuid, evicted_index) => {
|
||||
|
@ -296,6 +297,7 @@ impl IndexMap {
|
|||
/// Create or open an index in the specified path.
|
||||
/// The path *must* exist or an error will be thrown.
|
||||
fn create_or_open_index(
|
||||
name: Option<String>,
|
||||
path: &Path,
|
||||
date: Option<(OffsetDateTime, OffsetDateTime)>,
|
||||
enable_mdb_writemap: bool,
|
||||
|
@ -309,9 +311,9 @@ fn create_or_open_index(
|
|||
}
|
||||
|
||||
if let Some((created, updated)) = date {
|
||||
Ok(Index::new_with_creation_dates(options, path, created, updated)?)
|
||||
Ok(Index::new_with_creation_dates(name, options, path, created, updated)?)
|
||||
} else {
|
||||
Ok(Index::new(options, path)?)
|
||||
Ok(Index::new(name, options, path)?)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -182,6 +182,7 @@ impl IndexMapper {
|
|||
// This is very unlikely to happen in practice.
|
||||
// TODO: it would be better to lazily create the index. But we need an Index::open function for milli.
|
||||
let index = self.index_map.write().unwrap().create(
|
||||
Some(name.to_string()),
|
||||
&uuid,
|
||||
&index_path,
|
||||
date,
|
||||
|
@ -371,6 +372,7 @@ impl IndexMapper {
|
|||
let index_path = self.base_path.join(uuid.to_string());
|
||||
|
||||
break index_map.create(
|
||||
Some(name.to_string()),
|
||||
&uuid,
|
||||
&index_path,
|
||||
None,
|
||||
|
|
|
@ -282,6 +282,9 @@ pub struct IndexSchedulerOptions {
|
|||
/// Structure which holds meilisearch's indexes and schedules the tasks
|
||||
/// to be performed on them.
|
||||
pub struct IndexScheduler {
|
||||
/// A String representing the name of the index
|
||||
pub(crate) name: String,
|
||||
|
||||
/// The LMDB environment which the DBs are associated with.
|
||||
pub(crate) env: Env,
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue