Create a new index
(
&self,
name: String,
_index_type: super::IndexType,
_config: super::IndexConfig,
)
| 34 | |
| 35 | /// Create a new index |
| 36 | pub async fn create_index( |
| 37 | &self, |
| 38 | name: String, |
| 39 | _index_type: super::IndexType, |
| 40 | _config: super::IndexConfig, |
| 41 | ) -> Result<(), IndexError> { |
| 42 | info!("Creating index '{}'", name); |
| 43 | |
| 44 | let mut index_names = self |
| 45 | .index_names |
| 46 | .write() |
| 47 | .map_err(|e| IndexError::creation(format!("Failed to acquire lock: {}", e)))?; |
| 48 | |
| 49 | if index_names.contains(&name) { |
| 50 | return Err(IndexError::AlreadyExists(name)); |
| 51 | } |
| 52 | |
| 53 | // Store index name |
| 54 | index_names.insert(name.clone()); |
| 55 | |
| 56 | debug!("Index '{}' created successfully", name); |
| 57 | Ok(()) |
| 58 | } |
| 59 | |
| 60 | /// Delete an index |
| 61 | pub async fn delete_index(&self, name: &str) -> Result<(), IndexError> { |
no test coverage detected