Skip to content

Commit

Permalink
feat: remove digest field in PersistentCacheTask (#443)
Browse files Browse the repository at this point in the history
Signed-off-by: Gaius <[email protected]>
  • Loading branch information
gaius-qi authored Jan 17, 2025
1 parent 13a45c2 commit b9b9841
Show file tree
Hide file tree
Showing 13 changed files with 562 additions and 660 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.7"
version = "2.1.8"
authors = ["Gaius <[email protected]>"]
edition = "2021"
license = "Apache-2.0"
Expand Down
755 changes: 367 additions & 388 deletions pkg/apis/common/v2/common.pb.go

Large diffs are not rendered by default.

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

18 changes: 8 additions & 10 deletions pkg/apis/common/v2/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -220,24 +220,22 @@ message PersistentCacheTask {
// Current replica count of the cache task. If cache task is not persistent,
// 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.
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;
optional string tag = 5;
// Application of task.
optional string application = 7;
optional string application = 6;
// Task piece length.
uint64 piece_length = 8 [(validate.rules).uint64.gte = 1];
uint64 piece_length = 7 [(validate.rules).uint64.gte = 1];
// Task content length.
uint64 content_length = 9;
uint64 content_length = 8;
// Task piece count.
uint32 piece_count = 10;
uint32 piece_count = 9;
// Task state.
string state = 11 [(validate.rules).string.min_len = 1];
string state = 10 [(validate.rules).string.min_len = 1];
// Task create time.
google.protobuf.Timestamp created_at = 12 [(validate.rules).timestamp.required = true];
google.protobuf.Timestamp created_at = 11 [(validate.rules).timestamp.required = true];
// Task update time.
google.protobuf.Timestamp updated_at = 13 [(validate.rules).timestamp.required = true];
google.protobuf.Timestamp updated_at = 12 [(validate.rules).timestamp.required = true];
}

// Host metadata.
Expand Down
319 changes: 149 additions & 170 deletions pkg/apis/scheduler/v2/scheduler.pb.go

Large diffs are not rendered by default.

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

14 changes: 6 additions & 8 deletions pkg/apis/scheduler/v2/scheduler.proto
Original file line number Diff line number Diff line change
Expand Up @@ -335,20 +335,18 @@ message UploadPersistentCacheTaskStartedRequest {
string peer_id = 3 [(validate.rules).string.min_len = 1];
// 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.
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;
optional string tag = 5;
// Application of task.
optional string application = 7;
optional string application = 6;
// Task piece length.
uint64 piece_length = 8 [(validate.rules).uint64.gte = 1];
uint64 piece_length = 7 [(validate.rules).uint64.gte = 1];
// Task content length.
uint64 content_length = 9;
uint64 content_length = 8;
// Task piece count.
uint32 piece_count = 10;
uint32 piece_count = 9;
// TTL of the persistent cache task.
google.protobuf.Duration ttl = 11 [(validate.rules).duration = {gte:{seconds: 60}, lte:{seconds: 604800}}];
google.protobuf.Duration ttl = 10 [(validate.rules).duration = {gte:{seconds: 60}, lte:{seconds: 604800}}];
}

// UploadPersistentCacheTaskFinishedRequest represents upload persistent cache task finished request of UploadPersistentCacheTaskFinishedRequest.
Expand Down
20 changes: 9 additions & 11 deletions proto/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -214,26 +214,24 @@ message PersistentCacheTask {
// Current replica count of the cache task. If cache task is not persistent,
// 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.
optional string digest = 5;
// Tag is used to distinguish different persistent cache tasks.
optional string tag = 6;
optional string tag = 5;
// Application of task.
optional string application = 7;
optional string application = 6;
// Task piece length.
uint64 piece_length = 8;
uint64 piece_length = 7;
// Task content length.
uint64 content_length = 9;
uint64 content_length = 8;
// Task piece count.
uint32 piece_count = 10;
uint32 piece_count = 9;
// Task state.
string state = 11;
string state = 10;
// TTL of the persistent cache task.
google.protobuf.Duration ttl = 12;
google.protobuf.Duration ttl = 11;
// Task create time.
google.protobuf.Timestamp created_at = 13;
google.protobuf.Timestamp created_at = 12;
// Task update time.
google.protobuf.Timestamp updated_at = 14;
google.protobuf.Timestamp updated_at = 13;
}

// Host metadata.
Expand Down
14 changes: 6 additions & 8 deletions proto/scheduler.proto
Original file line number Diff line number Diff line change
Expand Up @@ -322,20 +322,18 @@ message UploadPersistentCacheTaskStartedRequest {
string peer_id = 3;
// Replica count of the persistent cache task.
uint64 persistent_replica_count = 4;
// Digest of the task digest, for example blake3:xxx or sha256:yyy.
optional string digest = 5;
// Tag is used to distinguish different persistent cache tasks.
optional string tag = 6;
optional string tag = 5;
// Application of task.
optional string application = 7;
optional string application = 6;
// Task piece length.
uint64 piece_length = 8;
uint64 piece_length = 7;
// Task content length.
uint64 content_length = 9;
uint64 content_length = 8;
// Task piece count.
uint32 piece_count = 10;
uint32 piece_count = 9;
// TTL of the persistent cache task.
google.protobuf.Duration ttl = 11;
google.protobuf.Duration ttl = 10;
}

// UploadPersistentCacheTaskFinishedRequest represents upload persistent cache task finished request of UploadPersistentCacheTaskFinished.
Expand Down
21 changes: 9 additions & 12 deletions src/common.v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,35 +160,32 @@ pub struct PersistentCacheTask {
/// the persistent cache task will be deleted when dfdaemon runs garbage collection.
#[prost(uint64, tag = "4")]
pub current_replica_count: u64,
/// Digest of the task digest, for example blake3:xxx or sha256:yyy.
#[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")]
#[prost(string, optional, tag = "5")]
pub tag: ::core::option::Option<::prost::alloc::string::String>,
/// Application of task.
#[prost(string, optional, tag = "7")]
#[prost(string, optional, tag = "6")]
pub application: ::core::option::Option<::prost::alloc::string::String>,
/// Task piece length.
#[prost(uint64, tag = "8")]
#[prost(uint64, tag = "7")]
pub piece_length: u64,
/// Task content length.
#[prost(uint64, tag = "9")]
#[prost(uint64, tag = "8")]
pub content_length: u64,
/// Task piece count.
#[prost(uint32, tag = "10")]
#[prost(uint32, tag = "9")]
pub piece_count: u32,
/// Task state.
#[prost(string, tag = "11")]
#[prost(string, tag = "10")]
pub state: ::prost::alloc::string::String,
/// TTL of the persistent cache task.
#[prost(message, optional, tag = "12")]
#[prost(message, optional, tag = "11")]
pub ttl: ::core::option::Option<::prost_wkt_types::Duration>,
/// Task create time.
#[prost(message, optional, tag = "13")]
#[prost(message, optional, tag = "12")]
pub created_at: ::core::option::Option<::prost_wkt_types::Timestamp>,
/// Task update time.
#[prost(message, optional, tag = "14")]
#[prost(message, optional, tag = "13")]
pub updated_at: ::core::option::Option<::prost_wkt_types::Timestamp>,
}
/// Host metadata.
Expand Down
Binary file modified src/descriptor.bin
Binary file not shown.
15 changes: 6 additions & 9 deletions src/scheduler.v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,26 +522,23 @@ pub struct UploadPersistentCacheTaskStartedRequest {
/// Replica count of the persistent cache task.
#[prost(uint64, tag = "4")]
pub persistent_replica_count: u64,
/// Digest of the task digest, for example blake3:xxx or sha256:yyy.
#[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")]
#[prost(string, optional, tag = "5")]
pub tag: ::core::option::Option<::prost::alloc::string::String>,
/// Application of task.
#[prost(string, optional, tag = "7")]
#[prost(string, optional, tag = "6")]
pub application: ::core::option::Option<::prost::alloc::string::String>,
/// Task piece length.
#[prost(uint64, tag = "8")]
#[prost(uint64, tag = "7")]
pub piece_length: u64,
/// Task content length.
#[prost(uint64, tag = "9")]
#[prost(uint64, tag = "8")]
pub content_length: u64,
/// Task piece count.
#[prost(uint32, tag = "10")]
#[prost(uint32, tag = "9")]
pub piece_count: u32,
/// TTL of the persistent cache task.
#[prost(message, optional, tag = "11")]
#[prost(message, optional, tag = "10")]
pub ttl: ::core::option::Option<::prost_wkt_types::Duration>,
}
/// UploadPersistentCacheTaskFinishedRequest represents upload persistent cache task finished request of UploadPersistentCacheTaskFinished.
Expand Down

0 comments on commit b9b9841

Please sign in to comment.