mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-28 01:01:00 +00:00
architecture rework
This commit is contained in:
@ -1,15 +1,12 @@
|
||||
use std::ops::Deref;
|
||||
|
||||
use milli::update::{IndexDocumentsMethod, UpdateFormat};
|
||||
//use milli::update_store::UpdateStatus;
|
||||
use async_compression::tokio_02::write::GzipEncoder;
|
||||
use futures_util::stream::StreamExt;
|
||||
use tokio::io::AsyncWriteExt;
|
||||
|
||||
use super::Data;
|
||||
use crate::index_controller::IndexController;
|
||||
use crate::index_controller::{UpdateStatusResponse, Settings};
|
||||
|
||||
use crate::index_controller::{IndexController, UpdateStatusResponse, Settings};
|
||||
|
||||
impl Data {
|
||||
pub async fn add_documents<B, E, S>(
|
||||
@ -39,8 +36,8 @@ impl Data {
|
||||
let file = file.into_std().await;
|
||||
let mmap = unsafe { memmap::Mmap::map(&file)? };
|
||||
|
||||
let indexes = self.indexes.clone();
|
||||
let update = tokio::task::spawn_blocking(move ||indexes.add_documents(index, method, format, &mmap[..])).await??;
|
||||
let index_controller = self.index_controller.clone();
|
||||
let update = tokio::task::spawn_blocking(move ||index_controller.add_documents(index, method, format, &mmap[..])).await??;
|
||||
Ok(update.into())
|
||||
}
|
||||
|
||||
@ -49,7 +46,7 @@ impl Data {
|
||||
index: S,
|
||||
settings: Settings
|
||||
) -> anyhow::Result<UpdateStatusResponse> {
|
||||
let indexes = self.indexes.clone();
|
||||
let indexes = self.index_controller.clone();
|
||||
let update = tokio::task::spawn_blocking(move || indexes.update_settings(index, settings)).await??;
|
||||
Ok(update.into())
|
||||
}
|
||||
|
Reference in New Issue
Block a user