Skip to content

Commit

Permalink
feat: remove piece length field in download request (#368)
Browse files Browse the repository at this point in the history
Signed-off-by: Gaius <[email protected]>
  • Loading branch information
gaius-qi authored Aug 12, 2024
1 parent 7b5ecb7 commit 5bd847f
Show file tree
Hide file tree
Showing 13 changed files with 312 additions and 430 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

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.144"
version = "2.0.145"
authors = ["Gaius <[email protected]>"]
edition = "2021"
license = "Apache-2.0"
Expand Down
269 changes: 128 additions & 141 deletions pkg/apis/common/v2/common.pb.go

Large diffs are not rendered by default.

19 changes: 0 additions & 19 deletions pkg/apis/common/v2/common.pb.validate.go

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

16 changes: 7 additions & 9 deletions pkg/apis/common/v2/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -391,22 +391,20 @@ message Download {
repeated string filtered_query_params = 8;
// Task request headers.
map<string, string> request_header = 9;
// Task piece length.
optional uint64 piece_length = 10 [(validate.rules).uint64 = {gte: 1, ignore_empty: true}];
// File path to be exported.
optional string output_path = 11 [(validate.rules).string = {min_len: 1, ignore_empty: true}];
optional string output_path = 10 [(validate.rules).string = {min_len: 1, ignore_empty: true}];
// Download timeout.
optional google.protobuf.Duration timeout = 12;
optional google.protobuf.Duration timeout = 11;
// Dfdaemon will disable download back-to-source by itself, if disable_back_to_source is true.
bool disable_back_to_source = 13;
bool disable_back_to_source = 12;
// Scheduler will triggers peer to download back-to-source, if need_back_to_source is true.
bool need_back_to_source = 14;
bool need_back_to_source = 13;
// certificate_chain is the client certs with DER format for the backend client to download back-to-source.
repeated bytes certificate_chain = 15;
repeated bytes certificate_chain = 14;
// prefetch pre-downloads all pieces of the task when download task with range request.
bool prefetch = 16;
bool prefetch = 15;
// Object Storage related information.
optional ObjectStorage object_storage = 17;
optional ObjectStorage object_storage = 16;
}

// Object Storage related information.
Expand Down
325 changes: 149 additions & 176 deletions pkg/apis/dfdaemon/v2/dfdaemon.pb.go

Large diffs are not rendered by default.

38 changes: 0 additions & 38 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.

12 changes: 4 additions & 8 deletions pkg/apis/dfdaemon/v2/dfdaemon.proto
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,10 @@ message DownloadCacheTaskRequest {
optional string tag = 3;
// Application of task.
optional string application = 4;
// Task piece length.
optional uint64 piece_length = 5 [(validate.rules).uint64 = {gte: 1, ignore_empty: true}];
// File path to be exported.
string output_path = 6 [(validate.rules).string.min_len = 1];
string output_path = 5 [(validate.rules).string.min_len = 1];
// Download timeout.
optional google.protobuf.Duration timeout = 7;
optional google.protobuf.Duration timeout = 6;
}

// DownloadCacheTaskStartedResponse represents task download started response of DownloadCacheTaskResponse.
Expand Down Expand Up @@ -178,12 +176,10 @@ message UploadCacheTaskRequest {
optional string tag = 3;
// Application of task.
optional string application = 4;
// Task piece length.
optional uint64 piece_length = 5 [(validate.rules).uint64 = {gte: 1, ignore_empty: true}];
// TTL of the cache task.
google.protobuf.Duration ttl = 6 [(validate.rules).duration = {gte:{seconds: 60}, lte:{seconds: 604800}}];
google.protobuf.Duration ttl = 5 [(validate.rules).duration = {gte:{seconds: 60}, lte:{seconds: 604800}}];
// Upload timeout.
optional google.protobuf.Duration timeout = 7;
optional google.protobuf.Duration timeout = 6;
}

// StatCacheTaskRequest represents request of StatCacheTask.
Expand Down
16 changes: 7 additions & 9 deletions proto/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -387,22 +387,20 @@ message Download {
repeated string filtered_query_params = 8;
// Task request headers.
map<string, string> request_header = 9;
// Task piece length.
optional uint64 piece_length = 10;
// File path to be exported.
optional string output_path = 11;
optional string output_path = 10;
// Download timeout.
optional google.protobuf.Duration timeout = 12;
optional google.protobuf.Duration timeout = 11;
// Dfdaemon will disable download back-to-source by itself, if disable_back_to_source is true.
bool disable_back_to_source = 13;
bool disable_back_to_source = 12;
// Scheduler will triggers peer to download back-to-source, if need_back_to_source is true.
bool need_back_to_source = 14;
bool need_back_to_source = 13;
// certificate_chain is the client certs with DER format for the backend client to download back-to-source.
repeated bytes certificate_chain = 15;
repeated bytes certificate_chain = 14;
// prefetch pre-downloads all pieces of the task when download task with range request.
bool prefetch = 16;
bool prefetch = 15;
// Object Storage related information.
optional ObjectStorage object_storage = 17;
optional ObjectStorage object_storage = 16;
}

// Object Storage related information.
Expand Down
12 changes: 4 additions & 8 deletions proto/dfdaemon.proto
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,10 @@ message DownloadCacheTaskRequest {
optional string tag = 3;
// Application of task.
optional string application = 4;
// Task piece length.
optional uint64 piece_length = 5;
// File path to be exported.
string output_path = 6;
string output_path = 5;
// Download timeout.
optional google.protobuf.Duration timeout = 7;
optional google.protobuf.Duration timeout = 6;
}

// DownloadCacheTaskStartedResponse represents task download started response of DownloadCacheTaskResponse.
Expand Down Expand Up @@ -165,12 +163,10 @@ message UploadCacheTaskRequest {
optional string tag = 3;
// Application of task.
optional string application = 4;
// Task piece length.
optional uint64 piece_length = 5;
// TTL of the cache task.
google.protobuf.Duration ttl = 6;
google.protobuf.Duration ttl = 5;
// Upload timeout.
optional google.protobuf.Duration timeout = 7;
optional google.protobuf.Duration timeout = 6;
}

// StatCacheTaskRequest represents request of StatCacheTask.
Expand Down
17 changes: 7 additions & 10 deletions src/common.v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,29 +431,26 @@ pub struct Download {
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
/// Task piece length.
#[prost(uint64, optional, tag = "10")]
pub piece_length: ::core::option::Option<u64>,
/// File path to be exported.
#[prost(string, optional, tag = "11")]
#[prost(string, optional, tag = "10")]
pub output_path: ::core::option::Option<::prost::alloc::string::String>,
/// Download timeout.
#[prost(message, optional, tag = "12")]
#[prost(message, optional, tag = "11")]
pub timeout: ::core::option::Option<::prost_wkt_types::Duration>,
/// Dfdaemon will disable download back-to-source by itself, if disable_back_to_source is true.
#[prost(bool, tag = "13")]
#[prost(bool, tag = "12")]
pub disable_back_to_source: bool,
/// Scheduler will triggers peer to download back-to-source, if need_back_to_source is true.
#[prost(bool, tag = "14")]
#[prost(bool, tag = "13")]
pub need_back_to_source: bool,
/// certificate_chain is the client certs with DER format for the backend client to download back-to-source.
#[prost(bytes = "vec", repeated, tag = "15")]
#[prost(bytes = "vec", repeated, tag = "14")]
pub certificate_chain: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
/// prefetch pre-downloads all pieces of the task when download task with range request.
#[prost(bool, tag = "16")]
#[prost(bool, tag = "15")]
pub prefetch: bool,
/// Object Storage related information.
#[prost(message, optional, tag = "17")]
#[prost(message, optional, tag = "16")]
pub object_storage: ::core::option::Option<ObjectStorage>,
}
/// Object Storage related information.
Expand Down
Binary file modified src/descriptor.bin
Binary file not shown.
14 changes: 4 additions & 10 deletions src/dfdaemon.v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,11 @@ pub struct DownloadCacheTaskRequest {
/// Application of task.
#[prost(string, optional, tag = "4")]
pub application: ::core::option::Option<::prost::alloc::string::String>,
/// Task piece length.
#[prost(uint64, optional, tag = "5")]
pub piece_length: ::core::option::Option<u64>,
/// File path to be exported.
#[prost(string, tag = "6")]
#[prost(string, tag = "5")]
pub output_path: ::prost::alloc::string::String,
/// Download timeout.
#[prost(message, optional, tag = "7")]
#[prost(message, optional, tag = "6")]
pub timeout: ::core::option::Option<::prost_wkt_types::Duration>,
}
/// DownloadCacheTaskStartedResponse represents task download started response of DownloadCacheTaskResponse.
Expand Down Expand Up @@ -225,14 +222,11 @@ pub struct UploadCacheTaskRequest {
/// Application of task.
#[prost(string, optional, tag = "4")]
pub application: ::core::option::Option<::prost::alloc::string::String>,
/// Task piece length.
#[prost(uint64, optional, tag = "5")]
pub piece_length: ::core::option::Option<u64>,
/// TTL of the cache task.
#[prost(message, optional, tag = "6")]
#[prost(message, optional, tag = "5")]
pub ttl: ::core::option::Option<::prost_wkt_types::Duration>,
/// Upload timeout.
#[prost(message, optional, tag = "7")]
#[prost(message, optional, tag = "6")]
pub timeout: ::core::option::Option<::prost_wkt_types::Duration>,
}
/// StatCacheTaskRequest represents request of StatCacheTask.
Expand Down

0 comments on commit 5bd847f

Please sign in to comment.