mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 11:57:07 +02:00
register dump tasks
This commit is contained in:
parent
2f0625a984
commit
7fa3eb1003
3 changed files with 9 additions and 5 deletions
|
@ -8,6 +8,7 @@ use serde_json::json;
|
|||
use crate::analytics::Analytics;
|
||||
use crate::extractors::authentication::{policies::*, GuardedData};
|
||||
use crate::extractors::sequential_extractor::SeqHandler;
|
||||
use crate::task::SummarizedTaskView;
|
||||
|
||||
pub fn configure(cfg: &mut web::ServiceConfig) {
|
||||
cfg.service(web::resource("").route(web::post().to(SeqHandler(create_dump))))
|
||||
|
@ -23,7 +24,7 @@ pub async fn create_dump(
|
|||
) -> Result<HttpResponse, ResponseError> {
|
||||
analytics.publish("Dump Created".to_string(), json!({}), Some(&req));
|
||||
|
||||
let res = meilisearch.create_dump().await?;
|
||||
let res: SummarizedTaskView = meilisearch.register_dump_task().await?.into();
|
||||
|
||||
debug!("returns: {:?}", res);
|
||||
Ok(HttpResponse::Accepted().json(res))
|
||||
|
|
|
@ -24,6 +24,7 @@ enum TaskType {
|
|||
DocumentDeletion,
|
||||
SettingsUpdate,
|
||||
ClearAll,
|
||||
Dump,
|
||||
}
|
||||
|
||||
impl From<TaskContent> for TaskType {
|
||||
|
@ -43,6 +44,7 @@ impl From<TaskContent> for TaskType {
|
|||
TaskContent::IndexDeletion => TaskType::IndexDeletion,
|
||||
TaskContent::IndexCreation { .. } => TaskType::IndexCreation,
|
||||
TaskContent::IndexUpdate { .. } => TaskType::IndexUpdate,
|
||||
TaskContent::Dump { path } => TaskType::Dump,
|
||||
_ => unreachable!("unexpected task type"),
|
||||
}
|
||||
}
|
||||
|
@ -216,7 +218,7 @@ impl From<Task> for TaskView {
|
|||
TaskType::IndexUpdate,
|
||||
Some(TaskDetails::IndexInfo { primary_key }),
|
||||
),
|
||||
TaskContent::Dump { path: _ } => todo!(),
|
||||
TaskContent::Dump { path: _ } => (TaskType::Dump, None),
|
||||
};
|
||||
|
||||
// An event always has at least one event: "Created"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue