github.com/matrixorigin/matrixone@v1.2.0/proto/metadata.proto (about) 1 /* 2 * Copyright 2021 Matrix Origin 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 syntax = "proto3"; 18 package metadata; 19 option go_package = "github.com/matrixorigin/matrixone/pkg/pb/metadata"; 20 21 import "github.com/gogo/protobuf/gogoproto/gogo.proto"; 22 23 option (gogoproto.goproto_enum_prefix_all) = true; 24 25 // ServiceType service type 26 enum ServiceType { 27 // CN cn service 28 CN = 0; 29 // TN tn service 30 TN = 1; 31 // LOG log service 32 LOG = 2; 33 // Proxy proxy service 34 PROXY = 3; 35 // PYTHON_UDF python udf service 36 PYTHON_UDF = 4; 37 } 38 39 // TNShardRecord is TN shard metadata describing what is a TN shard. It 40 // is internally used by HAKeeper to maintain how many TNs available in 41 // the system. 42 message TNShardRecord { 43 // ShardID the id of the TN shard. 44 uint64 ShardID = 1; 45 // LogShardID a TN corresponds to a unique Shard of LogService. 46 uint64 LogShardID = 2; 47 } 48 49 // TNShard 50 message TNShard { 51 // TNShard extends TNShardRecord 52 TNShardRecord TNShardRecord = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; 53 // ReplicaID only one replica for one TN. The ReplicaID is specified at 54 // the time the TN is created. TN restart ReplicaID will not change, when 55 // a TN is migrated to another node, the ReplicaID will be reset. 56 uint64 ReplicaID = 2; 57 // Address is TN's external service address. 58 string Address = 3; 59 } 60 61 // LogShardRecord is Log Shard Metadata describing what is a Log shard. It is 62 // internally used by the HAKeeper to maintain how many Log shards are available 63 // in the system. 64 message LogShardRecord { 65 // ShardID is the id of the Log Shard. 66 uint64 ShardID = 1; 67 // NumberOfReplicas is the number of replicas in the shard. 68 uint64 NumberOfReplicas = 2; 69 } 70 71 // LogShard 72 message LogShard { 73 // LogShard extends LogShardRecord 74 LogShardRecord LogShardRecord = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; 75 // ReplicaID is the replica ID of the replica running on the LogStore. 76 uint64 ReplicaID = 2; 77 } 78 79 // TNStore TN store metadata 80 message TNStore { 81 // UUID TNStore uuid id 82 string UUID = 1; 83 // Shards TNShards 84 repeated TNShard Shards = 2 [(gogoproto.nullable) = false]; 85 } 86 87 // LogStore is for the metadata for Log store. 88 message LogStore { 89 // UUID is the id of the Log store. 90 string UUID = 1; 91 // Shards is for Log shards metadata. 92 repeated LogShard Shards = 2 [(gogoproto.nullable) = false]; 93 } 94 95 // CNRole cn node role 96 enum CNRole { 97 // TP tp node 98 TP = 0; 99 // AP ap node 100 AP = 1; 101 } 102 103 // CNStore cn store metadata 104 message CNStore { 105 // UUID CNStore uuid id 106 string UUID = 1; 107 // Role CN role 108 CNRole Role = 2; 109 } 110 111 // CNService cn service metadata 112 message CNService { 113 // ServiceID service ID 114 string ServiceID = 1; 115 // LockServiceAddress is used to provide lock service 116 string LockServiceAddress = 2; 117 // PipelineServiceAddress is used to provide distributed pipeline service 118 string PipelineServiceAddress = 3; 119 // SQLAddress is used to provide SQL input. 120 string SQLAddress = 4; 121 reserved 5; 122 // Labels are labels on CN service. 123 map<string, LabelList> Labels = 6 [(gogoproto.nullable) = false]; 124 // WorkState is the work state of CN service. 125 WorkState WorkState = 7; 126 // QueryAddress is the address of queryservice.QueryService. 127 string QueryAddress = 8; 128 } 129 130 // TNService tn service metadata 131 message TNService { 132 // ServiceID service ID 133 string ServiceID = 1; 134 // TxnServiceAddress is used to provide txn service 135 string TxnServiceAddress = 2; 136 // LogTailServiceAddress is used to provide logtail push service 137 string LogTailServiceAddress = 3; 138 // LockServiceAddress lock service address for lock table allocator 139 string LockServiceAddress = 4; 140 reserved 5; 141 // Shards TN shards on service 142 repeated TNShard Shards = 6 [(gogoproto.nullable) = false]; 143 // Labels labels on service 144 map<string, LabelList> Labels = 7 [(gogoproto.nullable) = false]; 145 // QueryAddress it the address of query service on the tn 146 string QueryAddress = 8; 147 } 148 149 // LabelList defines the labels on CN store. 150 message LabelList { 151 repeated string Labels = 1; 152 } 153 154 // WorkState is the work state of CN service. 155 enum WorkState { 156 Unknown = 0; 157 Working = 1; 158 Draining = 2; 159 Drained = 3; 160 } 161