Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add rate limit for network #400

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.162"
version = "2.0.163"
authors = ["Gaius <[email protected]>"]
edition = "2021"
license = "Apache-2.0"
Expand Down
442 changes: 246 additions & 196 deletions pkg/apis/common/v2/common.pb.go

Large diffs are not rendered by default.

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

8 changes: 8 additions & 0 deletions pkg/apis/common/v2/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,14 @@ message Network {
optional string location = 3;
// IDC where the peer host is located
optional string idc = 4;
// Download rate is received bytes per second.
uint64 download_rate = 5;
// Download rate is the limit of received bytes per second.
uint64 download_rate_limit = 6;
// Upload rate is transmitted bytes per second.
uint64 upload_rate = 7;
// Upload rate is the limit of transmitted bytes per second.
uint64 upload_rate_limit = 8;
}

// Disk Stat.
Expand Down
8 changes: 8 additions & 0 deletions proto/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,14 @@ message Network {
optional string location = 3;
// IDC where the peer host is located
optional string idc = 4;
// Download rate is received bytes per second.
uint64 download_rate = 5;
// Download rate is the limit of received bytes per second.
uint64 download_rate_limit = 6;
// Upload rate is transmitted bytes per second.
uint64 upload_rate = 7;
// Upload rate is the limit of transmitted bytes per second.
uint64 upload_rate_limit = 8;
}

// Disk Stat.
Expand Down
22 changes: 19 additions & 3 deletions src/common.v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ pub struct PersistentCachePeer {
pub id: ::prost::alloc::string::String,
/// Persistent represents whether the persistent cache peer is persistent.
/// If the persistent cache peer is persistent, the persistent cache peer will
/// not be deleted when dfdaemon runs garbage collection.
/// not be deleted when dfdaemon runs garbage collection. It only be deleted
/// when the task is deleted by the user.
#[prost(bool, tag = "2")]
pub persistent: bool,
/// Peer downloads costs time.
Expand Down Expand Up @@ -145,10 +146,13 @@ pub struct PersistentCacheTask {
/// Task id.
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
/// Replica count of the persistent cache task.
/// Replica count of the persistent cache task. The persistent cache task will
/// not be deleted when dfdamon runs garbage collection. It only be deleted
/// when the task is deleted by the user.
#[prost(uint64, tag = "2")]
pub persistent_replica_count: u64,
/// Replica count of the persistent cache task.
/// Replica count of the cache task. If cache task is not persistent,
/// the persistent cache task will be deleted when dfdaemon runs garbage collection.
#[prost(uint64, tag = "3")]
pub replica_count: u64,
/// Digest of the task digest, for example blake3:xxx or sha256:yyy.
Expand Down Expand Up @@ -341,6 +345,18 @@ pub struct Network {
/// IDC where the peer host is located
#[prost(string, optional, tag = "4")]
pub idc: ::core::option::Option<::prost::alloc::string::String>,
/// Download rate is received bytes per second.
#[prost(uint64, tag = "5")]
pub download_rate: u64,
/// Download rate is the limit of received bytes per second.
#[prost(uint64, tag = "6")]
pub download_rate_limit: u64,
/// Upload rate is transmitted bytes per second.
#[prost(uint64, tag = "7")]
pub upload_rate: u64,
/// Upload rate is the limit of transmitted bytes per second.
#[prost(uint64, tag = "8")]
pub upload_rate_limit: u64,
}
/// Disk Stat.
#[derive(serde::Serialize, serde::Deserialize)]
Expand Down
Binary file modified src/descriptor.bin
Binary file not shown.
Loading