Skip to content

Commit a7ba7d7

Browse files
authored
feat(manager): add the seed_client_config to the SchedulerCluster (#617)
Signed-off-by: chlins <[email protected]>
1 parent 6d833cd commit a7ba7d7

23 files changed

+1302
-862
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "dragonfly-api"
3-
version = "2.2.13"
3+
version = "2.2.14"
44
authors = ["Gaius <[email protected]>"]
55
edition = "2021"
66
license = "Apache-2.0"

pkg/apis/cdnsystem/v1/cdnsystem.proto

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ import "validate/validate.proto";
2323

2424
option go_package = "d7y.io/api/v2/pkg/apis/cdnsystem/v1;cdnsystem";
2525

26-
message SeedRequest{
26+
message SeedRequest {
2727
string task_id = 1 [(validate.rules).string.min_len = 1];
2828
string url = 2 [(validate.rules).string.uri = true];
2929
common.UrlMeta url_meta = 3;
3030
}
3131

3232
// keep piece meta and data separately
3333
// check piece md5, md5s sign and total content length
34-
message PieceSeed{
34+
message PieceSeed {
3535
// reuse already downloaded peer
3636
bool reuse = 1;
3737
// peer id for cdn node, need suffix with _CDN
@@ -55,12 +55,11 @@ message PieceSeed{
5555
}
5656

5757
// CDN System RPC Service
58-
service Seeder{
58+
service Seeder {
5959
// Generate seeds and return to scheduler
60-
rpc ObtainSeeds(SeedRequest)returns(stream PieceSeed);
60+
rpc ObtainSeeds(SeedRequest) returns (stream PieceSeed);
6161
// Get piece tasks from cdn
62-
rpc GetPieceTasks(common.PieceTaskRequest)returns(common.PiecePacket);
62+
rpc GetPieceTasks(common.PieceTaskRequest) returns (common.PiecePacket);
6363
// Sync piece tasks with other peers
64-
rpc SyncPieceTasks(stream common.PieceTaskRequest)returns(stream common.PiecePacket);
64+
rpc SyncPieceTasks(stream common.PieceTaskRequest) returns (stream common.PiecePacket);
6565
}
66-

pkg/apis/common/v1/common.proto

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,17 @@ enum SizeScope {
104104

105105
// TaskType represents type of task.
106106
enum TaskType {
107-
// Normal is normal type of task,
108-
// normal task is a normal p2p task.
107+
// Normal is normal type of task,
108+
// normal task is a normal p2p task.
109109
Normal = 0;
110110

111-
// DfCache is dfcache type of task,
112-
// dfcache task is a cache task, and the task url is fake url.
113-
// It can only be used for caching and cannot be downloaded back to source.
111+
// DfCache is dfcache type of task,
112+
// dfcache task is a cache task, and the task url is fake url.
113+
// It can only be used for caching and cannot be downloaded back to source.
114114
DfCache = 1;
115115

116-
// DfStore is dfstore type of task,
117-
// dfstore task is a persistent task in backend.
116+
// DfStore is dfstore type of task,
117+
// dfstore task is a persistent task in backend.
118118
DfStore = 2;
119119
}
120120

@@ -163,11 +163,17 @@ message GrpcDfError {
163163
// UrlMeta describes url meta info.
164164
message UrlMeta {
165165
// Digest checks integrity of url content, for example md5:xxx or sha256:yyy.
166-
string digest = 1 [(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})$", ignore_empty:true}];
166+
string digest = 1 [(validate.rules).string = {
167+
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})$"
168+
ignore_empty: true
169+
}];
167170
// URL tag identifies different task for same url, conflict with digest.
168171
string tag = 2;
169172
// Content range for url.
170-
string range = 3 [(validate.rules).string = {pattern: "^[0-9]+-[0-9]*$", ignore_empty:true}];
173+
string range = 3 [(validate.rules).string = {
174+
pattern: "^[0-9]+-[0-9]*$"
175+
ignore_empty: true
176+
}];
171177
// Filter url used to generate task id.
172178
string filter = 4;
173179
// Other url header infos.
@@ -195,14 +201,17 @@ message PieceInfo {
195201
int32 piece_num = 1;
196202
uint64 range_start = 2 [(validate.rules).uint64.gte = 0];
197203
uint32 range_size = 3 [(validate.rules).uint32.gte = 0];
198-
string piece_md5 = 4 [(validate.rules).string = {pattern:"([a-f\\d]{32}|[A-F\\d]{32}|[a-f\\d]{16}|[A-F\\d]{16})", ignore_empty:true}];
204+
string piece_md5 = 4 [(validate.rules).string = {
205+
pattern: "([a-f\\d]{32}|[A-F\\d]{32}|[a-f\\d]{16}|[A-F\\d]{16})"
206+
ignore_empty: true
207+
}];
199208
uint64 piece_offset = 5 [(validate.rules).uint64.gte = 0];
200209
PieceStyle piece_style = 6;
201210
// Cost of the downloading.
202211
uint64 download_cost = 7 [(validate.rules).uint64.gte = 0];
203212
}
204213

205-
// ExtendAttribute is extend attribute.
214+
// ExtendAttribute is extend attribute.
206215
message ExtendAttribute {
207216
// Task response header, eg: HTTP Response Header.
208217
map<string, string> header = 1;
@@ -238,13 +247,25 @@ message Host {
238247
// Peer hostname.
239248
string hostname = 3 [(validate.rules).string.hostname = true];
240249
// Port of grpc service.
241-
int32 port = 4 [(validate.rules).int32 = {gte: 1024, lt: 65535}];
250+
int32 port = 4 [(validate.rules).int32 = {
251+
gte: 1024
252+
lt: 65535
253+
}];
242254
// Port of download server.
243-
int32 download_port = 5 [(validate.rules).int32 = {gte: 1024, lt: 65535}];
255+
int32 download_port = 5 [(validate.rules).int32 = {
256+
gte: 1024
257+
lt: 65535
258+
}];
244259
// Host location, eg: area|country|province|city.
245-
string location = 7 [(validate.rules).string = {min_len: 1, ignore_empty: true}];
260+
string location = 7 [(validate.rules).string = {
261+
min_len: 1
262+
ignore_empty: true
263+
}];
246264
// IDC where the peer host is located.
247-
string idc = 8 [(validate.rules).string = {min_len: 1, ignore_empty: true}];
265+
string idc = 8 [(validate.rules).string = {
266+
min_len: 1
267+
ignore_empty: true
268+
}];
248269
// Port of proxy server.
249270
int32 proxy_port = 9;
250271
}

pkg/apis/dfdaemon/v1/dfdaemon.pb.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/dfdaemon/v1/dfdaemon.proto

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ syntax = "proto3";
1818

1919
package dfdaemon;
2020

21-
import "pkg/apis/common/v1/common.proto";
2221
import "google/protobuf/empty.proto";
22+
import "pkg/apis/common/v1/common.proto";
2323
import "validate/validate.proto";
2424

2525
option go_package = "d7y.io/api/v2/pkg/apis/dfdaemon/v1;dfdaemon";
2626

27-
message DownRequest{
27+
message DownRequest {
2828
// Identify one downloading, the framework will fill it automatically.
2929
// Deprecated
3030
string uuid = 1;
@@ -51,7 +51,7 @@ message DownRequest{
5151
bool recursive = 13;
5252
}
5353

54-
message DownResult{
54+
message DownResult {
5555
// Task id.
5656
string task_id = 2 [(validate.rules).string.min_len = 1];
5757
// Peer id.
@@ -64,7 +64,7 @@ message DownResult{
6464
string output = 6;
6565
}
6666

67-
message StatTaskRequest{
67+
message StatTaskRequest {
6868
// Download url.
6969
string url = 1 [(validate.rules).string.min_len = 1];
7070
// URL meta info.
@@ -73,7 +73,7 @@ message StatTaskRequest{
7373
bool local_only = 3;
7474
}
7575

76-
message ImportTaskRequest{
76+
message ImportTaskRequest {
7777
// Download url.
7878
string url = 1 [(validate.rules).string.min_len = 1];
7979
// URL meta info.
@@ -84,7 +84,7 @@ message ImportTaskRequest{
8484
common.TaskType type = 4;
8585
}
8686

87-
message ExportTaskRequest{
87+
message ExportTaskRequest {
8888
// Download url.
8989
string url = 1 [(validate.rules).string.min_len = 1];
9090
// Output path of downloaded file.
@@ -103,7 +103,7 @@ message ExportTaskRequest{
103103
bool local_only = 9;
104104
}
105105

106-
message DeleteTaskRequest{
106+
message DeleteTaskRequest {
107107
// Download url.
108108
string url = 1 [(validate.rules).string.min_len = 1];
109109
// URL meta info.
@@ -128,29 +128,29 @@ message PeerMetadata {
128128

129129
// PeerExchangeData represents metadata of peer tasks.
130130
message PeerExchangeData {
131-
repeated PeerMetadata PeerMetadatas= 1;
131+
repeated PeerMetadata PeerMetadatas = 1;
132132
}
133133

134134
// Daemon Client RPC Service
135-
service Daemon{
135+
service Daemon {
136136
// Trigger client to download file
137-
rpc Download(DownRequest) returns(stream DownResult);
137+
rpc Download(DownRequest) returns (stream DownResult);
138138
// Get piece tasks from other peers
139-
rpc GetPieceTasks(common.PieceTaskRequest)returns(common.PiecePacket);
139+
rpc GetPieceTasks(common.PieceTaskRequest) returns (common.PiecePacket);
140140
// Check daemon health
141-
rpc CheckHealth(google.protobuf.Empty)returns(google.protobuf.Empty);
141+
rpc CheckHealth(google.protobuf.Empty) returns (google.protobuf.Empty);
142142
// Sync piece tasks with other peers
143-
rpc SyncPieceTasks(stream common.PieceTaskRequest)returns(stream common.PiecePacket);
143+
rpc SyncPieceTasks(stream common.PieceTaskRequest) returns (stream common.PiecePacket);
144144
// Check if given task exists in P2P cache system
145-
rpc StatTask(StatTaskRequest) returns(google.protobuf.Empty);
145+
rpc StatTask(StatTaskRequest) returns (google.protobuf.Empty);
146146
// Import the given file into P2P cache system
147-
rpc ImportTask(ImportTaskRequest) returns(google.protobuf.Empty);
147+
rpc ImportTask(ImportTaskRequest) returns (google.protobuf.Empty);
148148
// Export or download file from P2P cache system
149-
rpc ExportTask(ExportTaskRequest) returns(google.protobuf.Empty);
149+
rpc ExportTask(ExportTaskRequest) returns (google.protobuf.Empty);
150150
// Delete file from P2P cache system
151-
rpc DeleteTask(DeleteTaskRequest) returns(google.protobuf.Empty);
151+
rpc DeleteTask(DeleteTaskRequest) returns (google.protobuf.Empty);
152152
// LeaveHost releases host in scheduler.
153-
rpc LeaveHost(google.protobuf.Empty)returns(google.protobuf.Empty);
153+
rpc LeaveHost(google.protobuf.Empty) returns (google.protobuf.Empty);
154154
// Exchange peers between daemons
155-
rpc PeerExchange(stream PeerExchangeData)returns(stream PeerExchangeData);
155+
rpc PeerExchange(stream PeerExchangeData) returns (stream PeerExchangeData);
156156
}

pkg/apis/dfdaemon/v2/dfdaemon.pb.go

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)