Support a basic update callback system

This commit is contained in:
Clément Renault 2019-10-09 11:45:19 +02:00
parent 2a4707d51e
commit 5f3072e67e
No known key found for this signature in database
GPG key ID: 92ADA4E935E71FA4
7 changed files with 66 additions and 27 deletions

View file

@ -98,7 +98,7 @@ pub fn next_update_id(
pub fn update_task(
writer: &mut rkv::Writer,
index: store::Index,
mut callback: Option<impl FnOnce(UpdateResult)>,
mut callback: Option<impl Fn(UpdateResult)>,
) -> MResult<bool>
{
let (update_id, update) = match index.updates.pop_front(writer)? {
@ -111,6 +111,7 @@ pub fn update_task(
let (update_type, result, duration) = match update {
Update::SchemaUpdate(schema) => {
let start = Instant::now();
let update_type = UpdateType::SchemaUpdate { schema: schema.clone() };
let result = apply_schema_update(writer, index.main, &schema);