Skip to content

Commit

Permalink
feat: add resource ids to DownloadTaskResponse (#236)
Browse files Browse the repository at this point in the history
Signed-off-by: Gaius <[email protected]>
  • Loading branch information
gaius-qi authored Dec 19, 2023
1 parent 2292870 commit a5e7794
Show file tree
Hide file tree
Showing 7 changed files with 152 additions and 71 deletions.
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.67"
version = "2.0.68"
authors = ["Gaius <[email protected]>"]
edition = "2021"
license = "Apache-2.0"
Expand Down
149 changes: 91 additions & 58 deletions pkg/apis/dfdaemon/v2/dfdaemon.pb.go

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

33 changes: 33 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.

13 changes: 8 additions & 5 deletions pkg/apis/dfdaemon/v2/dfdaemon.proto
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ message TriggerDownloadTaskResponse {
message SyncPiecesRequest {
// Task id.
string task_id = 1 [(validate.rules).string.min_len = 1];

// Interested piece numbers.
repeated uint32 interested_piece_numbers = 2 [(validate.rules).repeated = {min_items: 1}];
}
Expand All @@ -59,7 +58,6 @@ message SyncPiecesResponse {
message DownloadPieceRequest{
// Task id.
string task_id = 1 [(validate.rules).string.min_len = 1];

// Piece number.
uint32 piece_number = 2;
}
Expand Down Expand Up @@ -90,11 +88,16 @@ message DownloadTaskRequest {

// DownloadTaskResponse represents response of DownloadTask.
message DownloadTaskResponse {
// Host id.
string host_id = 1 [(validate.rules).string.min_len = 1];
// Task id.
string task_id = 2 [(validate.rules).string.min_len = 1];
// Peer id.
string peer_id = 3 [(validate.rules).string.min_len = 1];
// Task content length.
uint64 content_length = 1;

uint64 content_length = 4;
// Finished piece of task.
common.v2.Piece piece = 2 [(validate.rules).message.required = true];
common.v2.Piece piece = 5 [(validate.rules).message.required = true];
}

// UploadTaskRequest represents request of UploadTask.
Expand Down
13 changes: 8 additions & 5 deletions proto/dfdaemon.proto
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ message TriggerDownloadTaskResponse {
message SyncPiecesRequest {
// Task id.
string task_id = 1;

// Interested piece numbers.
repeated uint32 interested_piece_numbers = 2;
}
Expand All @@ -56,7 +55,6 @@ message SyncPiecesResponse {
message DownloadPieceRequest{
// Task id.
string task_id = 1;

// Piece number.
uint32 piece_number = 2;
}
Expand Down Expand Up @@ -87,11 +85,16 @@ message DownloadTaskRequest {

// DownloadTaskResponse represents response of DownloadTask.
message DownloadTaskResponse {
// Host id.
string host_id = 1;
// Task id.
string task_id = 2;
// Peer id.
string peer_id = 3;
// Task content length.
uint64 content_length = 1;

uint64 content_length = 4;
// Finished piece of task.
common.v2.Piece piece = 2;
common.v2.Piece piece = 5;
}

// UploadTaskRequest represents request of UploadTask.
Expand Down
Binary file modified src/descriptor.bin
Binary file not shown.
13 changes: 11 additions & 2 deletions src/dfdaemon.v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,20 @@ pub struct DownloadTaskRequest {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DownloadTaskResponse {
/// Host id.
#[prost(string, tag = "1")]
pub host_id: ::prost::alloc::string::String,
/// Task id.
#[prost(string, tag = "2")]
pub task_id: ::prost::alloc::string::String,
/// Peer id.
#[prost(string, tag = "3")]
pub peer_id: ::prost::alloc::string::String,
/// Task content length.
#[prost(uint64, tag = "1")]
#[prost(uint64, tag = "4")]
pub content_length: u64,
/// Finished piece of task.
#[prost(message, optional, tag = "2")]
#[prost(message, optional, tag = "5")]
pub piece: ::core::option::Option<super::super::common::v2::Piece>,
}
/// UploadTaskRequest represents request of UploadTask.
Expand Down

0 comments on commit a5e7794

Please sign in to comment.