From 89cdf6bf323e43a9d070bd22acff0ecab94f27f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=82=8E=E6=B3=BC?= Date: Wed, 20 Mar 2024 17:11:10 +0800 Subject: [PATCH] refactor: remove innecessary serde (#15042) --- src/meta/app/src/background/background_job.rs | 52 ++++++------------- .../app/src/background/background_task.rs | 12 ++--- src/query/config/src/background_config.rs | 4 +- 3 files changed, 25 insertions(+), 43 deletions(-) diff --git a/src/meta/app/src/background/background_job.rs b/src/meta/app/src/background/background_job.rs index 4ec8188e029c..313363b821b5 100644 --- a/src/meta/app/src/background/background_job.rs +++ b/src/meta/app/src/background/background_job.rs @@ -24,16 +24,7 @@ use cron::Schedule; use crate::background::BackgroundTaskType; use crate::principal::UserIdentity; -#[derive( - serde::Serialize, - serde::Deserialize, - Clone, - Debug, - Default, - Eq, - PartialEq, - num_derive::FromPrimitive, -)] +#[derive(Clone, Debug, Default, Eq, PartialEq, num_derive::FromPrimitive)] pub enum BackgroundJobState { #[default] RUNNING = 0, @@ -47,16 +38,7 @@ impl Display for BackgroundJobState { } } -#[derive( - serde::Serialize, - serde::Deserialize, - Clone, - Debug, - Default, - Eq, - PartialEq, - num_derive::FromPrimitive, -)] +#[derive(Clone, Debug, Default, Eq, PartialEq, num_derive::FromPrimitive)] pub enum BackgroundJobType { #[default] ONESHOT = 0, @@ -87,7 +69,7 @@ impl ManualTriggerParams { } } -#[derive(serde::Serialize, serde::Deserialize, Clone, Debug, Default, Eq, PartialEq)] +#[derive(Clone, Debug, Default, Eq, PartialEq)] pub struct BackgroundJobParams { pub job_type: BackgroundJobType, pub scheduled_job_interval: std::time::Duration, @@ -159,7 +141,7 @@ impl Display for BackgroundJobParams { } } -#[derive(serde::Serialize, serde::Deserialize, Clone, Debug, Default, Eq, PartialEq)] +#[derive(Clone, Debug, Default, Eq, PartialEq)] pub struct BackgroundJobStatus { pub job_state: BackgroundJobState, pub last_task_id: Option, @@ -216,7 +198,7 @@ impl Display for BackgroundJobIdent { } // Info -#[derive(serde::Serialize, serde::Deserialize, Clone, Debug, Default, Eq, PartialEq)] +#[derive(Clone, Debug, Default, Eq, PartialEq)] pub struct BackgroundJobInfo { pub job_params: Option, pub job_status: Option, @@ -244,12 +226,12 @@ impl BackgroundJobInfo { } } -#[derive(serde::Serialize, serde::Deserialize, Clone, Debug, Default, Eq, PartialEq)] +#[derive(Clone, Debug, Default, Eq, PartialEq)] pub struct BackgroundJobId { pub id: u64, } -#[derive(serde::Serialize, serde::Deserialize, Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct CreateBackgroundJobReq { pub if_not_exists: bool, pub job_name: BackgroundJobIdent, @@ -271,12 +253,12 @@ impl Display for CreateBackgroundJobReq { } } -#[derive(serde::Serialize, serde::Deserialize, Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct CreateBackgroundJobReply { pub id: u64, } -#[derive(serde::Serialize, serde::Deserialize, Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct GetBackgroundJobReq { pub name: BackgroundJobIdent, } @@ -287,13 +269,13 @@ impl Display for GetBackgroundJobReq { } } -#[derive(serde::Serialize, serde::Deserialize, Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct GetBackgroundJobReply { pub id: u64, pub info: BackgroundJobInfo, } -#[derive(serde::Serialize, serde::Deserialize, Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct UpdateBackgroundJobStatusReq { pub job_name: BackgroundJobIdent, pub status: BackgroundJobStatus, @@ -309,7 +291,7 @@ impl Display for UpdateBackgroundJobStatusReq { } } -#[derive(serde::Serialize, serde::Deserialize, Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct UpdateBackgroundJobParamsReq { pub job_name: BackgroundJobIdent, pub params: BackgroundJobParams, @@ -325,7 +307,7 @@ impl Display for UpdateBackgroundJobParamsReq { } } -#[derive(serde::Serialize, serde::Deserialize, Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct UpdateBackgroundJobReq { pub job_name: BackgroundJobIdent, pub info: BackgroundJobInfo, @@ -347,12 +329,12 @@ impl Display for UpdateBackgroundJobReq { } } -#[derive(serde::Serialize, serde::Deserialize, Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct UpdateBackgroundJobReply { pub id: u64, } -#[derive(serde::Serialize, serde::Deserialize, Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct DeleteBackgroundJobReq { pub name: BackgroundJobIdent, } @@ -363,10 +345,10 @@ impl Display for DeleteBackgroundJobReq { } } -#[derive(serde::Serialize, serde::Deserialize, Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct DeleteBackgroundJobReply {} // list -#[derive(serde::Serialize, serde::Deserialize, Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct ListBackgroundJobsReq { pub tenant: String, } diff --git a/src/meta/app/src/background/background_task.rs b/src/meta/app/src/background/background_task.rs index 5ba0229b0361..cd3bcdd81b87 100644 --- a/src/meta/app/src/background/background_task.rs +++ b/src/meta/app/src/background/background_task.rs @@ -70,7 +70,7 @@ impl Display for BackgroundTaskType { } } -#[derive(serde::Serialize, serde::Deserialize, Clone, Debug, Default, Eq, PartialEq)] +#[derive(Clone, Debug, Default, Eq, PartialEq)] pub struct BackgroundTaskIdent { pub tenant: String, pub task_id: String, @@ -153,7 +153,7 @@ impl BackgroundTaskInfo { } } -#[derive(serde::Serialize, serde::Deserialize, Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct UpdateBackgroundTaskReq { pub task_name: BackgroundTaskIdent, pub task_info: BackgroundTaskInfo, @@ -174,13 +174,13 @@ impl Display for UpdateBackgroundTaskReq { } } -#[derive(serde::Serialize, serde::Deserialize, Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct UpdateBackgroundTaskReply { pub last_updated: DateTime, pub expire_at: u64, } -#[derive(serde::Serialize, serde::Deserialize, Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct GetBackgroundTaskReq { pub name: BackgroundTaskIdent, } @@ -191,12 +191,12 @@ impl Display for GetBackgroundTaskReq { } } -#[derive(serde::Serialize, serde::Deserialize, Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct GetBackgroundTaskReply { pub task_info: Option, } -#[derive(serde::Serialize, serde::Deserialize, Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct ListBackgroundTasksReq { pub tenant: String, } diff --git a/src/query/config/src/background_config.rs b/src/query/config/src/background_config.rs index f6ae6f3fb067..a4342016f083 100644 --- a/src/query/config/src/background_config.rs +++ b/src/query/config/src/background_config.rs @@ -102,13 +102,13 @@ impl BackgroundScheduledConfig { } /// Config for background config -#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Clone, PartialEq, Eq)] pub struct InnerBackgroundConfig { pub enable: bool, pub compaction: InnerBackgroundCompactionConfig, } -#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Clone, PartialEq, Eq)] pub struct InnerBackgroundCompactionConfig { pub enable: bool, pub target_tables: Option>,