diff --git a/Cargo.toml b/Cargo.toml index 184b839..a80b1e2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dragonfly-api" -version = "2.0.30" +version = "2.0.31" authors = ["Gaius "] edition = "2021" license = "Apache-2.0" @@ -15,6 +15,8 @@ tonic = "0.9.2" prost = "0.11.9" prost-types = "0.11.9" tokio = { version = "1.29.1", features = ["rt-multi-thread", "macros"] } +serde = { version = "1.0", features = ["derive"] } +prost-wkt-types = "0.4" [build-dependencies] tonic-build = "0.9.2" diff --git a/build.rs b/build.rs index a9d07b1..bdd4f6c 100644 --- a/build.rs +++ b/build.rs @@ -2,6 +2,9 @@ fn main() -> Result<(), Box> { tonic_build::configure() .file_descriptor_set_path("src/descriptor.bin") .protoc_arg("--experimental_allow_proto3_optional") + .type_attribute(".", "#[derive(serde::Serialize, serde::Deserialize)]") + .extern_path(".google.protobuf.Timestamp", "::prost_wkt_types::Timestamp") + .extern_path(".google.protobuf.Duration", "::prost_wkt_types::Duration") .out_dir("src") .compile( &[ diff --git a/src/common.v2.rs b/src/common.v2.rs index 7bd3f56..cb593a1 100644 --- a/src/common.v2.rs +++ b/src/common.v2.rs @@ -1,4 +1,5 @@ /// Peer metadata. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Peer { @@ -16,7 +17,7 @@ pub struct Peer { pub pieces: ::prost::alloc::vec::Vec, /// Peer downloads costs time. #[prost(message, optional, tag = "5")] - pub cost: ::core::option::Option<::prost_types::Duration>, + pub cost: ::core::option::Option<::prost_wkt_types::Duration>, /// Peer state. #[prost(string, tag = "6")] pub state: ::prost::alloc::string::String, @@ -31,12 +32,13 @@ pub struct Peer { pub need_back_to_source: bool, /// Peer create time. #[prost(message, optional, tag = "10")] - pub created_at: ::core::option::Option<::prost_types::Timestamp>, + pub created_at: ::core::option::Option<::prost_wkt_types::Timestamp>, /// Peer update time. #[prost(message, optional, tag = "11")] - pub updated_at: ::core::option::Option<::prost_types::Timestamp>, + pub updated_at: ::core::option::Option<::prost_wkt_types::Timestamp>, } /// Task metadata. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Task { @@ -93,12 +95,13 @@ pub struct Task { pub has_available_peer: bool, /// Task create time. #[prost(message, optional, tag = "17")] - pub created_at: ::core::option::Option<::prost_types::Timestamp>, + pub created_at: ::core::option::Option<::prost_wkt_types::Timestamp>, /// Task update time. #[prost(message, optional, tag = "18")] - pub updated_at: ::core::option::Option<::prost_types::Timestamp>, + pub updated_at: ::core::option::Option<::prost_wkt_types::Timestamp>, } /// Host metadata. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Host { @@ -158,6 +161,7 @@ pub struct Host { pub object_storage_port: i32, } /// CPU Stat. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Cpu { @@ -179,6 +183,7 @@ pub struct Cpu { } /// CPUTimes contains the amounts of time the CPU has spent performing different /// kinds of work. Time units are in seconds. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct CpuTimes { @@ -214,6 +219,7 @@ pub struct CpuTimes { pub guest_nice: f64, } /// Memory Stat. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Memory { @@ -237,6 +243,7 @@ pub struct Memory { pub free: u64, } /// Network Stat. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Network { @@ -254,6 +261,7 @@ pub struct Network { pub idc: ::core::option::Option<::prost::alloc::string::String>, } /// Disk Stat. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Disk { @@ -283,6 +291,7 @@ pub struct Disk { pub inodes_used_percent: f64, } /// Build information. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Build { @@ -303,6 +312,7 @@ pub struct Build { pub platform: ::core::option::Option<::prost::alloc::string::String>, } /// Download information. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Download { @@ -344,7 +354,7 @@ pub struct Download { pub output_path: ::prost::alloc::string::String, /// Download timeout. #[prost(message, optional, tag = "12")] - pub timeout: ::core::option::Option<::prost_types::Duration>, + pub timeout: ::core::option::Option<::prost_wkt_types::Duration>, /// Download rate limit in bytes per second. #[prost(double, optional, tag = "13")] pub download_rate_limit: ::core::option::Option, @@ -353,6 +363,7 @@ pub struct Download { pub need_back_to_source: bool, } /// Range represents download range. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Range { @@ -364,6 +375,7 @@ pub struct Range { pub length: i64, } /// Piece represents information of piece. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Piece { @@ -390,12 +402,13 @@ pub struct Piece { pub traffic_type: i32, /// Downloading piece costs time. #[prost(message, optional, tag = "8")] - pub cost: ::core::option::Option<::prost_types::Duration>, + pub cost: ::core::option::Option<::prost_wkt_types::Duration>, /// Piece create time. #[prost(message, optional, tag = "9")] - pub created_at: ::core::option::Option<::prost_types::Timestamp>, + pub created_at: ::core::option::Option<::prost_wkt_types::Timestamp>, } /// SizeScope represents size scope of task. +#[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum SizeScope { @@ -433,6 +446,7 @@ impl SizeScope { } } /// TaskType represents type of task. +#[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum TaskType { @@ -470,6 +484,7 @@ impl TaskType { } } /// TrafficType represents type of traffic. +#[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum TrafficType { @@ -503,6 +518,7 @@ impl TrafficType { } } /// Priority represents priority of application. +#[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum Priority { diff --git a/src/dfdaemon.v2.rs b/src/dfdaemon.v2.rs index e83b940..4fc31f3 100644 --- a/src/dfdaemon.v2.rs +++ b/src/dfdaemon.v2.rs @@ -1,8 +1,10 @@ /// InterestedAllPiecesRequest represents interested all pieces request of SyncPiecesRequest. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct InterestedAllPiecesRequest {} /// InterestedPiecesRequest represents interested pieces request of SyncPiecesRequest. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct InterestedPiecesRequest { @@ -11,6 +13,7 @@ pub struct InterestedPiecesRequest { pub piece_numbers: ::prost::alloc::vec::Vec, } /// SyncPiecesRequest represents request of AnnouncePeer. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SyncPiecesRequest { @@ -22,6 +25,7 @@ pub struct SyncPiecesRequest { } /// Nested message and enum types in `SyncPiecesRequest`. pub mod sync_pieces_request { + #[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Request { @@ -32,6 +36,7 @@ pub mod sync_pieces_request { } } /// InterestedPiecesResponse represents interested pieces response of SyncPiecesResponse. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct InterestedPiecesResponse { @@ -40,6 +45,7 @@ pub struct InterestedPiecesResponse { pub pieces: ::prost::alloc::vec::Vec, } /// SyncPiecesResponse represents response of SyncPieces. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SyncPiecesResponse { @@ -48,6 +54,7 @@ pub struct SyncPiecesResponse { } /// Nested message and enum types in `SyncPiecesResponse`. pub mod sync_pieces_response { + #[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Response { @@ -56,6 +63,7 @@ pub mod sync_pieces_response { } } /// DownloadTaskRequest represents request of DownloadTask. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DownloadTaskRequest { @@ -64,6 +72,7 @@ pub struct DownloadTaskRequest { pub download: ::core::option::Option, } /// UploadTaskRequest represents request of UploadTask. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct UploadTaskRequest { @@ -72,6 +81,7 @@ pub struct UploadTaskRequest { pub task: ::core::option::Option, } /// StatTaskRequest represents request of StatTask. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct StatTaskRequest { @@ -80,6 +90,7 @@ pub struct StatTaskRequest { pub task_id: ::prost::alloc::string::String, } /// StatTaskResponse represents response of StatTask. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct StatTaskResponse { @@ -115,12 +126,13 @@ pub struct StatTaskResponse { pub piece_length: i32, /// Task create time. #[prost(message, optional, tag = "10")] - pub created_at: ::core::option::Option<::prost_types::Timestamp>, + pub created_at: ::core::option::Option<::prost_wkt_types::Timestamp>, /// Task update time. #[prost(message, optional, tag = "11")] - pub updated_at: ::core::option::Option<::prost_types::Timestamp>, + pub updated_at: ::core::option::Option<::prost_wkt_types::Timestamp>, } /// DeleteTaskRequest represents request of DeleteTask. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DeleteTaskRequest { diff --git a/src/manager.v2.rs b/src/manager.v2.rs index 7c8a02d..a3a8e58 100644 --- a/src/manager.v2.rs +++ b/src/manager.v2.rs @@ -1,4 +1,5 @@ /// SeedPeerCluster represents cluster of seed peer. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SeedPeerCluster { @@ -16,6 +17,7 @@ pub struct SeedPeerCluster { pub config: ::prost::alloc::vec::Vec, } /// SeedPeer represents seed peer for network. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SeedPeer { @@ -60,6 +62,7 @@ pub struct SeedPeer { pub object_storage_port: i32, } /// GetSeedPeerRequest represents request of GetSeedPeer. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetSeedPeerRequest { @@ -77,6 +80,7 @@ pub struct GetSeedPeerRequest { pub ip: ::prost::alloc::string::String, } /// UpdateSeedPeerRequest represents request of UpdateSeedPeer. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct UpdateSeedPeerRequest { @@ -112,6 +116,7 @@ pub struct UpdateSeedPeerRequest { pub object_storage_port: i32, } /// DeleteSeedPeerRequest represents request of DeleteSeedPeer. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DeleteSeedPeerRequest { @@ -129,6 +134,7 @@ pub struct DeleteSeedPeerRequest { pub ip: ::prost::alloc::string::String, } /// SeedPeerCluster represents cluster of scheduler. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SchedulerCluster { @@ -152,6 +158,7 @@ pub struct SchedulerCluster { pub scopes: ::prost::alloc::vec::Vec, } /// SeedPeerCluster represents scheduler for network. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Scheduler { @@ -190,6 +197,7 @@ pub struct Scheduler { pub features: ::prost::alloc::vec::Vec, } /// GetSchedulerRequest represents request of GetScheduler. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetSchedulerRequest { @@ -207,6 +215,7 @@ pub struct GetSchedulerRequest { pub ip: ::prost::alloc::string::String, } /// UpdateSchedulerRequest represents request of UpdateScheduler. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct UpdateSchedulerRequest { @@ -233,6 +242,7 @@ pub struct UpdateSchedulerRequest { pub port: i32, } /// ListSchedulersRequest represents request of ListSchedulers. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListSchedulersRequest { @@ -259,6 +269,7 @@ pub struct ListSchedulersRequest { pub commit: ::prost::alloc::string::String, } /// ListSchedulersResponse represents response of ListSchedulers. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListSchedulersResponse { @@ -267,6 +278,7 @@ pub struct ListSchedulersResponse { pub schedulers: ::prost::alloc::vec::Vec, } /// ObjectStorage represents config of object storage. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ObjectStorage { @@ -298,6 +310,7 @@ pub struct ObjectStorage { pub scheme: ::prost::alloc::string::String, } /// GetObjectStorageRequest represents request of GetObjectStorage. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetObjectStorageRequest { @@ -312,6 +325,7 @@ pub struct GetObjectStorageRequest { pub ip: ::prost::alloc::string::String, } /// Bucket represents config of bucket. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Bucket { @@ -320,6 +334,7 @@ pub struct Bucket { pub name: ::prost::alloc::string::String, } /// ListSchedulersRequest represents request of ListBuckets. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListBucketsRequest { @@ -334,6 +349,7 @@ pub struct ListBucketsRequest { pub ip: ::prost::alloc::string::String, } /// ListBucketsResponse represents response of ListBuckets. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListBucketsResponse { @@ -342,6 +358,7 @@ pub struct ListBucketsResponse { pub buckets: ::prost::alloc::vec::Vec, } /// URLPriority represents config of url priority. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct UrlPriority { @@ -353,6 +370,7 @@ pub struct UrlPriority { pub value: i32, } /// ApplicationPriority represents config of application priority. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ApplicationPriority { @@ -364,6 +382,7 @@ pub struct ApplicationPriority { pub urls: ::prost::alloc::vec::Vec, } /// Application represents config of application. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Application { @@ -384,6 +403,7 @@ pub struct Application { pub priority: ::core::option::Option, } /// ListApplicationsRequest represents request of ListApplications. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListApplicationsRequest { @@ -398,6 +418,7 @@ pub struct ListApplicationsRequest { pub ip: ::prost::alloc::string::String, } /// ListApplicationsResponse represents response of ListApplications. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListApplicationsResponse { @@ -406,6 +427,7 @@ pub struct ListApplicationsResponse { pub applications: ::prost::alloc::vec::Vec, } /// CreateGNNRequest represents to create GNN model request of TrainRequest. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct CreateGnnRequest { @@ -423,6 +445,7 @@ pub struct CreateGnnRequest { pub f1_score: f64, } /// CreateMLPRequest represents to create MLP model request of TrainRequest. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct CreateMlpRequest { @@ -437,6 +460,7 @@ pub struct CreateMlpRequest { pub mae: f64, } /// CreateModelRequest represents request of CreateModel. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct CreateModelRequest { @@ -451,6 +475,7 @@ pub struct CreateModelRequest { } /// Nested message and enum types in `CreateModelRequest`. pub mod create_model_request { + #[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Request { @@ -461,6 +486,7 @@ pub mod create_model_request { } } /// KeepAliveRequest represents request of KeepAlive. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct KeepAliveRequest { @@ -478,6 +504,7 @@ pub struct KeepAliveRequest { pub ip: ::prost::alloc::string::String, } /// Request source type. +#[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum SourceType { diff --git a/src/scheduler.v2.rs b/src/scheduler.v2.rs index 686bf0d..6854d99 100644 --- a/src/scheduler.v2.rs +++ b/src/scheduler.v2.rs @@ -1,4 +1,5 @@ /// RegisterPeerRequest represents peer registered request of AnnouncePeerRequest. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct RegisterPeerRequest { @@ -7,6 +8,7 @@ pub struct RegisterPeerRequest { pub download: ::core::option::Option, } /// RegisterSeedPeerRequest represents seed peer registered request of AnnouncePeerRequest. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct RegisterSeedPeerRequest { @@ -15,10 +17,12 @@ pub struct RegisterSeedPeerRequest { pub download: ::core::option::Option, } /// DownloadPeerStartedRequest represents peer download started request of AnnouncePeerRequest. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DownloadPeerStartedRequest {} /// DownloadPeerBackToSourceStartedRequest represents peer download back-to-source started request of AnnouncePeerRequest. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DownloadPeerBackToSourceStartedRequest { @@ -27,6 +31,7 @@ pub struct DownloadPeerBackToSourceStartedRequest { pub description: ::prost::alloc::string::String, } /// DownloadPeerFinishedRequest represents peer download finished request of AnnouncePeerRequest. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DownloadPeerFinishedRequest { @@ -38,6 +43,7 @@ pub struct DownloadPeerFinishedRequest { pub piece_count: i32, } /// DownloadPeerBackToSourceFinishedRequest represents peer download back-to-source finished request of AnnouncePeerRequest. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DownloadPeerBackToSourceFinishedRequest { @@ -49,6 +55,7 @@ pub struct DownloadPeerBackToSourceFinishedRequest { pub piece_count: i32, } /// DownloadPeerFailedRequest represents peer download failed request of AnnouncePeerRequest. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DownloadPeerFailedRequest { @@ -57,6 +64,7 @@ pub struct DownloadPeerFailedRequest { pub description: ::prost::alloc::string::String, } /// DownloadPeerBackToSourceFailedRequest represents peer download back-to-source failed request of AnnouncePeerRequest. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DownloadPeerBackToSourceFailedRequest { @@ -65,6 +73,7 @@ pub struct DownloadPeerBackToSourceFailedRequest { pub description: ::prost::alloc::string::String, } /// DownloadPieceFinishedRequest represents piece download finished request of AnnouncePeerRequest. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DownloadPieceFinishedRequest { @@ -73,6 +82,7 @@ pub struct DownloadPieceFinishedRequest { pub piece: ::core::option::Option, } /// DownloadPieceBackToSourceFinishedRequest represents piece download back-to-source finished request of AnnouncePeerRequest. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DownloadPieceBackToSourceFinishedRequest { @@ -81,6 +91,7 @@ pub struct DownloadPieceBackToSourceFinishedRequest { pub piece: ::core::option::Option, } /// DownloadPieceFailedRequest downloads piece failed request of AnnouncePeerRequest. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DownloadPieceFailedRequest { @@ -92,6 +103,7 @@ pub struct DownloadPieceFailedRequest { pub temporary: bool, } /// HTTPResponse represents http protocol response of DownloadPieceBackToSourceFailedRequest. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct HttpResponse { @@ -109,18 +121,22 @@ pub struct HttpResponse { pub status: ::prost::alloc::string::String, } /// HDFSResponse represents hdfs protocol response of DownloadPieceBackToSourceFailedRequest. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct HdfsResponse {} /// S3Response represents s3 protocol response of DownloadPieceBackToSourceFailedRequest. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct S3Response {} /// OSSResponse represents oss protocol response of DownloadPieceBackToSourceFailedRequest. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct OssResponse {} /// DownloadPieceBackToSourceFailedRequest downloads piece back-to-source failed request of AnnouncePeerRequest. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DownloadPieceBackToSourceFailedRequest { @@ -137,6 +153,7 @@ pub struct DownloadPieceBackToSourceFailedRequest { } /// Nested message and enum types in `DownloadPieceBackToSourceFailedRequest`. pub mod download_piece_back_to_source_failed_request { + #[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Response { @@ -151,6 +168,7 @@ pub mod download_piece_back_to_source_failed_request { } } /// SyncPiecesFailedRequest syncs pieces failed request of AnnouncePeerRequest. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SyncPiecesFailedRequest { @@ -162,6 +180,7 @@ pub struct SyncPiecesFailedRequest { pub description: ::prost::alloc::string::String, } /// AnnouncePeerRequest represents request of AnnouncePeer. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct AnnouncePeerRequest { @@ -182,6 +201,7 @@ pub struct AnnouncePeerRequest { } /// Nested message and enum types in `AnnouncePeerRequest`. pub mod announce_peer_request { + #[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Request { @@ -224,10 +244,12 @@ pub mod announce_peer_request { } } /// EmptyTaskResponse represents empty task response of AnnouncePeerResponse. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct EmptyTaskResponse {} /// TinyTaskResponse represents tiny task response of AnnouncePeerResponse. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct TinyTaskResponse { @@ -243,10 +265,12 @@ pub struct TinyTaskResponse { /// /// Candidate parent. /// common.Peer candidate_parent = 1; +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SmallTaskResponse {} /// NormalTaskResponse represents normal task response of AnnouncePeerResponse. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct NormalTaskResponse { @@ -258,6 +282,7 @@ pub struct NormalTaskResponse { pub concurrent_piece_count: i32, } /// NeedBackToSourceResponse represents need back-to-source response of AnnouncePeerResponse. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct NeedBackToSourceResponse { @@ -266,6 +291,7 @@ pub struct NeedBackToSourceResponse { pub description: ::prost::alloc::string::String, } /// AnnouncePeerResponse represents response of AnnouncePeer. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct AnnouncePeerResponse { @@ -274,6 +300,7 @@ pub struct AnnouncePeerResponse { } /// Nested message and enum types in `AnnouncePeerResponse`. pub mod announce_peer_response { + #[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Response { @@ -290,6 +317,7 @@ pub mod announce_peer_response { } } /// StatPeerRequest represents request of StatPeer. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct StatPeerRequest { @@ -305,6 +333,7 @@ pub struct StatPeerRequest { } /// TODO exchange peer request definition. /// ExchangePeerRequest represents request of ExchangePeer. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ExchangePeerRequest { @@ -320,10 +349,12 @@ pub struct ExchangePeerRequest { } /// TODO exchange peer response definition. /// ExchangePeerResponse represents response of ExchangePeer. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ExchangePeerResponse {} /// LeavePeerRequest represents request of LeavePeer. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct LeavePeerRequest { @@ -338,6 +369,7 @@ pub struct LeavePeerRequest { pub peer_id: ::prost::alloc::string::String, } /// StatTaskRequest represents request of StatTask. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct StatTaskRequest { @@ -346,6 +378,7 @@ pub struct StatTaskRequest { pub id: ::prost::alloc::string::String, } /// AnnounceHostRequest represents request of AnnounceHost. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct AnnounceHostRequest { @@ -354,6 +387,7 @@ pub struct AnnounceHostRequest { pub host: ::core::option::Option, } /// LeaveHostRequest represents request of LeaveHost. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct LeaveHostRequest { @@ -362,10 +396,12 @@ pub struct LeaveHostRequest { pub id: ::prost::alloc::string::String, } /// ProbeStartedRequest represents started request of SyncProbesRequest. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ProbeStartedRequest {} /// Probe information. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Probe { @@ -374,12 +410,13 @@ pub struct Probe { pub host: ::core::option::Option, /// RTT is the round-trip time sent via this pinger. #[prost(message, optional, tag = "2")] - pub rtt: ::core::option::Option<::prost_types::Duration>, + pub rtt: ::core::option::Option<::prost_wkt_types::Duration>, /// Probe create time. #[prost(message, optional, tag = "3")] - pub created_at: ::core::option::Option<::prost_types::Timestamp>, + pub created_at: ::core::option::Option<::prost_wkt_types::Timestamp>, } /// ProbeFinishedRequest represents finished request of SyncProbesRequest. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ProbeFinishedRequest { @@ -388,6 +425,7 @@ pub struct ProbeFinishedRequest { pub probes: ::prost::alloc::vec::Vec, } /// FailedProbe information. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct FailedProbe { @@ -399,6 +437,7 @@ pub struct FailedProbe { pub description: ::prost::alloc::string::String, } /// ProbeFailedRequest represents failed request of SyncProbesRequest. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ProbeFailedRequest { @@ -407,6 +446,7 @@ pub struct ProbeFailedRequest { pub probes: ::prost::alloc::vec::Vec, } /// SyncProbesRequest represents request of SyncProbes. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SyncProbesRequest { @@ -418,6 +458,7 @@ pub struct SyncProbesRequest { } /// Nested message and enum types in `SyncProbesRequest`. pub mod sync_probes_request { + #[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Request { @@ -430,6 +471,7 @@ pub mod sync_probes_request { } } /// SyncProbesResponse represents response of SyncProbes. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SyncProbesResponse { diff --git a/src/security.rs b/src/security.rs index f999fc8..8b03357 100644 --- a/src/security.rs +++ b/src/security.rs @@ -2,6 +2,7 @@ /// Dragonfly supports peers authentication with Mutual TLS(mTLS) /// For mTLS, all peers need to request TLS certificates for communicating /// The server side may overwrite ant requested certificate filed based on its policies. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct CertificateRequest { @@ -12,9 +13,10 @@ pub struct CertificateRequest { pub csr: ::prost::alloc::vec::Vec, /// Optional: requested certificate validity period. #[prost(message, optional, tag = "2")] - pub validity_period: ::core::option::Option<::prost_types::Duration>, + pub validity_period: ::core::option::Option<::prost_wkt_types::Duration>, } /// Certificate response type. +#[derive(serde::Serialize, serde::Deserialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct CertificateResponse {