creates an key value index for a collection
(
ctx: Arc<AppContext>,
collection: &Collection,
)
| 265 | |
| 266 | /// creates an key value index for a collection |
| 267 | pub async fn init_key_value_index_for_collection( |
| 268 | ctx: Arc<AppContext>, |
| 269 | collection: &Collection, |
| 270 | ) -> Result<Arc<KeyValueIndex>, WaCustomError> { |
| 271 | let collection_path: Arc<Path> = collection.get_path(); |
| 272 | let index_path = collection_path.join("key_value_index"); |
| 273 | fs::create_dir_all(&index_path).map_err(|e| WaCustomError::FsError(e.to_string()))?; |
| 274 | |
| 275 | let index = Arc::new(KeyValueIndex::new(index_path.clone())?); |
| 276 | |
| 277 | ctx.ain_env |
| 278 | .collections_map |
| 279 | .insert_key_value_index(collection, index.clone())?; |
| 280 | Ok(index) |
| 281 | } |
| 282 | |
| 283 | /// creates an USV for a collection |
| 284 | pub async fn init_usv_index_for_collection( |
no test coverage detected