forked from opencurve/curve
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtopology.proto
546 lines (455 loc) · 15.7 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
538
539
540
541
542
543
544
545
/*
* Copyright (c) 2020 NetEase Inc.
*
* 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.
*/
/*
* Project: curve
* Created Date: Fri Aug 17 2018
* Author: xuchaojie
*/
syntax="proto2";
import "proto/common.proto";
package curve.mds.topology;
// HTTP web can use https://github.com/dcodeIO/protobuf.js to use proto buffer
option cc_generic_services = true;
option go_package = "proto/topology";
enum LogicalPoolType {
PAGEFILE = 0;
APPENDFILE = 1;
APPENDECFILE = 2;
};
enum AllocateStatus {
ALLOW = 0;
DENY = 1;
}
enum ChunkServerStatus {
READWRITE = 0;
PENDDING = 1;
RETIRED = 2;
}
enum DiskState {
DISKNORMAL = 0;
DISKERROR = 1;
}
enum OnlineState {
ONLINE = 0;
OFFLINE = 1;
UNSTABLE = 2;
}
// etcd struct defination
message ClusterInfoData {
required string clusterId = 1;
}
message LogicalPoolData {
required uint32 logicalPoolId = 1;
required string logicalPoolName = 2;
required uint32 physicalPoolId = 3;
required LogicalPoolType type = 4;
required uint32 initialScatterWidth = 5;
required uint64 createTime = 6;
required AllocateStatus status = 7;
required string redundanceAndPlacementPolicy = 8;
required string userPolicy = 9;
required bool availFlag = 10;
optional bool scanEnable = 11;
}
message PhysicalPoolData {
required uint32 physicalPoolId = 1;
required string physicalPoolName = 2;
required string desc = 3;
}
message ZoneData {
required uint32 zoneId = 1;
required string zoneName = 2;
required uint32 physicalPoolId = 3;
required string desc = 4;
}
message ServerData {
required uint32 serverId = 1;
required string hostName = 2;
required string internalHostIP = 3;
required uint32 internalPort = 4;
required string externalHostIP = 5;
required uint32 externalPort = 6;
required uint32 zoneId = 7;
required uint32 physicalPoolId = 8;
required string desc = 9;
}
message ChunkServerData {
required uint32 chunkserverId = 1;
required string token = 2;
required string diskType = 3;
required string internalHostIP = 4;
required uint32 port = 5;
required uint32 serverId = 6;
required ChunkServerStatus rwstatus = 7;
required DiskState diskState = 8;
required OnlineState onlineState = 9;
required string mountPoint = 10;
required int64 diskCapacity = 11;
required int64 diskUsed = 12;
}
message CopysetData {
required uint32 copysetId = 1;
required uint32 logicalPoolId = 2;
required uint64 epoch = 3;
repeated uint32 chunkserverIds = 4;
optional bool availFlag = 5;
optional uint64 lastScanSec = 6;
optional bool lastScanConsistent = 7;
}
// rpc struct defination
message ChunkServerInfo {
required uint32 chunkServerID = 1;
required string diskType = 2;
required string hostIp = 3;
required uint32 port = 4;
required ChunkServerStatus status = 5;
required DiskState diskStatus = 6;
required OnlineState onlineState = 7;
required string mountPoint = 8;
required uint64 diskCapacity = 9;
required uint64 diskUsed = 10;
optional string externalIp = 11;
}
//chunkserver message
message ChunkServerRegistRequest {
required string diskType = 1; //"nvme_ssd"
required string diskPath = 2;
required string hostIp = 3;
required uint32 port = 4;
optional string externalIp = 5;
// already registed chunkserver should take chunkserverId & token
optional uint32 chunkServerID = 6;
optional string token = 7;
optional uint64 chunkFilepoolSize = 8;
optional bool useChunkFilePoolAsWalPool = 9;
optional uint32 useChunkFilePoolAsWalPoolReserve = 10;
};
message ChunkServerRegistResponse {
required sint32 statusCode = 1;
optional uint32 chunkServerID = 2;
optional string token = 3;
// <FileId, epoch>
map<uint64, uint64> epochMap = 4;
};
message ListChunkServerRequest {
//user either ip or serverID to list Chunkserver under server
optional string ip = 1;
optional uint32 port = 2;
optional uint32 serverID = 3;
}
message ListChunkServerResponse {
required sint32 statusCode = 1;
repeated ChunkServerInfo chunkServerInfos = 2;
}
message GetChunkServerInfoRequest {
//use either chunkServerID or hostIp&port to query chunkserver
optional uint32 chunkServerID = 1;
optional string hostIp = 2;
optional uint32 port = 3;
}
message GetChunkServerInfoResponse {
required sint32 statusCode = 1;
optional ChunkServerInfo chunkServerInfo = 2;
}
message GetChunkServerInClusterRequest {
}
message GetChunkServerInClusterResponse {
required sint32 statusCode = 1;
repeated ChunkServerInfo chunkServerInfos = 2;
}
message DeleteChunkServerRequest {
required uint32 chunkServerID = 1;
}
message DeleteChunkServerResponse {
required sint32 statusCode = 1;
}
message SetChunkServerStatusRequest {
required uint32 chunkServerID = 1;
required ChunkServerStatus chunkServerStatus = 2;
}
message SetChunkServerStatusResponse {
required sint32 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;
required string zoneName = 8;
required uint32 physicalPoolID = 9;
required string physicalPoolName = 10;
required string desc = 11;
}
message ServerRegistRequest {
required string hostName = 1;
required string internalIp = 2; // for internal uses(between mds & chunkserver)
optional uint32 internalPort = 3;
required string externalIp = 4; // for client use (read & write & snapshot and so on)
optional uint32 externalPort = 5;
//user either zoneID&physicalPoolID or zoneName&physicalPoolName
optional uint32 zoneID = 6;
optional string zoneName = 7;
optional uint32 physicalPoolID = 8;
optional string physicalPoolName = 9; //physicalPoolName is unique
required string desc = 10;
}
message ServerRegistResponse {
required sint32 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 sint32 statusCode = 1;
optional ServerInfo serverInfo = 2;
}
message DeleteServerRequest {
//must use the serverID to delete the server
required uint32 serverID = 1;
}
message DeleteServerResponse {
required sint32 statusCode = 1;
}
//zone message
message ListZoneServerRequest {
//user either zoneID or zoneName&physicalPoolName to
//List Servers under the zone
optional uint32 zoneID = 1;
optional string zoneName = 2;
optional string physicalPoolName = 3;
}
message ListZoneServerResponse {
required sint32 statusCode = 1;
repeated ServerInfo serverInfo = 2;
}
message ZoneInfo {
required uint32 zoneID = 1;
required string zoneName = 2;
required uint32 physicalPoolID = 3;
required string physicalPoolName = 4;
optional string desc = 5;
}
message ZoneRequest {
//use either zoneID or zoneName&physicalPoolName to locate zone
optional uint32 zoneID = 1;
optional string zoneName = 2;
optional string physicalPoolName = 3;
optional string desc = 4;
}
message ZoneResponse {
required sint32 statusCode = 1;
optional ZoneInfo zoneInfo = 2;
}
//physicalpool message
message ListPoolZoneRequest {
//use either physicalPoolID or physicalPoolName
optional uint32 physicalPoolID = 1;
optional string physicalPoolName = 2;
}
message ListPoolZoneResponse {
required sint32 statusCode = 1;
repeated ZoneInfo zones = 2;
}
message PhysicalPoolInfo {
required uint32 physicalPoolID = 1;
required string physicalPoolName = 2;
optional string desc = 3;
}
message PhysicalPoolRequest {
//use either physicalPoolID or physicalPoolName
optional uint32 physicalPoolID = 1;
optional string physicalPoolName = 2;
optional string desc = 3;
}
message PhysicalPoolResponse {
required sint32 statusCode = 1;
optional PhysicalPoolInfo physicalPoolInfo = 2;
}
message ListPhysicalPoolRequest {
}
message ListPhysicalPoolResponse {
required sint32 statusCode = 1;
repeated PhysicalPoolInfo physicalPoolInfos = 2;
}
//logicalpool message
message LogicalPoolInfo {
required uint32 logicalPoolID = 1;
required string logicalPoolName = 2;
required uint32 physicalPoolID = 3;
required LogicalPoolType type = 4;
required uint64 createTime = 5;
required bytes redundanceAndPlaceMentPolicy = 6; //json body
required bytes userPolicy = 7; //json body
required AllocateStatus allocateStatus = 8;
optional bool scanEnable = 9;
}
message CreateLogicalPoolRequest {
required string logicalPoolName = 1;
optional uint32 physicalPoolID = 2;
optional string physicalPoolName = 3;
required LogicalPoolType type = 4;
required bytes redundanceAndPlaceMentPolicy = 5; //json body
required bytes userPolicy = 6; //json body
optional uint32 scatterWidth = 7; //生成copyset依据的scatterWidth平均值
optional AllocateStatus status = 8;
}
message CreateLogicalPoolResponse {
required sint32 statusCode = 1;
optional LogicalPoolInfo logicalPoolInfo = 2;
}
message DeleteLogicalPoolRequest {
//use either logicalPoolID or physicalPoolName & logicalPoolName
optional uint32 logicalPoolID = 1;
optional string logicalPoolName = 2;
optional string physicalPoolName = 3;
}
message DeleteLogicalPoolResponse {
required sint32 statusCode = 1;
}
message GetLogicalPoolRequest {
//use either logicalPoolID or logicalPoolName
optional uint32 logicalPoolID = 1;
optional string logicalPoolName = 2;
optional string physicalPoolName = 3;
}
message GetLogicalPoolResponse {
required sint32 statusCode = 1;
optional LogicalPoolInfo logicalPoolInfo = 2;
}
message ListLogicalPoolRequest {
//use either physicalPoolID or physicalPoolName
optional uint32 physicalPoolID = 1;
optional string physicalPoolName = 2;
}
message ListLogicalPoolResponse {
required sint32 statusCode = 1;
repeated LogicalPoolInfo logicalPoolInfos = 2;
}
message SetLogicalPoolRequest {
required uint32 logicalPoolID = 1;
required AllocateStatus status = 2;
}
message SetLogicalPoolResponse {
required sint32 statusCode = 1;
}
message SetLogicalPoolScanStateRequest {
required uint32 logicalPoolID = 1;
required bool scanEnable = 2;
}
message SetLogicalPoolScanStateResponse {
required sint32 statusCode = 1;
}
//for client interface
message GetChunkServerListInCopySetsRequest {
required uint32 logicalPoolId = 1;
repeated uint32 copysetId = 2;
}
message CopySetServerInfo {
required uint32 copysetId = 1;
repeated common.ChunkServerLocation csLocs = 2;
}
message GetChunkServerListInCopySetsResponse {
required sint32 statusCode = 1;
repeated CopySetServerInfo csInfo = 2;
}
message GetCopySetsInChunkServerRequest {
//use either chunkServerID or hostIp&port to get copusets on chunkserver
optional uint32 chunkServerID = 1;
optional string hostIp = 2;
optional uint32 port = 3;
}
message GetCopySetsInChunkServerResponse {
required sint32 statusCode = 1;
repeated common.CopysetInfo copysetInfos = 2;
}
message GetClusterInfoRequest {
}
message GetClusterInfoResponse {
required sint32 statusCode = 1;
optional string clusterId = 2;
}
message GetCopySetsInClusterRequest {
// Filter copysets which in scaning
optional bool filterScaning = 1;
}
message GetCopySetsInClusterResponse {
required sint32 statusCode = 1;
repeated common.CopysetInfo copysetInfos = 2;
}
message GetCopysetRequest {
required uint32 logicalPoolId = 1;
required uint32 copysetId = 2;
}
message GetCopysetResponse {
required sint32 statusCode = 1;
optional common.CopysetInfo copysetInfo = 2;
}
message SetCopysetsAvailFlagRequest {
required bool availFlag = 1;
repeated common.CopysetInfo copysets = 2;
}
message SetCopysetsAvailFlagResponse {
required sint32 statusCode = 1;
}
message ListUnAvailCopySetsRequest {
}
message ListUnAvailCopySetsResponse {
required sint32 statusCode = 1;
repeated common.CopysetInfo copysets = 2;
}
//TODO(hzsunjianliang): update userPolicy and so on
service TopologyService {
rpc RegistChunkServer(ChunkServerRegistRequest) returns (ChunkServerRegistResponse);
rpc ListChunkServer(ListChunkServerRequest) returns (ListChunkServerResponse);
rpc GetChunkServer(GetChunkServerInfoRequest) returns (GetChunkServerInfoResponse);
rpc GetChunkServerInCluster(GetChunkServerInClusterRequest) returns (GetChunkServerInClusterResponse);
rpc DeleteChunkServer(DeleteChunkServerRequest) returns (DeleteChunkServerResponse);
rpc SetChunkServer(SetChunkServerStatusRequest) returns (SetChunkServerStatusResponse);
rpc RegistServer(ServerRegistRequest) returns (ServerRegistResponse);
rpc GetServer(GetServerRequest) returns (GetServerResponse);
rpc DeleteServer(DeleteServerRequest) returns (DeleteServerResponse);
rpc ListZoneServer(ListZoneServerRequest) returns (ListZoneServerResponse);
rpc CreateZone(ZoneRequest) returns (ZoneResponse);
rpc DeleteZone(ZoneRequest) returns (ZoneResponse);
rpc GetZone(ZoneRequest) returns (ZoneResponse);
rpc ListPoolZone(ListPoolZoneRequest) returns (ListPoolZoneResponse);
rpc CreatePhysicalPool(PhysicalPoolRequest) returns (PhysicalPoolResponse);
rpc DeletePhysicalPool(PhysicalPoolRequest) returns (PhysicalPoolResponse);
rpc GetPhysicalPool(PhysicalPoolRequest) returns (PhysicalPoolResponse);
rpc ListPhysicalPool(ListPhysicalPoolRequest) returns (ListPhysicalPoolResponse);
rpc CreateLogicalPool(CreateLogicalPoolRequest) returns (CreateLogicalPoolResponse);
rpc DeleteLogicalPool(DeleteLogicalPoolRequest) returns (DeleteLogicalPoolResponse);
rpc GetLogicalPool(GetLogicalPoolRequest) returns (GetLogicalPoolResponse);
rpc ListLogicalPool(ListLogicalPoolRequest) returns (ListLogicalPoolResponse);
rpc SetLogicalPool(SetLogicalPoolRequest) returns(SetLogicalPoolResponse);
rpc SetLogicalPoolScanState(SetLogicalPoolScanStateRequest) returns (SetLogicalPoolScanStateResponse);
rpc GetChunkServerListInCopySets(GetChunkServerListInCopySetsRequest) returns (GetChunkServerListInCopySetsResponse);
rpc GetCopySetsInChunkServer(GetCopySetsInChunkServerRequest) returns (GetCopySetsInChunkServerResponse);
rpc GetCopySetsInCluster(GetCopySetsInClusterRequest) returns (GetCopySetsInClusterResponse);
rpc GetCopyset(GetCopysetRequest) returns (GetCopysetResponse);
rpc GetClusterInfo(GetClusterInfoRequest) returns (GetClusterInfoResponse);
rpc SetCopysetsAvailFlag(SetCopysetsAvailFlagRequest) returns (SetCopysetsAvailFlagResponse);
rpc ListUnAvailCopySets(ListUnAvailCopySetsRequest) returns (ListUnAvailCopySetsResponse);
}