mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-24 13:40:31 +01:00
feat: Add accessor for database and index path
This commit is contained in:
parent
23833bac10
commit
315fc1fbe3
@ -293,6 +293,10 @@ impl DatabaseIndex {
|
|||||||
|
|
||||||
Ok(view)
|
Ok(view)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn path(&self) -> &Path {
|
||||||
|
self.path.as_path()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for DatabaseIndex {
|
impl Drop for DatabaseIndex {
|
||||||
@ -409,6 +413,16 @@ impl Database {
|
|||||||
Ok(index_guard.val().update_config(config)?)
|
Ok(index_guard.val().update_config(config)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn path(&self) -> &Path {
|
||||||
|
self.path.as_path()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn index_path(&self, index: &str) -> Result<PathBuf, Box<Error>> {
|
||||||
|
let index_guard = self.indexes.get(index).ok_or("Index not found")?;
|
||||||
|
let path = index_guard.val().path();
|
||||||
|
Ok(path.to_path_buf())
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user