-
Notifications
You must be signed in to change notification settings - Fork 134
/
Copy pathconfigpb.proto
153 lines (131 loc) · 3.02 KB
/
configpb.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
syntax = "proto3";
package configpb;
import "gogoproto/gogo.proto";
import "rustproto.proto";
import "google/api/annotations.proto";
option (gogoproto.sizer_all) = true;
option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;
option (rustproto.lite_runtime_all) = true;
service Config {
rpc Create(CreateRequest) returns (CreateResponse) {}
rpc GetAll(GetAllRequest) returns (GetAllResponse) {}
rpc Get(GetRequest) returns (GetResponse) {
option (google.api.http) = {
get: "/component"
};
}
rpc Update(UpdateRequest) returns (UpdateResponse) {
option (google.api.http) = {
post: "/component"
body: "*"
};
}
rpc Delete(DeleteRequest) returns (DeleteResponse) {
option (google.api.http) = {
delete: "/component"
};
}
}
enum StatusCode {
UNKNOWN = 0;
OK = 1;
WRONG_VERSION = 2;
NOT_CHANGE = 3;
COMPONENT_NOT_FOUND = 4;
COMPONENT_ID_NOT_FOUND = 5;
}
message Status {
StatusCode code = 1;
string message = 2;
}
// The version is used to tell the configuration which can be shared
// or not apart.
// Global version represents the version of these configuration
// which can be shared, each kind of component only have one.
// For local version, every component will have one to represent
// the version of these configuration which cannot be shared.
message Version {
uint64 local = 1;
uint64 global = 2;
}
message Local {
string component_id = 1;
}
message Global {
string component = 1;
}
message ConfigKind {
oneof kind {
Local local = 1;
Global global = 2;
}
}
message ConfigEntry {
string name = 1;
string value = 2;
}
message LocalConfig {
Version version = 1;
string component = 2;
string component_id = 3;
string config = 4;
}
message Header {
uint64 cluster_id = 1;
}
message CreateRequest {
Header header = 1;
Version version = 2;
string component = 3;
string component_id = 4;
string config = 5;
}
message CreateResponse {
Header header = 1;
Status status = 2;
Version version = 3;
string config = 4;
}
message GetAllRequest {
Header header = 1;
}
message GetAllResponse {
Header header = 1;
Status status = 2;
repeated LocalConfig local_configs = 3;
}
message GetRequest {
Header header = 1;
Version version = 2;
string component = 3;
string component_id = 4;
}
message GetResponse {
Header header = 1;
Status status = 2;
Version version = 3;
string config = 4;
}
message UpdateRequest {
Header header = 1;
Version version = 2;
ConfigKind kind = 3;
repeated ConfigEntry entries = 4;
}
message UpdateResponse {
Header header = 1;
Status status = 2;
Version version = 3;
string config = 4;
}
message DeleteRequest {
Header header = 1;
Version version = 2;
ConfigKind kind = 3;
}
message DeleteResponse {
Header header = 1;
Status status = 2;
Version version = 3;
}