-
Notifications
You must be signed in to change notification settings - Fork 21
/
ezio.proto
113 lines (98 loc) · 2.25 KB
/
ezio.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
syntax = "proto3";
package ezio;
message Empty {
}
// Same as libtorrent torrent_status
message Torrent {
// hex sha1 hash lowercase
string hash = 1;
// torrent name
string name = 2;
// float point number bewteen [0, 1]
double progress = 3;
// download rate byte per second
int64 download_rate = 4;
// upload rate byte per second
int64 upload_rate = 5;
// active time
int64 active_time = 6;
// is_finished
bool is_finished = 7;
// num_peers connected to
int64 num_peers = 8;
// state
int64 state = 9;
// total done byte
int64 total_done = 10;
// total byte
int64 total = 11;
// finished piece num
int64 num_pieces = 12;
// finished time
int64 finished_time = 13;
// seeding time
int64 seeding_time = 14;
// total download
int64 total_payload_download = 15;
// total upload
int64 total_payload_upload = 16;
// is paused
bool is_paused = 17;
// save_path
string save_path = 18;
// last_upload
int64 last_upload = 19;
// last_download
int64 last_download = 20;
}
message AddRequest {
// torrent file
bytes torrent = 1;
// save path, here is disk or partition path
string save_path = 2;
// force seed mode
bool seeding_mode = 3;
// max upload connection
int32 max_uploads = 4;
// max total connection
int32 max_connections = 5;
// force sequential download
bool sequential_download = 6;
}
message AddResponse {
bool result = 1;
}
message UpdateRequest {
// update status only in hashs, if empty update all
// lowercase hex sha1 hash
repeated string hashes = 1;
}
message UpdateStatus {
// lowercase hex sha1 hash
repeated string hashes = 1;
map<string, Torrent> torrents = 2;
}
message PauseTorrentRequest {
// lowercase hex sha1 hash
string hash = 1;
}
message PauseTorrentResponse {
}
message ResumeTorrentRequest {
// lowercase hex sha1 hash
string hash = 1;
}
message ResumeTorrentResponse {
}
message VersionResponse {
// version
string version = 1;
}
service EZIO {
rpc Shutdown(Empty) returns (Empty) {}
rpc GetTorrentStatus(UpdateRequest) returns (UpdateStatus) {}
rpc AddTorrent(AddRequest) returns (AddResponse) {}
rpc PauseTorrent(PauseTorrentRequest) returns (PauseTorrentResponse) {}
rpc ResumeTorrent(ResumeTorrentRequest) returns (ResumeTorrentResponse) {}
rpc GetVersion(Empty) returns (VersionResponse) {}
}