Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add InterestedAllPiecesRequest message #195

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dragonfly-api"
version = "2.0.32"
version = "2.0.33"
authors = ["Gaius <[email protected]>"]
edition = "2021"
license = "Apache-2.0"
Expand Down
323 changes: 207 additions & 116 deletions pkg/apis/dfdaemon/v2/dfdaemon.pb.go

Large diffs are not rendered by default.

194 changes: 194 additions & 0 deletions pkg/apis/dfdaemon/v2/dfdaemon.pb.validate.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion pkg/apis/dfdaemon/v2/dfdaemon.proto
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ message SyncPiecesRequest{
}
}

// InterestedPiecesResponse represents all pieces response of SyncPiecesResponse.
message InterestedAllPiecesResponse {
// All of the pieces in task.
repeated common.v2.Piece pieces = 1 [(validate.rules).repeated = {min_items: 1, ignore_empty: true}];
}

// InterestedPiecesResponse represents interested pieces response of SyncPiecesResponse.
message InterestedPiecesResponse {
// Interested pieces of task.
Expand All @@ -58,7 +64,8 @@ message SyncPiecesResponse {
oneof response {
option (validate.required) = true;

InterestedPiecesResponse interested_pieces_response = 1;
InterestedAllPiecesResponse interested_all_pieces_response = 1;
InterestedPiecesResponse interested_pieces_response = 2;
}
}

Expand Down
9 changes: 8 additions & 1 deletion proto/dfdaemon.proto
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ message SyncPiecesRequest{
}
}

// InterestedPiecesResponse represents all pieces response of SyncPiecesResponse.
message InterestedAllPiecesResponse {
// All of the pieces in task.
repeated common.v2.Piece pieces = 1;
}

// InterestedPiecesResponse represents interested pieces response of SyncPiecesResponse.
message InterestedPiecesResponse {
// Interested pieces of task.
Expand All @@ -51,7 +57,8 @@ message InterestedPiecesResponse {
// SyncPiecesResponse represents response of SyncPieces.
message SyncPiecesResponse {
oneof response {
InterestedPiecesResponse interested_pieces_response = 1;
InterestedAllPiecesResponse interested_all_pieces_response = 1;
InterestedPiecesResponse interested_pieces_response = 2;
}
}

Expand Down
Binary file modified src/descriptor.bin
Binary file not shown.
13 changes: 12 additions & 1 deletion src/dfdaemon.v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ pub mod sync_pieces_request {
InterestedPiecesRequest(super::InterestedPiecesRequest),
}
}
/// InterestedPiecesResponse represents all pieces response of SyncPiecesResponse.
#[derive(serde::Serialize, serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InterestedAllPiecesResponse {
/// All of the pieces in task.
#[prost(message, repeated, tag = "1")]
pub pieces: ::prost::alloc::vec::Vec<super::super::common::v2::Piece>,
}
/// InterestedPiecesResponse represents interested pieces response of SyncPiecesResponse.
#[derive(serde::Serialize, serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
Expand All @@ -49,7 +58,7 @@ pub struct InterestedPiecesResponse {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SyncPiecesResponse {
#[prost(oneof = "sync_pieces_response::Response", tags = "1")]
#[prost(oneof = "sync_pieces_response::Response", tags = "1, 2")]
pub response: ::core::option::Option<sync_pieces_response::Response>,
}
/// Nested message and enum types in `SyncPiecesResponse`.
Expand All @@ -59,6 +68,8 @@ pub mod sync_pieces_response {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Response {
#[prost(message, tag = "1")]
InterestedAllPiecesResponse(super::InterestedAllPiecesResponse),
#[prost(message, tag = "2")]
InterestedPiecesResponse(super::InterestedPiecesResponse),
}
}
Expand Down
Loading