forked from dragonflyoss/api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdfdaemon.proto
249 lines (207 loc) · 8.11 KB
/
dfdaemon.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
/*
* Copyright 2022 The Dragonfly Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
syntax = "proto3";
package dfdaemon.v2;
import "common.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/empty.proto";
// DownloadTaskRequest represents request of DownloadTask.
message DownloadTaskRequest {
// Download information.
common.v2.Download download = 1;
}
// DownloadTaskStartedResponse represents task download started response of DownloadTaskResponse.
message DownloadTaskStartedResponse {
// Task content length.
uint64 content_length = 1;
// Range is url range of request. If protocol is http, range
// is parsed from http header. If other protocol, range comes
// from download range field.
optional common.v2.Range range = 2;
// Task response headers.
map<string, string> response_header = 3;
// Need to download pieces.
repeated common.v2.Piece pieces = 4;
}
// DownloadPieceFinishedResponse represents piece download finished response of DownloadTaskResponse.
message DownloadPieceFinishedResponse {
// Finished piece of task.
common.v2.Piece piece = 1;
}
// DownloadTaskResponse represents response of DownloadTask.
message DownloadTaskResponse {
// Host id.
string host_id = 1;
// Task id.
string task_id = 2;
// Peer id.
string peer_id = 3;
oneof response {
DownloadTaskStartedResponse download_task_started_response = 4;
DownloadPieceFinishedResponse download_piece_finished_response = 5;
}
}
// SyncPiecesRequest represents request of SyncPieces.
message SyncPiecesRequest {
// Host id.
string host_id = 1;
// Task id.
string task_id = 2;
// Interested piece numbers.
repeated uint32 interested_piece_numbers = 3;
}
// SyncPiecesResponse represents response of SyncPieces.
message SyncPiecesResponse {
// Exist piece number.
uint32 number = 1;
// Piece offset.
uint64 offset = 2;
// Piece length.
uint64 length = 3;
}
// DownloadPieceRequest represents request of DownloadPiece.
message DownloadPieceRequest{
// Host id.
string host_id = 1;
// Task id.
string task_id = 2;
// Piece number.
uint32 piece_number = 3;
}
// DownloadPieceResponse represents response of DownloadPieces.
message DownloadPieceResponse {
// Piece information.
common.v2.Piece piece = 1;
}
// StatTaskRequest represents request of StatTask.
message StatTaskRequest {
// Task id.
string task_id = 1;
}
// DeleteTaskRequest represents request of DeleteTask.
message DeleteTaskRequest {
// Task id.
string task_id = 1;
}
// DownloadPersistentCacheTaskRequest represents request of DownloadPersistentCacheTask.
message DownloadPersistentCacheTaskRequest {
// Task id.
string task_id = 1;
// 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 = 2;
// Tag is used to distinguish different persistent cache tasks.
optional string tag = 3;
// Application of task.
optional string application = 4;
// File path to be exported.
optional string output_path = 5;
// Download timeout.
optional google.protobuf.Duration timeout = 6;
// need_piece_content is the flag to indicate whether the response needs to return piece content.
bool need_piece_content = 7;
}
// DownloadPersistentCacheTaskStartedResponse represents task download started response of DownloadPersistentCacheTaskResponse.
message DownloadPersistentCacheTaskStartedResponse {
// Task content length.
uint64 content_length = 1;
}
// DownloadPersistentCacheTaskResponse represents response of DownloadPersistentCacheTask.
message DownloadPersistentCacheTaskResponse {
// Host id.
string host_id = 1;
// Task id.
string task_id = 2;
// Peer id.
string peer_id = 3;
oneof response {
DownloadPersistentCacheTaskStartedResponse download_persistent_cache_task_started_response = 4;
DownloadPieceFinishedResponse download_piece_finished_response = 5;
}
}
// UploadPersistentCacheTaskRequest represents request of UploadPersistentCacheTask.
message UploadPersistentCacheTaskRequest {
// Upload file path of persistent cache task.
string path = 1;
// Replica count of the persistent persistent cache task.
uint64 persistent_replica_count = 2;
// Tag is used to distinguish different persistent cache tasks.
optional string tag = 3;
// Application of task.
optional string application = 4;
// TTL of the persistent cache task.
google.protobuf.Duration ttl = 5;
// Upload timeout.
optional google.protobuf.Duration timeout = 6;
}
// StatPersistentCacheTaskRequest represents request of StatPersistentCacheTask.
message StatPersistentCacheTaskRequest {
// Task id.
string task_id = 1;
}
// DeletePersistentCacheTaskRequest represents request of DeletePersistentCacheTask.
message DeletePersistentCacheTaskRequest {
// Task id.
string task_id = 1;
}
// SyncHostRequest represents request of SyncHost.
message SyncHostRequest {
// Host id.
string host_id = 1;
// Peer id.
string peer_id = 2;
}
// DfdaemonUpload represents upload service of dfdaemon.
service DfdaemonUpload{
// DownloadTask downloads task from p2p network.
rpc DownloadTask(DownloadTaskRequest) returns(stream DownloadTaskResponse);
// StatTask stats task information.
rpc StatTask(StatTaskRequest) returns(common.v2.Task);
// DeleteTask deletes task from p2p network.
rpc DeleteTask(DeleteTaskRequest) returns(google.protobuf.Empty);
// SyncPieces syncs piece metadatas from remote peer.
rpc SyncPieces(SyncPiecesRequest) returns(stream SyncPiecesResponse);
// DownloadPiece downloads piece from the remote peer.
rpc DownloadPiece(DownloadPieceRequest)returns(DownloadPieceResponse);
// DownloadPersistentCacheTask downloads persistent cache task from p2p network.
rpc DownloadPersistentCacheTask(DownloadPersistentCacheTaskRequest) returns(stream DownloadPersistentCacheTaskResponse);
// StatPersistentCacheTask stats persistent cache task information.
rpc StatPersistentCacheTask(StatPersistentCacheTaskRequest) returns(common.v2.PersistentCacheTask);
// DeletePersistentCacheTask deletes persistent cache task from p2p network.
rpc DeletePersistentCacheTask(DeletePersistentCacheTaskRequest) returns(google.protobuf.Empty);
// SyncHost sync host info from parents.
rpc SyncHost(SyncHostRequest) returns (stream common.v2.Host);
}
// DfdaemonDownload represents download service of dfdaemon.
service DfdaemonDownload{
// DownloadTask downloads task from p2p network.
rpc DownloadTask(DownloadTaskRequest) returns(stream DownloadTaskResponse);
// StatTask stats task information.
rpc StatTask(StatTaskRequest) returns(common.v2.Task);
// DeleteTask deletes task from p2p network.
rpc DeleteTask(DeleteTaskRequest) returns(google.protobuf.Empty);
// DeleteHost releases host in scheduler.
rpc DeleteHost(google.protobuf.Empty)returns(google.protobuf.Empty);
// DownloadPersistentCacheTask downloads persistent cache task from p2p network.
rpc DownloadPersistentCacheTask(DownloadPersistentCacheTaskRequest) returns(stream DownloadPersistentCacheTaskResponse);
// UploadPersistentCacheTask uploads persistent cache task to p2p network.
rpc UploadPersistentCacheTask(UploadPersistentCacheTaskRequest) returns(common.v2.PersistentCacheTask);
// StatPersistentCacheTask stats persistent cache task information.
rpc StatPersistentCacheTask(StatPersistentCacheTaskRequest) returns(common.v2.PersistentCacheTask);
// DeletePersistentCacheTask deletes persistent cache task from p2p network.
rpc DeletePersistentCacheTask(DeletePersistentCacheTaskRequest) returns(google.protobuf.Empty);
}