| 1 |
package meta; |
| 2 |
|
| 3 |
//======================================================================== |
| 4 |
// |
| 5 |
// Metadata |
| 6 |
// |
| 7 |
//======================================================================== |
| 8 |
|
| 9 |
message Data { |
| 10 |
required uint64 Term = 1; |
| 11 |
required uint64 Index = 2; |
| 12 |
required uint64 ClusterID = 3; |
| 13 |
|
| 14 |
repeated NodeInfo Nodes = 4; |
| 15 |
repeated DatabaseInfo Databases = 5; |
| 16 |
repeated UserInfo Users = 6; |
| 17 |
|
| 18 |
required uint64 MaxNodeID = 7; |
| 19 |
required uint64 MaxShardGroupID = 8; |
| 20 |
required uint64 MaxShardID = 9; |
| 21 |
|
| 22 |
// added for 0.10.0 |
| 23 |
repeated NodeInfo DataNodes = 10; |
| 24 |
repeated NodeInfo MetaNodes = 11; |
| 25 |
} |
| 26 |
|
| 27 |
message NodeInfo { |
| 28 |
required uint64 ID = 1; |
| 29 |
required string Host = 2; |
| 30 |
optional string TCPHost = 3; |
| 31 |
} |
| 32 |
|
| 33 |
message DatabaseInfo { |
| 34 |
required string Name = 1; |
| 35 |
required string DefaultRetentionPolicy = 2; |
| 36 |
repeated RetentionPolicyInfo RetentionPolicies = 3; |
| 37 |
repeated ContinuousQueryInfo ContinuousQueries = 4; |
| 38 |
} |
| 39 |
|
| 40 |
message RetentionPolicySpec { |
| 41 |
optional string Name = 1; |
| 42 |
optional int64 Duration = 2; |
| 43 |
optional int64 ShardGroupDuration = 3; |
| 44 |
optional uint32 ReplicaN = 4; |
| 45 |
} |
| 46 |
|
| 47 |
message RetentionPolicyInfo { |
| 48 |
required string Name = 1; |
| 49 |
required int64 Duration = 2; |
| 50 |
required int64 ShardGroupDuration = 3; |
| 51 |
required uint32 ReplicaN = 4; |
| 52 |
repeated ShardGroupInfo ShardGroups = 5; |
| 53 |
repeated SubscriptionInfo Subscriptions = 6; |
| 54 |
} |
| 55 |
|
| 56 |
message ShardGroupInfo { |
| 57 |
required uint64 ID = 1; |
| 58 |
required int64 StartTime = 2; |
| 59 |
required int64 EndTime = 3; |
| 60 |
required int64 DeletedAt = 4; |
| 61 |
repeated ShardInfo Shards = 5; |
| 62 |
optional int64 TruncatedAt = 6; |
| 63 |
} |
| 64 |
|
| 65 |
message ShardInfo { |
| 66 |
required uint64 ID = 1; |
| 67 |
repeated uint64 OwnerIDs = 2 [deprecated=true]; |
| 68 |
repeated ShardOwner Owners = 3; |
| 69 |
} |
| 70 |
|
| 71 |
message SubscriptionInfo{ |
| 72 |
required string Name = 1; |
| 73 |
required string Mode = 2; |
| 74 |
repeated string Destinations = 3; |
| 75 |
} |
| 76 |
|
| 77 |
message ShardOwner { |
| 78 |
required uint64 NodeID = 1; |
| 79 |
} |
| 80 |
|
| 81 |
message ContinuousQueryInfo { |
| 82 |
required string Name = 1; |
| 83 |
required string Query = 2; |
| 84 |
} |
| 85 |
|
| 86 |
message UserInfo { |
| 87 |
required string Name = 1; |
| 88 |
required string Hash = 2; |
| 89 |
required bool Admin = 3; |
| 90 |
repeated UserPrivilege Privileges = 4; |
| 91 |
} |
| 92 |
|
| 93 |
message UserPrivilege { |
| 94 |
required string Database = 1; |
| 95 |
required int32 Privilege = 2; |
| 96 |
} |
| 97 |
|
| 98 |
|
| 99 |
//======================================================================== |
| 100 |
// |
| 101 |
// COMMANDS |
| 102 |
// |
| 103 |
//======================================================================== |
| 104 |
|
| 105 |
message Command { |
| 106 |
extensions 100 to max; |
| 107 |
|
| 108 |
enum Type { |
| 109 |
CreateNodeCommand = 1; |
| 110 |
DeleteNodeCommand = 2; |
| 111 |
CreateDatabaseCommand = 3; |
| 112 |
DropDatabaseCommand = 4; |
| 113 |
CreateRetentionPolicyCommand = 5; |
| 114 |
DropRetentionPolicyCommand = 6; |
| 115 |
SetDefaultRetentionPolicyCommand = 7; |
| 116 |
UpdateRetentionPolicyCommand = 8; |
| 117 |
CreateShardGroupCommand = 9; |
| 118 |
DeleteShardGroupCommand = 10; |
| 119 |
CreateContinuousQueryCommand = 11; |
| 120 |
DropContinuousQueryCommand = 12; |
| 121 |
CreateUserCommand = 13; |
| 122 |
DropUserCommand = 14; |
| 123 |
UpdateUserCommand = 15; |
| 124 |
SetPrivilegeCommand = 16; |
| 125 |
SetDataCommand = 17; |
| 126 |
SetAdminPrivilegeCommand = 18; |
| 127 |
UpdateNodeCommand = 19; |
| 128 |
CreateSubscriptionCommand = 21; |
| 129 |
DropSubscriptionCommand = 22; |
| 130 |
RemovePeerCommand = 23; |
| 131 |
CreateMetaNodeCommand = 24; |
| 132 |
CreateDataNodeCommand = 25; |
| 133 |
UpdateDataNodeCommand = 26; |
| 134 |
DeleteMetaNodeCommand = 27; |
| 135 |
DeleteDataNodeCommand = 28; |
| 136 |
SetMetaNodeCommand = 29; |
| 137 |
DropShardCommand = 30; |
| 138 |
} |
| 139 |
|
| 140 |
required Type type = 1; |
| 141 |
} |
| 142 |
|
| 143 |
// This isn't used in >= 0.10.0. Kept around for upgrade purposes. Instead |
| 144 |
// look at CreateDataNodeCommand and CreateMetaNodeCommand |
| 145 |
message CreateNodeCommand { |
| 146 |
extend Command { |
| 147 |
optional CreateNodeCommand command = 101; |
| 148 |
} |
| 149 |
required string Host = 1; |
| 150 |
required uint64 Rand = 2; |
| 151 |
} |
| 152 |
|
| 153 |
message DeleteNodeCommand { |
| 154 |
extend Command { |
| 155 |
optional DeleteNodeCommand command = 102; |
| 156 |
} |
| 157 |
required uint64 ID = 1; |
| 158 |
required bool Force = 2; |
| 159 |
} |
| 160 |
|
| 161 |
message CreateDatabaseCommand { |
| 162 |
extend Command { |
| 163 |
optional CreateDatabaseCommand command = 103; |
| 164 |
} |
| 165 |
required string Name = 1; |
| 166 |
optional RetentionPolicyInfo RetentionPolicy = 2; |
| 167 |
} |
| 168 |
|
| 169 |
message DropDatabaseCommand { |
| 170 |
extend Command { |
| 171 |
optional DropDatabaseCommand command = 104; |
| 172 |
} |
| 173 |
required string Name = 1; |
| 174 |
} |
| 175 |
|
| 176 |
message CreateRetentionPolicyCommand { |
| 177 |
extend Command { |
| 178 |
optional CreateRetentionPolicyCommand command = 105; |
| 179 |
} |
| 180 |
required string Database = 1; |
| 181 |
required RetentionPolicyInfo RetentionPolicy = 2; |
| 182 |
} |
| 183 |
|
| 184 |
message DropRetentionPolicyCommand { |
| 185 |
extend Command { |
| 186 |
optional DropRetentionPolicyCommand command = 106; |
| 187 |
} |
| 188 |
required string Database = 1; |
| 189 |
required string Name = 2; |
| 190 |
} |
| 191 |
|
| 192 |
message SetDefaultRetentionPolicyCommand { |
| 193 |
extend Command { |
| 194 |
optional SetDefaultRetentionPolicyCommand command = 107; |
| 195 |
} |
| 196 |
required string Database = 1; |
| 197 |
required string Name = 2; |
| 198 |
} |
| 199 |
|
| 200 |
message UpdateRetentionPolicyCommand { |
| 201 |
extend Command { |
| 202 |
optional UpdateRetentionPolicyCommand command = 108; |
| 203 |
} |
| 204 |
required string Database = 1; |
| 205 |
required string Name = 2; |
| 206 |
optional string NewName = 3; |
| 207 |
optional int64 Duration = 4; |
| 208 |
optional uint32 ReplicaN = 5; |
| 209 |
} |
| 210 |
|
| 211 |
message CreateShardGroupCommand { |
| 212 |
extend Command { |
| 213 |
optional CreateShardGroupCommand command = 109; |
| 214 |
} |
| 215 |
required string Database = 1; |
| 216 |
required string Policy = 2; |
| 217 |
required int64 Timestamp = 3; |
| 218 |
} |
| 219 |
|
| 220 |
message DeleteShardGroupCommand { |
| 221 |
extend Command { |
| 222 |
optional DeleteShardGroupCommand command = 110; |
| 223 |
} |
| 224 |
required string Database = 1; |
| 225 |
required string Policy = 2; |
| 226 |
required uint64 ShardGroupID = 3; |
| 227 |
} |
| 228 |
|
| 229 |
message CreateContinuousQueryCommand { |
| 230 |
extend Command { |
| 231 |
optional CreateContinuousQueryCommand command = 111; |
| 232 |
} |
| 233 |
required string Database = 1; |
| 234 |
required string Name = 2; |
| 235 |
required string Query = 3; |
| 236 |
} |
| 237 |
|
| 238 |
message DropContinuousQueryCommand { |
| 239 |
extend Command { |
| 240 |
optional DropContinuousQueryCommand command = 112; |
| 241 |
} |
| 242 |
required string Database = 1; |
| 243 |
required string Name = 2; |
| 244 |
} |
| 245 |
|
| 246 |
message CreateUserCommand { |
| 247 |
extend Command { |
| 248 |
optional CreateUserCommand command = 113; |
| 249 |
} |
| 250 |
required string Name = 1; |
| 251 |
required string Hash = 2; |
| 252 |
required bool Admin = 3; |
| 253 |
} |
| 254 |
|
| 255 |
message DropUserCommand { |
| 256 |
extend Command { |
| 257 |
optional DropUserCommand command = 114; |
| 258 |
} |
| 259 |
required string Name = 1; |
| 260 |
} |
| 261 |
|
| 262 |
message UpdateUserCommand { |
| 263 |
extend Command { |
| 264 |
optional UpdateUserCommand command = 115; |
| 265 |
} |
| 266 |
required string Name = 1; |
| 267 |
required string Hash = 2; |
| 268 |
} |
| 269 |
|
| 270 |
message SetPrivilegeCommand { |
| 271 |
extend Command { |
| 272 |
optional SetPrivilegeCommand command = 116; |
| 273 |
} |
| 274 |
required string Username = 1; |
| 275 |
required string Database = 2; |
| 276 |
required int32 Privilege = 3; |
| 277 |
} |
| 278 |
|
| 279 |
message SetDataCommand { |
| 280 |
extend Command { |
| 281 |
optional SetDataCommand command = 117; |
| 282 |
} |
| 283 |
required Data Data = 1; |
| 284 |
} |
| 285 |
|
| 286 |
message SetAdminPrivilegeCommand { |
| 287 |
extend Command { |
| 288 |
optional SetAdminPrivilegeCommand command = 118; |
| 289 |
} |
| 290 |
required string Username = 1; |
| 291 |
required bool Admin = 2; |
| 292 |
} |
| 293 |
|
| 294 |
message UpdateNodeCommand { |
| 295 |
extend Command { |
| 296 |
optional UpdateNodeCommand command = 119; |
| 297 |
} |
| 298 |
required uint64 ID = 1; |
| 299 |
required string Host = 2; |
| 300 |
} |
| 301 |
|
| 302 |
message CreateSubscriptionCommand { |
| 303 |
extend Command { |
| 304 |
optional CreateSubscriptionCommand command = 121; |
| 305 |
} |
| 306 |
required string Name = 1; |
| 307 |
required string Database = 2; |
| 308 |
required string RetentionPolicy = 3; |
| 309 |
required string Mode = 4; |
| 310 |
repeated string Destinations = 5; |
| 311 |
|
| 312 |
} |
| 313 |
|
| 314 |
message DropSubscriptionCommand { |
| 315 |
extend Command { |
| 316 |
optional DropSubscriptionCommand command = 122; |
| 317 |
} |
| 318 |
required string Name = 1; |
| 319 |
required string Database = 2; |
| 320 |
required string RetentionPolicy = 3; |
| 321 |
} |
| 322 |
|
| 323 |
message RemovePeerCommand { |
| 324 |
extend Command { |
| 325 |
optional RemovePeerCommand command = 123; |
| 326 |
} |
| 327 |
optional uint64 ID = 1; |
| 328 |
required string Addr = 2; |
| 329 |
} |
| 330 |
|
| 331 |
message CreateMetaNodeCommand { |
| 332 |
extend Command { |
| 333 |
optional CreateMetaNodeCommand command = 124; |
| 334 |
} |
| 335 |
required string HTTPAddr = 1; |
| 336 |
required string TCPAddr = 2; |
| 337 |
required uint64 Rand = 3; |
| 338 |
} |
| 339 |
|
| 340 |
message CreateDataNodeCommand { |
| 341 |
extend Command { |
| 342 |
optional CreateDataNodeCommand command = 125; |
| 343 |
} |
| 344 |
required string HTTPAddr = 1; |
| 345 |
required string TCPAddr = 2; |
| 346 |
} |
| 347 |
|
| 348 |
message UpdateDataNodeCommand { |
| 349 |
extend Command { |
| 350 |
optional UpdateDataNodeCommand command = 126; |
| 351 |
} |
| 352 |
required uint64 ID = 1; |
| 353 |
required string Host = 2; |
| 354 |
required string TCPHost = 3; |
| 355 |
} |
| 356 |
|
| 357 |
message DeleteMetaNodeCommand { |
| 358 |
extend Command { |
| 359 |
optional DeleteMetaNodeCommand command = 127; |
| 360 |
} |
| 361 |
required uint64 ID = 1; |
| 362 |
} |
| 363 |
|
| 364 |
message DeleteDataNodeCommand { |
| 365 |
extend Command { |
| 366 |
optional DeleteDataNodeCommand command = 128; |
| 367 |
} |
| 368 |
required uint64 ID = 1; |
| 369 |
} |
| 370 |
|
| 371 |
message Response { |
| 372 |
required bool OK = 1; |
| 373 |
optional string Error = 2; |
| 374 |
optional uint64 Index = 3; |
| 375 |
} |
| 376 |
|
| 377 |
// SetMetaNodeCommand is for the initial metanode in a cluster or |
| 378 |
// if the single host restarts and its hostname changes, this will update it |
| 379 |
message SetMetaNodeCommand { |
| 380 |
extend Command { |
| 381 |
optional SetMetaNodeCommand command = 129; |
| 382 |
} |
| 383 |
required string HTTPAddr = 1; |
| 384 |
required string TCPAddr = 2; |
| 385 |
required uint64 Rand = 3; |
| 386 |
} |
| 387 |
|
| 388 |
message DropShardCommand { |
| 389 |
extend Command { |
| 390 |
optional DropShardCommand command = 130; |
| 391 |
} |
| 392 |
required uint64 ID = 1; |
| 393 |
} |