-
Notifications
You must be signed in to change notification settings - Fork 2
/
psh.proto
86 lines (71 loc) · 2.13 KB
/
psh.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
syntax = "proto3";
package psh;
service PshService {
rpc SendHostInfo(HostInfoRequest) returns (HostInfoResponse);
rpc SendData(DataRequest) returns (DataResponse);
}
message Ipv6Addr {
// high 64 bits part of big-endian ipv6 address
fixed64 hi_64_bits = 1;
// low 64 bits part of big-endian ipv6 address
fixed64 lo_64_bits = 2;
}
message HostInfoRequest {
// This field should be empty if it is the first time the instance connected
// to the server, and the server will returns an `instance_id` in response.
// If this field contains a value, the server will use this to identify the
// machine instance.
optional string instance_id = 1;
// The following field can be empty if this request is used for heartbeat.
// If any of them contains a value, the instance info on the server side will
// be updated.
optional string os = 2;
optional string architecture = 3;
optional string hostname = 4;
optional string kernel_version = 5;
optional fixed32 local_ipv4_addr = 6; // big-endian
optional Ipv6Addr local_ipv6_addr = 7; // big-endian
// True if ready to receive and execute WASM component
bool idle = 8;
// Contains finished task id
optional string task_id = 9;
}
message HostInfoResponse {
// Empty if no error
optional int64 errno = 1;
// Not empty if and only if the request has no `instance_id`.
optional string instance_id = 2;
optional string message = 3;
// If request `idle` is true, the remote server will send the task if needed.
optional Task task = 4;
}
message Task {
string id = 1;
bytes wasm = 2;
repeated string wasm_args = 3;
// Number of non-leap-milliseconds since Jan 1, 1970 UTC.
uint64 end_time = 4;
}
message DataRequest {
string task_id = 1;
Metadata metadata = 2;
bytes payload = 3;
}
message Metadata {
// Data type
string type = 1;
// Data size of bytes
uint64 size = 2;
// Metric metadata
optional MetricMeta metric_meta = 3;
}
message MetricMeta {
uint64 start_time = 1;
uint64 end_time = 2;
// Mapping from keys to types
map<string, string> key_type = 3;
}
message DataResponse {
// Empty if no error
optional int64 errno = 1;
}