Skip to content

Commit

Permalink
feat: set digest to optional for persistent cache task
Browse files Browse the repository at this point in the history
Signed-off-by: Gaius <[email protected]>
  • Loading branch information
gaius-qi committed Jan 15, 2025
1 parent 76b2eac commit 352bcc2
Show file tree
Hide file tree
Showing 18 changed files with 855 additions and 816 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.1.5"
version = "2.1.6"
authors = ["Gaius <[email protected]>"]
edition = "2021"
license = "Apache-2.0"
Expand Down
745 changes: 373 additions & 372 deletions pkg/apis/common/v2/common.pb.go

Large diffs are not rendered by default.

30 changes: 19 additions & 11 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.

2 changes: 1 addition & 1 deletion pkg/apis/common/v2/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ message PersistentCacheTask {
// the persistent cache task will be deleted when dfdaemon runs garbage collection.
uint64 current_replica_count = 4;
// Digest of the task digest, for example blake3:xxx or sha256:yyy.
string digest = 5 [(validate.rules).string = {pattern: "^(md5:[a-fA-F0-9]{32}|sha1:[a-fA-F0-9]{40}|sha256:[a-fA-F0-9]{64}|sha512:[a-fA-F0-9]{128}|blake3:[a-fA-F0-9]{64}|crc32:[a-fA-F0-9]+)$"}];
optional string digest = 5 [(validate.rules).string = {pattern: "^(md5:[a-fA-F0-9]{32}|sha1:[a-fA-F0-9]{40}|sha256:[a-fA-F0-9]{64}|sha512:[a-fA-F0-9]{128}|blake3:[a-fA-F0-9]{64}|crc32:[a-fA-F0-9]+)$", ignore_empty: true}];
// Tag is used to distinguish different persistent cache tasks.
optional string tag = 6;
// Application of task.
Expand Down
524 changes: 268 additions & 256 deletions pkg/apis/dfdaemon/v2/dfdaemon.pb.go

Large diffs are not rendered by default.

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

10 changes: 6 additions & 4 deletions pkg/apis/dfdaemon/v2/dfdaemon.proto
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,16 @@ message WritePersistentCacheTaskRequest {

// WritePersistentCacheTaskStartedRequest represents task write started request of WritePersistentCacheTaskRequest.
message WritePersistentCacheTaskStartedRequest {
// Task content length.
uint64 content_length = 1;
// Replica count of the persistent persistent cache task.
uint64 persistent_replica_count = 1 [(validate.rules).uint64 = {gte: 1, lte: 5}];
uint64 persistent_replica_count = 2 [(validate.rules).uint64 = {gte: 1, lte: 5}];
// Tag is used to distinguish different persistent cache tasks.
optional string tag = 2;
optional string tag = 3;
// Application of task.
optional string application = 3;
optional string application = 4;
// TTL of the persistent cache task.
google.protobuf.Duration ttl = 4 [(validate.rules).duration = {gte:{seconds: 60}, lte:{seconds: 604800}}];
google.protobuf.Duration ttl = 5 [(validate.rules).duration = {gte:{seconds: 60}, lte:{seconds: 604800}}];
}

// WritePersistentCacheTaskFinishedRequest represents task write finished request of WritePersistentCacheTaskRequest.
Expand Down
289 changes: 145 additions & 144 deletions pkg/apis/scheduler/v2/scheduler.pb.go

Large diffs are not rendered by default.

30 changes: 19 additions & 11 deletions pkg/apis/scheduler/v2/scheduler.pb.validate.go

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

2 changes: 1 addition & 1 deletion pkg/apis/scheduler/v2/scheduler.proto
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ message UploadPersistentCacheTaskStartedRequest {
// Replica count of the persistent cache task.
uint64 persistent_replica_count = 4 [(validate.rules).uint64.gte = 1];
// Digest of the task digest, for example blake3:xxx or sha256:yyy.
string digest = 5 [(validate.rules).string = {pattern: "^(md5:[a-fA-F0-9]{32}|sha1:[a-fA-F0-9]{40}|sha256:[a-fA-F0-9]{64}|sha512:[a-fA-F0-9]{128}|blake3:[a-fA-F0-9]{64}|crc32:[a-fA-F0-9]+)$"}];
optional string digest = 5 [(validate.rules).string = {pattern: "^(md5:[a-fA-F0-9]{32}|sha1:[a-fA-F0-9]{40}|sha256:[a-fA-F0-9]{64}|sha512:[a-fA-F0-9]{128}|blake3:[a-fA-F0-9]{64}|crc32:[a-fA-F0-9]+)$", ignore_empty: true}];
// Tag is used to distinguish different persistent cache tasks.
optional string tag = 6;
// Application of task.
Expand Down
2 changes: 1 addition & 1 deletion proto/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ message PersistentCacheTask {
// the persistent cache task will be deleted when dfdaemon runs garbage collection.
uint64 current_replica_count = 4;
// Digest of the task digest, for example blake3:xxx or sha256:yyy.
string digest = 5;
optional string digest = 5;
// Tag is used to distinguish different persistent cache tasks.
optional string tag = 6;
// Application of task.
Expand Down
10 changes: 6 additions & 4 deletions proto/dfdaemon.proto
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,16 @@ message WritePersistentCacheTaskRequest {

// WritePersistentCacheTaskStartedRequest represents task write started request of WritePersistentCacheTaskRequest.
message WritePersistentCacheTaskStartedRequest {
// Persistent cache task content length, it is used to calculate the piece length.
uint64 content_length = 1;
// Replica count of the persistent persistent cache task.
uint64 persistent_replica_count = 1;
uint64 persistent_replica_count = 2;
// Tag is used to distinguish different persistent cache tasks.
optional string tag = 2;
optional string tag = 3;
// Application of task.
optional string application = 3;
optional string application = 4;
// TTL of the persistent cache task.
google.protobuf.Duration ttl = 4;
google.protobuf.Duration ttl = 5;
}

// WritePersistentCacheTaskFinishedRequest represents task write finished request of WritePersistentCacheTaskRequest.
Expand Down
2 changes: 1 addition & 1 deletion proto/scheduler.proto
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ message UploadPersistentCacheTaskStartedRequest {
// Replica count of the persistent cache task.
uint64 persistent_replica_count = 4;
// Digest of the task digest, for example blake3:xxx or sha256:yyy.
string digest = 5;
optional string digest = 5;
// Tag is used to distinguish different persistent cache tasks.
optional string tag = 6;
// Application of task.
Expand Down
4 changes: 2 additions & 2 deletions src/common.v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ pub struct PersistentCacheTask {
#[prost(uint64, tag = "4")]
pub current_replica_count: u64,
/// Digest of the task digest, for example blake3:xxx or sha256:yyy.
#[prost(string, tag = "5")]
pub digest: ::prost::alloc::string::String,
#[prost(string, optional, tag = "5")]
pub digest: ::core::option::Option<::prost::alloc::string::String>,
/// Tag is used to distinguish different persistent cache tasks.
#[prost(string, optional, tag = "6")]
pub tag: ::core::option::Option<::prost::alloc::string::String>,
Expand Down
Binary file modified src/descriptor.bin
Binary file not shown.
11 changes: 7 additions & 4 deletions src/dfdaemon.v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,17 +172,20 @@ pub mod write_persistent_cache_task_request {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WritePersistentCacheTaskStartedRequest {
/// Replica count of the persistent persistent cache task.
/// Persistent cache task content length, it is used to calculate the piece length.
#[prost(uint64, tag = "1")]
pub content_length: u64,
/// Replica count of the persistent persistent cache task.
#[prost(uint64, tag = "2")]
pub persistent_replica_count: u64,
/// Tag is used to distinguish different persistent cache tasks.
#[prost(string, optional, tag = "2")]
#[prost(string, optional, tag = "3")]
pub tag: ::core::option::Option<::prost::alloc::string::String>,
/// Application of task.
#[prost(string, optional, tag = "3")]
#[prost(string, optional, tag = "4")]
pub application: ::core::option::Option<::prost::alloc::string::String>,
/// TTL of the persistent cache task.
#[prost(message, optional, tag = "4")]
#[prost(message, optional, tag = "5")]
pub ttl: ::core::option::Option<::prost_wkt_types::Duration>,
}
/// WritePersistentCacheTaskFinishedRequest represents task write finished request of WritePersistentCacheTaskRequest.
Expand Down
4 changes: 2 additions & 2 deletions src/scheduler.v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -529,8 +529,8 @@ pub struct UploadPersistentCacheTaskStartedRequest {
#[prost(uint64, tag = "4")]
pub persistent_replica_count: u64,
/// Digest of the task digest, for example blake3:xxx or sha256:yyy.
#[prost(string, tag = "5")]
pub digest: ::prost::alloc::string::String,
#[prost(string, optional, tag = "5")]
pub digest: ::core::option::Option<::prost::alloc::string::String>,
/// Tag is used to distinguish different persistent cache tasks.
#[prost(string, optional, tag = "6")]
pub tag: ::core::option::Option<::prost::alloc::string::String>,
Expand Down

0 comments on commit 352bcc2

Please sign in to comment.