-
Notifications
You must be signed in to change notification settings - Fork 2
/
topology.proto
537 lines (443 loc) · 14.2 KB
/
topology.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
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
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
// Copyright (c) 2024 dingodb.com, Inc. All Rights Reserved
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
syntax="proto2";
import "heartbeat.proto";
import "common.proto";
package dingofs.pb.mds.topology;
option cc_generic_services = true;
option go_package = "dingofs/proto/topology";
enum TopoStatusCode {
TOPO_OK = 0;
TOPO_INTERNAL_ERROR = 1;
TOPO_INVALID_PARAM = 2;
TOPO_INIT_FAIL = 3;
TOPO_STORGE_FAIL = 4;
TOPO_ID_DUPLICATED = 5;
TOPO_METASERVER_NOT_FOUND = 6;
TOPO_SERVER_NOT_FOUND = 7;
TOPO_ZONE_NOT_FOUND = 8;
TOPO_POOL_NOT_FOUND = 9;
TOPO_COPYSET_NOT_FOUND = 10;
TOPO_CREATE_COPYSET_ERROR = 11;
TOPO_ALLOCATE_ID_FAIL = 12;
TOPO_CANNOT_REMOVE_WHEN_NOT_EMPTY = 13;
TOPO_IP_PORT_DUPLICATED = 14;
TOPO_NAME_DUPLICATED = 15;
TOPO_CREATE_COPYSET_ON_METASERVER_FAIL = 16;
TOPO_CANNOT_REMOVE_NOT_OFFLINE = 17;
TOPO_POOL_EXIST = 18;
TOPO_LEADER_NOT_FOUND = 19;
TOPO_PARTITION_NOT_FOUND = 20;
TOPO_CREATE_PARTITION_FAIL = 21;
TOPO_METASERVER_EXIST = 22;
TOPO_GET_AVAILABLE_COPYSET_ERROR = 23;
TOPO_DELETE_PARTITION_ON_METASERVER_FAIL = 24;
TOPO_MEMCACHECLUSTER_NOT_FOUND = 25;
}
enum OnlineState {
ONLINE = 0;
OFFLINE = 1;
UNSTABLE = 2;
}
// etcd struct defination
message ClusterInfoData {
required string clusterId = 1;
// <fsId, partitionIndex of this fs>
map<uint32, uint32> partitionIndexs = 2;
}
message PoolData {
required uint32 PoolId = 1;
required string PoolName = 2;
required uint64 createTime = 3;
required string redundanceAndPlacementPolicy = 4;
}
message ZoneData {
required uint32 zoneId = 1;
required string zoneName = 2;
required uint32 PoolId = 3;
}
message ServerData {
required uint32 serverId = 1;
required string hostName = 2;
required string internalIP = 3;
required uint32 internalPort = 4;
required string externalIP = 5;
required uint32 externalPort = 6;
required uint32 zoneId = 7;
required uint32 PoolId = 8;
}
message MetaServerData {
required uint32 MetaServerId = 1;
required string hostName = 2;
required string token = 3;
required string internalIP = 4;
required uint32 internalPort = 5;
required string externalIP = 6;
required uint32 externalPort = 7;
required uint32 serverId = 8;
required heartbeat.MetaServerSpaceStatus spaceStatus = 9;
}
message CopysetData {
required uint32 copysetId = 1;
required uint32 PoolId = 2;
required uint64 epoch = 3;
repeated uint32 MetaServerIds = 4;
// delete PartitionNumber, for compatibility reasons, don't use number 5
// required uint32 PartitionNumber = 5;
optional bool availFlag = 6;
}
// rpc struct defination
message Copyset {
required uint32 poolId = 1;
required uint32 copysetId = 2;
repeated common.Peer peers = 3;
}
message MetaServerInfo {
required uint32 metaServerID = 1;
required string hostname = 2;
required string internalIp = 3;
required uint32 internalPort = 4;
required string externalIp = 5;
required uint32 externalPort = 6;
required OnlineState onlineState = 7;
optional uint32 serverId = 8;
}
// MetaServer message
message MetaServerRegistRequest {
required string hostName = 1;
required string internalIp = 2;
required uint32 internalPort = 3;
required string externalIp = 4;
required uint32 externalPort = 5;
};
message MetaServerRegistResponse {
required TopoStatusCode statusCode = 1;
optional uint32 metaServerID = 2;
optional string token = 3;
};
message ListMetaServerRequest {
required uint32 serverID = 1;
}
message ListMetaServerResponse {
required TopoStatusCode statusCode = 1;
repeated MetaServerInfo MetaServerInfos = 2;
}
message GetMetaServerInfoRequest {
//use either metaServerID or hostIp&port to query MetaServer
optional uint32 metaServerID = 1;
optional string hostIp = 2;
optional uint32 port = 3;
}
message GetMetaServerInfoResponse {
required TopoStatusCode statusCode = 1;
optional MetaServerInfo MetaServerInfo = 2;
}
message DeleteMetaServerRequest {
required uint32 metaServerID = 1;
}
message DeleteMetaServerResponse {
required TopoStatusCode statusCode = 1;
}
// server message
message ServerInfo {
required uint32 serverID = 1;
required string hostName = 2;
required string internalIp = 3;
required uint32 internalPort = 4;
required string externalIp = 5;
required uint32 externalPort = 6;
required uint32 zoneID = 7;
optional string zoneName = 8;
required uint32 PoolID = 9;
optional string PoolName = 10;
}
message ServerRegistRequest {
required string hostName = 1;
required string internalIp = 2;
optional uint32 internalPort = 3;
required string externalIp = 4;
optional uint32 externalPort = 5;
required string zoneName = 6;
required string PoolName = 7;
}
message ServerRegistResponse {
required TopoStatusCode statusCode = 1;
optional uint32 serverID = 2;
}
message GetServerRequest {
// use either serverID or hostName or hostIp(internalIP or externalIp) to getServer
optional uint32 serverID = 1;
optional string hostName = 2;
optional string hostIp = 3;
optional uint32 port = 4;
}
message GetServerResponse {
required TopoStatusCode statusCode = 1;
optional ServerInfo serverInfo = 2;
}
message DeleteServerRequest {
required uint32 serverID = 1;
}
message DeleteServerResponse {
required TopoStatusCode statusCode = 1;
}
message ListZoneServerRequest {
//user either zoneID or zoneName&PoolName to
//List Servers under the zone
optional uint32 zoneID = 1;
optional string zoneName = 2;
optional string poolName = 3;
}
message ListZoneServerResponse {
required TopoStatusCode statusCode = 1;
repeated ServerInfo serverInfo = 2;
}
// zone message
message ZoneInfo {
required uint32 zoneID = 1;
required string zoneName = 2;
required uint32 PoolID = 3;
optional string PoolName = 4;
}
message CreateZoneRequest {
required string zoneName = 1;
required string PoolName = 2;
}
message CreateZoneResponse {
required TopoStatusCode statusCode = 1;
optional ZoneInfo zoneInfo = 2;
}
message DeleteZoneRequest {
required uint32 zoneID = 1;
}
message DeleteZoneResponse {
required TopoStatusCode statusCode = 1;
}
message GetZoneRequest {
required uint32 zoneID = 1;
}
message GetZoneResponse {
required TopoStatusCode statusCode = 1;
optional ZoneInfo zoneInfo = 2;
}
message ListPoolZoneRequest {
required uint32 poolID = 1;
}
message ListPoolZoneResponse {
required TopoStatusCode statusCode = 1;
repeated ZoneInfo zones = 2;
}
// pool message
message PoolInfo {
required uint32 PoolID = 1;
required string PoolName = 2;
required uint64 createTime = 3;
required bytes redundanceAndPlaceMentPolicy = 4;
}
message CreatePoolRequest {
required string PoolName = 1;
required bytes redundanceAndPlaceMentPolicy = 2;
}
message CreatePoolResponse {
required TopoStatusCode statusCode = 1;
optional PoolInfo PoolInfo = 2;
}
message DeletePoolRequest {
required uint32 PoolID = 1;
}
message DeletePoolResponse {
required TopoStatusCode statusCode = 1;
}
message GetPoolRequest {
required uint32 PoolID = 1;
}
message GetPoolResponse {
required TopoStatusCode statusCode = 1;
optional PoolInfo PoolInfo = 2;
}
message ListPoolRequest {
}
message ListPoolResponse {
required TopoStatusCode statusCode = 1;
repeated PoolInfo PoolInfos = 2;
}
// for client interface
message GetMetaServerListInCopySetsRequest {
required uint32 PoolId = 1;
repeated uint32 copysetId = 2;
}
message MetaServerLocation {
required uint32 metaServerID = 1;
required string internalIp = 2;
required uint32 internalport = 3;
optional string externalIp = 4;
optional uint32 externalPort = 5;
}
message CopySetServerInfo {
required uint32 copysetId = 1;
repeated MetaServerLocation csLocs = 2;
}
message GetMetaServerListInCopySetsResponse {
required TopoStatusCode statusCode = 1;
repeated CopySetServerInfo csInfo = 2;
}
message CreatePartitionRequest {
required uint32 fsId = 1;
required uint32 count = 2;
}
message CreatePartitionResponse {
required TopoStatusCode statusCode = 1;
repeated common.PartitionInfo partitionInfoList = 2;
}
message DeletePartitionRequest {
required uint32 partitionId = 1;
}
message DeletePartitionResponse {
required TopoStatusCode statusCode = 1;
}
message ListPartitionRequest {
required uint32 fsId = 1;
}
message ListPartitionResponse {
required TopoStatusCode statusCode = 1;
repeated common.PartitionInfo partitionInfoList = 2;
}
message GetCopysetOfPartitionRequest {
repeated uint32 partitionId = 1;
}
message GetCopysetOfPartitionResponse {
required TopoStatusCode statusCode = 1;
map<uint32, Copyset> copysetMap = 2;
}
message PartitionTxId {
required uint32 partitionId = 1;
required uint64 txId = 2;
}
message CommitTxRequest {
repeated PartitionTxId partitionTxIds = 1;
}
message CommitTxResponse {
required TopoStatusCode statusCode = 1;
}
message CopysetKey {
required uint32 poolId = 1;
required uint32 copysetId = 2;
}
message GetCopysetsInfoRequest {
repeated CopysetKey copysetKeys = 1;
}
message CopysetValue {
required TopoStatusCode statusCode = 1;
optional dingofs.pb.mds.heartbeat.CopySetInfo copysetInfo = 2;
}
message GetCopysetsInfoResponse {
repeated CopysetValue copysetValues = 1;
}
message ListCopysetInfoRequest {
}
message ListCopysetInfoResponse {
repeated CopysetValue copysetValues = 1;
}
message StatMetadataUsageRequest{
}
message MetadataUsage{
// KB
required string metaserverAddr = 1;
required uint64 total = 2;
required uint64 used = 3;
}
message StatMetadataUsageResponse{
repeated MetadataUsage metadataUsages = 1;
}
message ListTopologyRequest {
}
message ListZoneResponse {
// use for ListTopologyResponse
required TopoStatusCode statusCode = 1;
repeated ZoneInfo zoneInfos = 2;
}
message ListServerResponse {
// use for ListTopologyResponse
required TopoStatusCode statusCode = 1;
repeated ServerInfo serverInfos = 2;
}
message ListTopologyResponse {
required string clusterId = 1;
required ListPoolResponse pools = 2;
required ListZoneResponse zones = 3;
required ListServerResponse servers = 4;
required ListMetaServerResponse metaservers = 5;
}
message MemcacheServerInfo {
required string ip = 1;
required uint32 port = 2;
}
message RegistMemcacheClusterRequest {
repeated MemcacheServerInfo servers = 1;
}
message RegistMemcacheClusterResponse {
required TopoStatusCode statusCode = 1;
optional uint32 clusterId = 2;
}
message ListMemcacheClusterRequest {
}
message MemcacheClusterInfo {
required uint32 clusterId = 1;
repeated MemcacheServerInfo servers = 2;
}
message ListMemcacheClusterResponse {
required TopoStatusCode statusCode = 1;
repeated MemcacheClusterInfo memcacheClusters = 2;
}
message AllocOrGetMemcacheClusterRequest {
required uint32 fsId = 1;
}
message AllocOrGetMemcacheClusterResponse {
required TopoStatusCode statusCode = 1;
optional MemcacheClusterInfo cluster = 2;
}
service TopologyService {
rpc RegistMetaServer(MetaServerRegistRequest) returns (MetaServerRegistResponse);
rpc ListMetaServer(ListMetaServerRequest) returns (ListMetaServerResponse);
// TODO(chengyi): mv to GetMateservers
rpc GetMetaServer(GetMetaServerInfoRequest) returns (GetMetaServerInfoResponse);
rpc DeleteMetaServer(DeleteMetaServerRequest) returns (DeleteMetaServerResponse);
rpc RegistServer(ServerRegistRequest) returns (ServerRegistResponse);
rpc GetServer(GetServerRequest) returns (GetServerResponse);
rpc DeleteServer(DeleteServerRequest) returns (DeleteServerResponse);
rpc ListZoneServer(ListZoneServerRequest) returns (ListZoneServerResponse);
rpc CreateZone(CreateZoneRequest) returns (CreateZoneResponse);
rpc DeleteZone(DeleteZoneRequest) returns (DeleteZoneResponse);
rpc GetZone(GetZoneRequest) returns (GetZoneResponse);
rpc ListPoolZone(ListPoolZoneRequest) returns (ListPoolZoneResponse);
rpc CreatePool(CreatePoolRequest) returns (CreatePoolResponse);
rpc DeletePool(DeletePoolRequest) returns (DeletePoolResponse);
rpc GetPool(GetPoolRequest) returns (GetPoolResponse);
rpc ListPool(ListPoolRequest) returns (ListPoolResponse);
rpc GetMetaServerListInCopysets(GetMetaServerListInCopySetsRequest)
returns (GetMetaServerListInCopySetsResponse);
rpc CreatePartition(CreatePartitionRequest) returns (CreatePartitionResponse);
rpc DeletePartition(DeletePartitionRequest) returns (DeletePartitionResponse);
rpc ListPartition(ListPartitionRequest) returns (ListPartitionResponse);
rpc GetCopysetOfPartition(GetCopysetOfPartitionRequest) returns (GetCopysetOfPartitionResponse);
rpc CommitTx(CommitTxRequest) returns (CommitTxResponse);
rpc GetCopysetsInfo (GetCopysetsInfoRequest) returns (GetCopysetsInfoResponse);
rpc ListCopysetInfo(ListCopysetInfoRequest) returns (ListCopysetInfoResponse);
rpc StatMetadataUsage(StatMetadataUsageRequest) returns (StatMetadataUsageResponse);
rpc ListTopology(ListTopologyRequest) returns (ListTopologyResponse);
rpc RegistMemcacheCluster(RegistMemcacheClusterRequest) returns (RegistMemcacheClusterResponse);
rpc ListMemcacheCluster(ListMemcacheClusterRequest) returns (ListMemcacheClusterResponse);
rpc AllocOrGetMemcacheCluster(AllocOrGetMemcacheClusterRequest) returns (AllocOrGetMemcacheClusterResponse);
}