82 lines
2.1 KiB
Rust
82 lines
2.1 KiB
Rust
use meilisearch_types::{
|
||
error::ResponseError,
|
||
milli::update::IndexDocumentsMethod,
|
||
settings::Unchecked,
|
||
tasks::{Details, Status, TaskId},
|
||
};
|
||
use serde::{Deserialize, Serialize};
|
||
use time::OffsetDateTime;
|
||
|
||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||
#[serde(rename_all = "camelCase")]
|
||
pub struct TaskDump {
|
||
pub uid: TaskId,
|
||
#[serde(default)]
|
||
pub index_uid: Option<String>,
|
||
pub status: Status,
|
||
// TODO use our own Kind for the user
|
||
#[serde(rename = "type")]
|
||
pub kind: KindDump,
|
||
|
||
#[serde(skip_serializing_if = "Option::is_none")]
|
||
pub details: Option<Details>,
|
||
#[serde(skip_serializing_if = "Option::is_none")]
|
||
pub error: Option<ResponseError>,
|
||
|
||
#[serde(with = "time::serde::rfc3339")]
|
||
pub enqueued_at: OffsetDateTime,
|
||
#[serde(
|
||
with = "time::serde::rfc3339::option",
|
||
skip_serializing_if = "Option::is_none",
|
||
default
|
||
)]
|
||
pub started_at: Option<OffsetDateTime>,
|
||
#[serde(
|
||
with = "time::serde::rfc3339::option",
|
||
skip_serializing_if = "Option::is_none",
|
||
default
|
||
)]
|
||
pub finished_at: Option<OffsetDateTime>,
|
||
}
|
||
|
||
// A `Kind` specific version made for the dump. If modified you may break the dump.
|
||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||
#[serde(rename_all = "camelCase")]
|
||
pub enum KindDump {
|
||
DocumentImport {
|
||
primary_key: Option<String>,
|
||
method: IndexDocumentsMethod,
|
||
documents_count: u64,
|
||
allow_index_creation: bool,
|
||
},
|
||
DocumentDeletion {
|
||
documents_ids: Vec<String>,
|
||
},
|
||
DocumentClear,
|
||
Settings {
|
||
settings: meilisearch_types::settings::Settings<Unchecked>,
|
||
is_deletion: bool,
|
||
allow_index_creation: bool,
|
||
},
|
||
IndexDeletion,
|
||
IndexCreation {
|
||
primary_key: Option<String>,
|
||
},
|
||
IndexUpdate {
|
||
primary_key: Option<String>,
|
||
},
|
||
IndexSwap {
|
||
lhs: String,
|
||
rhs: String,
|
||
},
|
||
CancelTask {
|
||
tasks: Vec<TaskId>,
|
||
},
|
||
DeleteTasks {
|
||
query: String,
|
||
tasks: Vec<TaskId>,
|
||
},
|
||
DumpExport,
|
||
Snapshot,
|
||
}
|