mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-22 18:17:39 +08:00
feat: Return the database view for each update
This commit is contained in:
parent
f4b04dfb72
commit
36ef9581aa
@ -74,7 +74,7 @@ impl Database {
|
|||||||
Ok(Database { db: Mutex::new(db), view })
|
Ok(Database { db: Mutex::new(db), view })
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ingest_update_file(&self, update: Update) -> Result<(), Box<Error>> {
|
pub fn ingest_update_file(&self, update: Update) -> Result<Arc<DatabaseView<Arc<DB>>>, Box<Error>> {
|
||||||
let snapshot = {
|
let snapshot = {
|
||||||
// We must have a mutex here to ensure that update ingestions and compactions
|
// We must have a mutex here to ensure that update ingestions and compactions
|
||||||
// are done atomatically and in the right order.
|
// are done atomatically and in the right order.
|
||||||
@ -103,9 +103,9 @@ impl Database {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let view = Arc::new(DatabaseView::new(snapshot)?);
|
let view = Arc::new(DatabaseView::new(snapshot)?);
|
||||||
self.view.set(view);
|
self.view.set(view.clone());
|
||||||
|
|
||||||
Ok(())
|
Ok(view)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get(&self, key: &[u8]) -> Result<Option<DBVector>, Box<Error>> {
|
pub fn get(&self, key: &[u8]) -> Result<Option<DBVector>, Box<Error>> {
|
||||||
|
Loading…
Reference in New Issue
Block a user