This repository has been archived by the owner on Nov 4, 2019. It is now read-only.
/
leverrpc.proto
81 lines (70 loc) · 2.24 KB
/
leverrpc.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
syntax = "proto3";
option java_package = "com.leveros.core";
package core;
// LeverRPC handles Lever's RPC calls between Lever services.
service LeverRPC {
rpc HandleRPC (RPC) returns (RPCReply) {}
rpc HandleStreamingRPC (stream StreamMessage) returns (
stream StreamMessage) {}
}
// RPC is the message used to invoke a Lever service's method.
message RPC {
oneof args_oneof {
// args is a list of JSON values which will populate the arguments of
// the method being invoked.
JSONArray args = 1;
// byte_args is a single opaque field which can be used for custom
// encoding of args by applications.
bytes byte_args = 2;
}
}
// StreamMessage represents individual messages sent in a streaming RPC call.
// These may be either sent or received.
message StreamMessage {
// Note that the invokation details (rpc field) are part of the very first
// message sent by the client. It is an error for any other message to have
// that field set.
// Also, the very first message sent by the server must be an empty
// message. This is a workaround for some reverse-proxies which do funny
// things if there's no data frame.
oneof message_oneof {
// First message, client-to-server only.
RPC rpc = 1;
// Non-first messages.
// These are passed to the Lever application's handlers.
JSON message = 2;
bytes byte_message = 3;
JSON error = 4;
bytes byte_error = 5;
}
}
// RPCReply is used as a return value for a Lever RPC method invokation.
message RPCReply {
oneof result_oneof {
JSON result = 1;
bytes byte_result = 2;
JSON error = 3;
bytes byte_error = 4;
}
}
// JSON represents a JSON-like value, which is represented as a proto message.
message JSON {
// Note: If none are set then the value is null.
oneof json_value_oneof {
string json_string = 1;
double json_number = 2;
bool json_bool = 3;
JSONObject json_object = 4;
JSONArray json_array = 5;
}
}
message JSONObject {
repeated JSONProperty property = 1;
}
message JSONArray {
repeated JSON element = 1;
}
message JSONProperty {
string name = 1;
JSON value = 2;
}