mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 04:17:10 +02:00
Introduce customs updates
This commit is contained in:
parent
da6ab2753e
commit
02575a2ef6
4 changed files with 62 additions and 5 deletions
26
meilidb-core/src/update/customs_update.rs
Normal file
26
meilidb-core/src/update/customs_update.rs
Normal file
|
@ -0,0 +1,26 @@
|
|||
use crate::{store, error::UnsupportedOperation, MResult};
|
||||
use crate::update::{Update, next_update_id};
|
||||
|
||||
pub fn apply_customs_update(
|
||||
writer: &mut rkv::Writer,
|
||||
main_store: store::Main,
|
||||
customs: &[u8],
|
||||
) -> MResult<()>
|
||||
{
|
||||
main_store.put_customs(writer, customs)
|
||||
}
|
||||
|
||||
pub fn push_customs_update(
|
||||
writer: &mut rkv::Writer,
|
||||
updates_store: store::Updates,
|
||||
updates_results_store: store::UpdatesResults,
|
||||
customs: Vec<u8>,
|
||||
) -> MResult<u64>
|
||||
{
|
||||
let last_update_id = next_update_id(writer, updates_store, updates_results_store)?;
|
||||
|
||||
let update = Update::Customs(customs);
|
||||
updates_store.put_update(writer, last_update_id, &update)?;
|
||||
|
||||
Ok(last_update_id)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue