mirror of https://github.com/dragonflyoss/api.git
feat: add persistent field to DownloadCacheTaskRequest (#329)
Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
parent
183280e924
commit
7d88b1c21b
|
|
@ -160,7 +160,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "dragonfly-api"
|
||||
version = "2.0.123"
|
||||
version = "2.0.124"
|
||||
dependencies = [
|
||||
"prost 0.11.9",
|
||||
"prost-types 0.12.6",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "dragonfly-api"
|
||||
version = "2.0.123"
|
||||
version = "2.0.124"
|
||||
authors = ["Gaius <gaius.qi@gmail.com>"]
|
||||
edition = "2021"
|
||||
license = "Apache-2.0"
|
||||
|
|
|
|||
|
|
@ -731,16 +731,20 @@ type DownloadCacheTaskRequest struct {
|
|||
HostId string `protobuf:"bytes,1,opt,name=host_id,json=hostId,proto3" json:"host_id,omitempty"`
|
||||
// Task id.
|
||||
TaskId string `protobuf:"bytes,2,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"`
|
||||
// Persistent represents whether the cache task is persistent.
|
||||
// If the cache task is persistent, the cache peer will
|
||||
// not be deleted when dfdamon runs garbage collection.
|
||||
Persistent bool `protobuf:"varint,3,opt,name=persistent,proto3" json:"persistent,omitempty"`
|
||||
// Tag is used to distinguish different cache tasks.
|
||||
Tag *string `protobuf:"bytes,3,opt,name=tag,proto3,oneof" json:"tag,omitempty"`
|
||||
Tag *string `protobuf:"bytes,4,opt,name=tag,proto3,oneof" json:"tag,omitempty"`
|
||||
// Application of task.
|
||||
Application *string `protobuf:"bytes,4,opt,name=application,proto3,oneof" json:"application,omitempty"`
|
||||
Application *string `protobuf:"bytes,5,opt,name=application,proto3,oneof" json:"application,omitempty"`
|
||||
// Task piece length.
|
||||
PieceLength uint64 `protobuf:"varint,5,opt,name=piece_length,json=pieceLength,proto3" json:"piece_length,omitempty"`
|
||||
PieceLength uint64 `protobuf:"varint,6,opt,name=piece_length,json=pieceLength,proto3" json:"piece_length,omitempty"`
|
||||
// File path to be exported.
|
||||
OutputPath string `protobuf:"bytes,6,opt,name=output_path,json=outputPath,proto3" json:"output_path,omitempty"`
|
||||
OutputPath string `protobuf:"bytes,7,opt,name=output_path,json=outputPath,proto3" json:"output_path,omitempty"`
|
||||
// Download timeout.
|
||||
Timeout *durationpb.Duration `protobuf:"bytes,7,opt,name=timeout,proto3,oneof" json:"timeout,omitempty"`
|
||||
Timeout *durationpb.Duration `protobuf:"bytes,8,opt,name=timeout,proto3,oneof" json:"timeout,omitempty"`
|
||||
}
|
||||
|
||||
func (x *DownloadCacheTaskRequest) Reset() {
|
||||
|
|
@ -789,6 +793,13 @@ func (x *DownloadCacheTaskRequest) GetTaskId() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
func (x *DownloadCacheTaskRequest) GetPersistent() bool {
|
||||
if x != nil {
|
||||
return x.Persistent
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *DownloadCacheTaskRequest) GetTag() string {
|
||||
if x != nil && x.Tag != nil {
|
||||
return *x.Tag
|
||||
|
|
@ -1282,23 +1293,25 @@ var file_pkg_apis_dfdaemon_v2_dfdaemon_proto_rawDesc = []byte{
|
|||
0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0x35, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74,
|
||||
0x65, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x07,
|
||||
0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa,
|
||||
0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0xd0,
|
||||
0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0xf0,
|
||||
0x02, 0x0a, 0x18, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x43, 0x61, 0x63, 0x68, 0x65,
|
||||
0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x07, 0x68,
|
||||
0x6f, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42,
|
||||
0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x68, 0x6f, 0x73, 0x74, 0x49, 0x64, 0x12, 0x20, 0x0a,
|
||||
0x07, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07,
|
||||
0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12,
|
||||
0x15, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03,
|
||||
0x1e, 0x0a, 0x0a, 0x70, 0x65, 0x72, 0x73, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x08, 0x52, 0x0a, 0x70, 0x65, 0x72, 0x73, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x74, 0x12,
|
||||
0x15, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03,
|
||||
0x74, 0x61, 0x67, 0x88, 0x01, 0x01, 0x12, 0x25, 0x0a, 0x0b, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63,
|
||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x0b, 0x61,
|
||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x0b, 0x61,
|
||||
0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x2a, 0x0a,
|
||||
0x0c, 0x70, 0x69, 0x65, 0x63, 0x65, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x05, 0x20,
|
||||
0x0c, 0x70, 0x69, 0x65, 0x63, 0x65, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x06, 0x20,
|
||||
0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x28, 0x01, 0x52, 0x0b, 0x70, 0x69,
|
||||
0x65, 0x63, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x28, 0x0a, 0x0b, 0x6f, 0x75, 0x74,
|
||||
0x70, 0x75, 0x74, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07,
|
||||
0x70, 0x75, 0x74, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07,
|
||||
0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0a, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x50,
|
||||
0x61, 0x74, 0x68, 0x12, 0x38, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x07,
|
||||
0x61, 0x74, 0x68, 0x12, 0x38, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x08,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48,
|
||||
0x02, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x88, 0x01, 0x01, 0x42, 0x06, 0x0a,
|
||||
|
|
|
|||
|
|
@ -1650,6 +1650,8 @@ func (m *DownloadCacheTaskRequest) validate(all bool) error {
|
|||
errors = append(errors, err)
|
||||
}
|
||||
|
||||
// no validation rules for Persistent
|
||||
|
||||
if m.GetPieceLength() < 1 {
|
||||
err := DownloadCacheTaskRequestValidationError{
|
||||
field: "PieceLength",
|
||||
|
|
|
|||
|
|
@ -131,16 +131,20 @@ message DownloadCacheTaskRequest {
|
|||
string host_id = 1 [(validate.rules).string.min_len = 1];
|
||||
// Task id.
|
||||
string task_id = 2 [(validate.rules).string.min_len = 1];
|
||||
// Persistent represents whether the cache task is persistent.
|
||||
// If the cache task is persistent, the cache peer will
|
||||
// not be deleted when dfdamon runs garbage collection.
|
||||
bool persistent = 3;
|
||||
// Tag is used to distinguish different cache tasks.
|
||||
optional string tag = 3;
|
||||
optional string tag = 4;
|
||||
// Application of task.
|
||||
optional string application = 4;
|
||||
optional string application = 5;
|
||||
// Task piece length.
|
||||
uint64 piece_length = 5 [(validate.rules).uint64.gte = 1];
|
||||
uint64 piece_length = 6 [(validate.rules).uint64.gte = 1];
|
||||
// File path to be exported.
|
||||
string output_path = 6 [(validate.rules).string.min_len = 1];
|
||||
string output_path = 7 [(validate.rules).string.min_len = 1];
|
||||
// Download timeout.
|
||||
optional google.protobuf.Duration timeout = 7;
|
||||
optional google.protobuf.Duration timeout = 8;
|
||||
}
|
||||
|
||||
// DownloadCacheTaskStartedResponse represents task download started response of DownloadCacheTaskResponse.
|
||||
|
|
|
|||
|
|
@ -120,16 +120,20 @@ message DownloadCacheTaskRequest {
|
|||
string host_id = 1;
|
||||
// Task id.
|
||||
string task_id = 2;
|
||||
// Persistent represents whether the cache task is persistent.
|
||||
// If the cache task is persistent, the cache peer will
|
||||
// not be deleted when dfdamon runs garbage collection.
|
||||
bool persistent = 3;
|
||||
// Tag is used to distinguish different cache tasks.
|
||||
optional string tag = 3;
|
||||
optional string tag = 4;
|
||||
// Application of task.
|
||||
optional string application = 4;
|
||||
optional string application = 5;
|
||||
// Task piece length.
|
||||
uint64 piece_length = 5;
|
||||
uint64 piece_length = 6;
|
||||
// File path to be exported.
|
||||
string output_path = 6;
|
||||
string output_path = 7;
|
||||
// Download timeout.
|
||||
optional google.protobuf.Duration timeout = 7;
|
||||
optional google.protobuf.Duration timeout = 8;
|
||||
}
|
||||
|
||||
// DownloadCacheTaskStartedResponse represents task download started response of DownloadCacheTaskResponse.
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -151,20 +151,25 @@ pub struct DownloadCacheTaskRequest {
|
|||
/// Task id.
|
||||
#[prost(string, tag = "2")]
|
||||
pub task_id: ::prost::alloc::string::String,
|
||||
/// Persistent represents whether the cache task is persistent.
|
||||
/// If the cache task is persistent, the cache peer will
|
||||
/// not be deleted when dfdamon runs garbage collection.
|
||||
#[prost(bool, tag = "3")]
|
||||
pub persistent: bool,
|
||||
/// Tag is used to distinguish different cache tasks.
|
||||
#[prost(string, optional, tag = "3")]
|
||||
#[prost(string, optional, tag = "4")]
|
||||
pub tag: ::core::option::Option<::prost::alloc::string::String>,
|
||||
/// Application of task.
|
||||
#[prost(string, optional, tag = "4")]
|
||||
#[prost(string, optional, tag = "5")]
|
||||
pub application: ::core::option::Option<::prost::alloc::string::String>,
|
||||
/// Task piece length.
|
||||
#[prost(uint64, tag = "5")]
|
||||
#[prost(uint64, tag = "6")]
|
||||
pub piece_length: u64,
|
||||
/// File path to be exported.
|
||||
#[prost(string, tag = "6")]
|
||||
#[prost(string, tag = "7")]
|
||||
pub output_path: ::prost::alloc::string::String,
|
||||
/// Download timeout.
|
||||
#[prost(message, optional, tag = "7")]
|
||||
#[prost(message, optional, tag = "8")]
|
||||
pub timeout: ::core::option::Option<::prost_wkt_types::Duration>,
|
||||
}
|
||||
/// DownloadCacheTaskStartedResponse represents task download started response of DownloadCacheTaskResponse.
|
||||
|
|
|
|||
Loading…
Reference in New Issue