diff --git a/Cargo.lock b/Cargo.lock index 05a6f77..6b4a5ab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -190,7 +190,7 @@ dependencies = [ [[package]] name = "dragonfly-api" -version = "2.1.18" +version = "2.1.19" dependencies = [ "prost", "prost-types", diff --git a/Cargo.toml b/Cargo.toml index 1ea45a9..6a4d0c0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dragonfly-api" -version = "2.1.18" +version = "2.1.19" authors = ["Gaius "] edition = "2021" license = "Apache-2.0" diff --git a/pkg/apis/scheduler/v2/scheduler.pb.go b/pkg/apis/scheduler/v2/scheduler.pb.go index bb61c29..13a8019 100644 --- a/pkg/apis/scheduler/v2/scheduler.pb.go +++ b/pkg/apis/scheduler/v2/scheduler.pb.go @@ -1602,16 +1602,20 @@ type RegisterPersistentCachePeerRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // Persistent represents whether the persistent cache task is persistent. + // If the persistent cache task is persistent, the persistent cache peer will + // not be deleted when dfdaemon runs garbage collection. + Persistent bool `protobuf:"varint,1,opt,name=persistent,proto3" json:"persistent,omitempty"` // Tag is used to distinguish different persistent cache tasks. - Tag *string `protobuf:"bytes,1,opt,name=tag,proto3,oneof" json:"tag,omitempty"` + Tag *string `protobuf:"bytes,2,opt,name=tag,proto3,oneof" json:"tag,omitempty"` // Application of task. - Application *string `protobuf:"bytes,2,opt,name=application,proto3,oneof" json:"application,omitempty"` + Application *string `protobuf:"bytes,3,opt,name=application,proto3,oneof" json:"application,omitempty"` // Task piece length. - PieceLength uint64 `protobuf:"varint,3,opt,name=piece_length,json=pieceLength,proto3" json:"piece_length,omitempty"` + PieceLength uint64 `protobuf:"varint,4,opt,name=piece_length,json=pieceLength,proto3" json:"piece_length,omitempty"` // File path to be exported. - OutputPath *string `protobuf:"bytes,4,opt,name=output_path,json=outputPath,proto3,oneof" json:"output_path,omitempty"` + OutputPath *string `protobuf:"bytes,5,opt,name=output_path,json=outputPath,proto3,oneof" json:"output_path,omitempty"` // Download timeout. - Timeout *durationpb.Duration `protobuf:"bytes,5,opt,name=timeout,proto3,oneof" json:"timeout,omitempty"` + Timeout *durationpb.Duration `protobuf:"bytes,6,opt,name=timeout,proto3,oneof" json:"timeout,omitempty"` } func (x *RegisterPersistentCachePeerRequest) Reset() { @@ -1646,6 +1650,13 @@ func (*RegisterPersistentCachePeerRequest) Descriptor() ([]byte, []int) { return file_pkg_apis_scheduler_v2_scheduler_proto_rawDescGZIP(), []int{24} } +func (x *RegisterPersistentCachePeerRequest) GetPersistent() bool { + if x != nil { + return x.Persistent + } + return false +} + func (x *RegisterPersistentCachePeerRequest) GetTag() string { if x != nil && x.Tag != nil { return *x.Tag @@ -3036,20 +3047,22 @@ var file_pkg_apis_scheduler_v2_scheduler_proto_rawDesc = []byte{ 0x73, 0x74, 0x73, 0x22, 0x35, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 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, 0x22, 0xae, 0x02, 0x0a, 0x22, 0x52, + 0x10, 0x01, 0x52, 0x06, 0x68, 0x6f, 0x73, 0x74, 0x49, 0x64, 0x22, 0xce, 0x02, 0x0a, 0x22, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x65, 0x72, 0x73, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x63, 0x68, 0x65, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x15, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, + 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x65, 0x72, 0x73, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x74, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x70, 0x65, 0x72, 0x73, 0x69, 0x73, 0x74, 0x65, 0x6e, + 0x74, 0x12, 0x15, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x02, 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, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 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, - 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x28, 0x01, 0x52, 0x0b, + 0x04, 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, 0x30, 0x0a, 0x0b, 0x6f, - 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xfa, 0x42, 0x07, 0x72, 0x05, 0x10, 0x01, 0xd0, 0x01, 0x01, 0x48, 0x02, 0x52, 0x0a, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x50, 0x61, 0x74, 0x68, 0x88, 0x01, 0x01, 0x12, 0x38, 0x0a, - 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, + 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x06, 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, 0x03, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x88, 0x01, 0x01, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x74, 0x61, 0x67, 0x42, diff --git a/pkg/apis/scheduler/v2/scheduler.pb.validate.go b/pkg/apis/scheduler/v2/scheduler.pb.validate.go index 330f649..9baaec3 100644 --- a/pkg/apis/scheduler/v2/scheduler.pb.validate.go +++ b/pkg/apis/scheduler/v2/scheduler.pb.validate.go @@ -3869,6 +3869,8 @@ func (m *RegisterPersistentCachePeerRequest) validate(all bool) error { var errors []error + // no validation rules for Persistent + if m.GetPieceLength() < 1 { err := RegisterPersistentCachePeerRequestValidationError{ field: "PieceLength", diff --git a/pkg/apis/scheduler/v2/scheduler.proto b/pkg/apis/scheduler/v2/scheduler.proto index dd4b89b..a875f99 100644 --- a/pkg/apis/scheduler/v2/scheduler.proto +++ b/pkg/apis/scheduler/v2/scheduler.proto @@ -226,16 +226,20 @@ message DeleteHostRequest{ // RegisterPersistentCachePeerRequest represents persistent cache peer registered request of AnnouncePersistentCachePeerRequest. message RegisterPersistentCachePeerRequest { + // Persistent represents whether the persistent cache task is persistent. + // If the persistent cache task is persistent, the persistent cache peer will + // not be deleted when dfdaemon runs garbage collection. + bool persistent = 1; // Tag is used to distinguish different persistent cache tasks. - optional string tag = 1; + optional string tag = 2; // Application of task. - optional string application = 2; + optional string application = 3; // Task piece length. - uint64 piece_length = 3 [(validate.rules).uint64.gte = 1]; + uint64 piece_length = 4 [(validate.rules).uint64.gte = 1]; // File path to be exported. - optional string output_path = 4 [(validate.rules).string = {min_len: 1, ignore_empty: true}]; + optional string output_path = 5 [(validate.rules).string = {min_len: 1, ignore_empty: true}]; // Download timeout. - optional google.protobuf.Duration timeout = 5; + optional google.protobuf.Duration timeout = 6; } // DownloadPersistentCachePeerStartedRequest represents persistent cache peer download started request of AnnouncePersistentCachePeerRequest. diff --git a/proto/scheduler.proto b/proto/scheduler.proto index 0f27370..1888215 100644 --- a/proto/scheduler.proto +++ b/proto/scheduler.proto @@ -217,16 +217,20 @@ message DeleteHostRequest{ // RegisterPersistentCachePeerRequest represents persistent cache peer registered request of AnnouncePersistentCachePeerRequest. message RegisterPersistentCachePeerRequest { + // Persistent represents whether the persistent cache task is persistent. + // If the persistent cache task is persistent, the persistent cache peer will + // not be deleted when dfdaemon runs garbage collection. + bool persistent = 1; // Tag is used to distinguish different persistent cache tasks. - optional string tag = 1; + optional string tag = 2; // Application of task. - optional string application = 2; + optional string application = 3; // Task piece length. - uint64 piece_length = 3; + uint64 piece_length = 4; // File path to be exported. - optional string output_path = 4; + optional string output_path = 5; // Download timeout. - optional google.protobuf.Duration timeout = 5; + optional google.protobuf.Duration timeout = 6; } // DownloadPersistentCachePeerStartedRequest represents persistent cache peer download started request of AnnouncePersistentCachePeerRequest. diff --git a/src/descriptor.bin b/src/descriptor.bin index 7751b93..014bdba 100644 Binary files a/src/descriptor.bin and b/src/descriptor.bin differ diff --git a/src/scheduler.v2.rs b/src/scheduler.v2.rs index c126cad..1a93e5c 100644 --- a/src/scheduler.v2.rs +++ b/src/scheduler.v2.rs @@ -334,20 +334,25 @@ pub struct DeleteHostRequest { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct RegisterPersistentCachePeerRequest { + /// Persistent represents whether the persistent cache task is persistent. + /// If the persistent cache task is persistent, the persistent cache peer will + /// not be deleted when dfdaemon runs garbage collection. + #[prost(bool, tag = "1")] + pub persistent: bool, /// Tag is used to distinguish different persistent cache tasks. - #[prost(string, optional, tag = "1")] + #[prost(string, optional, tag = "2")] pub tag: ::core::option::Option<::prost::alloc::string::String>, /// Application of task. - #[prost(string, optional, tag = "2")] + #[prost(string, optional, tag = "3")] pub application: ::core::option::Option<::prost::alloc::string::String>, /// Task piece length. - #[prost(uint64, tag = "3")] + #[prost(uint64, tag = "4")] pub piece_length: u64, /// File path to be exported. - #[prost(string, optional, tag = "4")] + #[prost(string, optional, tag = "5")] pub output_path: ::core::option::Option<::prost::alloc::string::String>, /// Download timeout. - #[prost(message, optional, tag = "5")] + #[prost(message, optional, tag = "6")] pub timeout: ::core::option::Option<::prost_wkt_types::Duration>, } /// DownloadPersistentCachePeerStartedRequest represents persistent cache peer download started request of AnnouncePersistentCachePeerRequest.