mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
Implement POST /indexes-swap
This commit is contained in:
parent
bdb3702510
commit
14a44776f6
18 changed files with 463 additions and 64 deletions
|
@ -93,7 +93,6 @@ impl IndexMapper {
|
|||
assert!(self.index_mapping.delete(&mut wtxn, name)?);
|
||||
|
||||
wtxn.commit()?;
|
||||
|
||||
// We remove the index from the in-memory index map.
|
||||
let mut lock = self.index_map.write().unwrap();
|
||||
let closing_event = match lock.insert(uuid, BeingDeleted) {
|
||||
|
@ -186,7 +185,7 @@ impl IndexMapper {
|
|||
.collect()
|
||||
}
|
||||
|
||||
/// Swap two index name.
|
||||
/// Swap two index names.
|
||||
pub fn swap(&self, wtxn: &mut RwTxn, lhs: &str, rhs: &str) -> Result<()> {
|
||||
let lhs_uuid = self
|
||||
.index_mapping
|
||||
|
@ -203,6 +202,10 @@ impl IndexMapper {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn index_exists(&self, rtxn: &RoTxn, name: &str) -> Result<bool> {
|
||||
Ok(self.index_mapping.get(rtxn, name)?.is_some())
|
||||
}
|
||||
|
||||
pub fn indexer_config(&self) -> &IndexerConfig {
|
||||
&self.indexer_config
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue