forked from irinazheltisheva/powergate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrpc.proto
More file actions
444 lines (357 loc) · 8.41 KB
/
rpc.proto
File metadata and controls
444 lines (357 loc) · 8.41 KB
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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
syntax = "proto3";
package ffs.rpc;
option go_package = "github.com/textileio/powergate/ffs/rpc";
// model messages
// ------------------------------------
message AddrInfo {
string name = 1;
string addr = 2;
string type = 3;
}
message IpfsConfig {
int64 add_timeout = 1;
}
message HotConfig {
bool enabled = 1;
bool allow_unfreeze = 2;
uint64 unfreeze_max_price = 3;
IpfsConfig ipfs = 4;
}
message FilRenew {
bool enabled = 1;
int64 threshold = 2;
}
message FilConfig {
int64 rep_factor = 1;
int64 deal_min_duration = 2;
repeated string excluded_miners = 3;
repeated string trusted_miners = 4;
repeated string country_codes = 5;
FilRenew renew = 6;
string addr = 7;
uint64 max_price = 8;
bool fast_retrieval = 9;
}
message ColdConfig {
bool enabled = 1;
FilConfig filecoin = 2;
}
message StorageConfig {
HotConfig hot = 1;
ColdConfig cold = 2;
bool repairable = 3;
}
message IpfsHotInfo {
int64 created = 1;
}
message HotInfo {
bool enabled = 1;
int64 size = 2;
IpfsHotInfo ipfs = 3;
}
message FilStorage {
string proposal_cid = 1;
bool renewed = 2;
int64 duration = 3;
int64 activation_epoch = 4;
uint64 start_epoch = 5;
string miner = 6;
uint64 epoch_price = 7;
string piece_cid = 8;
}
message FilInfo {
string data_cid = 1;
uint64 size = 2;
repeated FilStorage proposals = 3;
}
message ColdInfo {
bool enabled = 1;
FilInfo filecoin = 2;
}
message CidInfo {
string job_id = 1;
string cid = 2;
int64 created = 3;
HotInfo hot = 4;
ColdInfo cold = 5;
}
message BalanceInfo {
AddrInfo addr = 1;
int64 balance = 2;
}
message InstanceInfo {
string id = 1;
StorageConfig default_storage_config = 2;
repeated BalanceInfo balances = 3;
repeated string pins = 4;
}
enum JobStatus {
JOB_STATUS_UNSPECIFIED = 0;
JOB_STATUS_QUEUED = 1;
JOB_STATUS_EXECUTING = 2;
JOB_STATUS_FAILED = 3;
JOB_STATUS_CANCELED = 4;
JOB_STATUS_SUCCESS = 5;
}
message Job {
string id = 1;
string api_id = 2;
string cid = 3;
JobStatus status = 4;
string err_cause = 5;
repeated DealError deal_errors = 6;
}
message DealError {
string proposal_cid = 1;
string miner = 2;
string message = 3;
}
message LogEntry {
string cid = 1;
string jid = 2;
int64 time = 3;
string msg = 4;
}
enum Direction {
DIRECTION_UNSPECIFIED = 0;
DIRECTION_INBOUND = 1;
DIRECTION_OUTBOUND = 2;
}
message PaychInfo {
string ctl_addr = 1;
string addr = 2;
Direction direction = 3;
}
message ListDealRecordsConfig {
repeated string from_addrs = 1;
repeated string data_cids = 2;
bool include_pending = 3;
bool include_final = 4;
bool ascending = 5;
}
message StorageDealInfo {
string proposal_cid = 1;
uint64 state_id = 2;
string state_name = 3;
string miner = 4;
string piece_cid = 5;
uint64 size = 6;
uint64 price_per_epoch = 7;
uint64 start_epoch = 8;
uint64 duration = 9;
uint64 deal_id = 10;
int64 activation_epoch = 11;
string msg = 12;
}
message StorageDealRecord {
string root_cid = 1;
string addr = 2;
int64 time = 3;
bool pending = 4;
StorageDealInfo deal_info = 5;
}
message RetrievalDealInfo {
string root_cid = 1;
uint64 size = 2;
uint64 min_price = 3;
uint64 payment_interval = 4;
uint64 payment_interval_increase = 5;
string miner = 6;
string miner_peer_id = 7;
}
message RetrievalDealRecord {
string addr = 1;
int64 time = 2;
RetrievalDealInfo deal_info = 3;
}
// request/reply messages
// -------------------------------------
message CreateRequest {
}
message CreateResponse {
string id = 1;
string token = 2;
}
message ListAPIRequest {
}
message ListAPIResponse {
repeated string instances = 1;
}
message IDRequest {
}
message IDResponse {
string id = 1;
}
message AddrsRequest {
}
message AddrsResponse {
repeated AddrInfo addrs = 1;
}
message DefaultStorageConfigRequest {
}
message DefaultStorageConfigResponse {
StorageConfig default_storage_config = 1;
}
message NewAddrRequest {
string name = 1;
string address_type = 2;
bool make_default = 3;
}
message NewAddrResponse {
string addr = 1;
}
message GetStorageConfigRequest {
string cid = 1;
}
message GetStorageConfigResponse {
StorageConfig config = 1;
}
message SetDefaultStorageConfigRequest {
StorageConfig config = 1;
}
message SetDefaultStorageConfigResponse {
}
message ShowRequest {
string cid = 1;
}
message ShowResponse {
CidInfo cid_info = 1;
}
message InfoRequest {
}
message InfoResponse {
InstanceInfo info = 1;
}
message CancelJobRequest {
string jid = 1;
}
message CancelJobResponse {
}
message GetStorageJobRequest {
string jid = 1;
}
message GetStorageJobResponse {
Job job = 1;
}
message WatchJobsRequest {
repeated string jids = 1;
}
message WatchJobsResponse {
Job job = 1;
}
message WatchLogsRequest {
string cid = 1;
string jid = 2;
bool history = 3;
}
message WatchLogsResponse {
LogEntry log_entry = 1;
}
message ReplaceRequest {
string cid1 = 1;
string cid2 = 2;
}
message ReplaceResponse {
string job_id = 1;
}
message PushStorageConfigRequest {
string cid = 1;
StorageConfig config = 2;
bool has_config = 3;
bool override_config = 4;
bool has_override_config = 5;
}
message PushStorageConfigResponse {
string job_id = 1;
}
message RemoveRequest {
string cid = 1;
}
message RemoveResponse {
}
message GetRequest {
string cid = 1;
}
message GetResponse {
bytes chunk = 1;
}
message SendFilRequest {
string from = 1;
string to = 2;
int64 amount = 3;
}
message SendFilResponse {
}
message StageRequest {
bytes chunk = 1;
}
message StageResponse {
string cid = 1;
}
message ListPayChannelsRequest {
}
message ListPayChannelsResponse {
repeated PaychInfo pay_channels = 1;
}
message CreatePayChannelRequest {
string from = 1;
string to = 2;
uint64 amount = 3;
}
message CreatePayChannelResponse {
PaychInfo pay_channel = 1;
string channel_message_cid = 2;
}
message RedeemPayChannelRequest {
string pay_channel_addr = 1;
}
message RedeemPayChannelResponse {
}
message ListStorageDealRecordsRequest {
ListDealRecordsConfig config = 1;
}
message ListStorageDealRecordsResponse {
repeated StorageDealRecord records = 1;
}
message ListRetrievalDealRecordsRequest {
ListDealRecordsConfig config = 1;
}
message ListRetrievalDealRecordsResponse {
repeated RetrievalDealRecord records = 1;
}
message ShowAllRequest {
}
message ShowAllResponse {
repeated CidInfo cid_infos = 1;
}
service RPCService {
// Admin
rpc Create(CreateRequest) returns (CreateResponse) {}
rpc ListAPI(ListAPIRequest) returns (ListAPIResponse) {}
// Instance
rpc ID(IDRequest) returns (IDResponse) {}
rpc Addrs(AddrsRequest) returns (AddrsResponse) {}
rpc DefaultStorageConfig(DefaultStorageConfigRequest) returns (DefaultStorageConfigResponse) {}
rpc NewAddr(NewAddrRequest) returns (NewAddrResponse) {}
rpc GetStorageConfig(GetStorageConfigRequest) returns (GetStorageConfigResponse) {}
rpc SetDefaultStorageConfig(SetDefaultStorageConfigRequest) returns (SetDefaultStorageConfigResponse) {}
rpc Show(ShowRequest) returns (ShowResponse) {}
rpc Info(InfoRequest) returns (InfoResponse) {}
rpc CancelJob(CancelJobRequest) returns (CancelJobResponse) {}
rpc GetStorageJob(GetStorageJobRequest) returns (GetStorageJobResponse) {}
rpc WatchJobs(WatchJobsRequest) returns (stream WatchJobsResponse) {}
rpc WatchLogs(WatchLogsRequest) returns (stream WatchLogsResponse){}
rpc Replace(ReplaceRequest) returns (ReplaceResponse) {}
rpc PushStorageConfig(PushStorageConfigRequest) returns (PushStorageConfigResponse) {}
rpc Remove(RemoveRequest) returns (RemoveResponse) {}
rpc Get(GetRequest) returns (stream GetResponse) {}
rpc SendFil(SendFilRequest) returns (SendFilResponse) {}
rpc Stage(stream StageRequest) returns (StageResponse) {}
rpc ListPayChannels(ListPayChannelsRequest) returns (ListPayChannelsResponse) {}
rpc CreatePayChannel(CreatePayChannelRequest) returns (CreatePayChannelResponse) {}
rpc RedeemPayChannel(RedeemPayChannelRequest) returns (RedeemPayChannelResponse) {}
rpc ListStorageDealRecords(ListStorageDealRecordsRequest) returns (ListStorageDealRecordsResponse) {}
rpc ListRetrievalDealRecords(ListRetrievalDealRecordsRequest) returns (ListRetrievalDealRecordsResponse) {}
// UI support
rpc ShowAll(ShowAllRequest) returns (ShowAllResponse) {}
}