diff --git a/proto/vtadmin.proto b/proto/vtadmin.proto new file mode 100644 index 0000000000..7e2bfd2f72 --- /dev/null +++ b/proto/vtadmin.proto @@ -0,0 +1,100 @@ +/* +Copyright 2020 The Vitess Authors. +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. +*/ + +// This package contains the types used by VTAdmin (and later an RPC service). + +syntax = "proto3"; +option go_package = "vitess.io/vitess/go/vt/proto/vtadmin"; + +package vtadmin; + +import "topodata.proto"; + +/* Services */ + +// VTAdmin is the Vitess Admin API service. It provides RPCs that operate on +// across a range of Vitess clusters. +service VTAdmin { + // GetGates returns all gates across all the specified clusters. + rpc GetGates(GetGatesRequest) returns (GetGatesResponse) {}; + // GetTablet looks up a tablet by hostname across all clusters and returns + // the result. + rpc GetTablet(GetTabletRequest) returns (Tablet) {}; + // GetTablets returns all tablets across all the specified clusters. + rpc GetTablets(GetTabletsRequest) returns (GetTabletsResponse) {}; +} + +/* Data types */ + +// Cluster represents information about a Vitess cluster. +message Cluster { + string id = 1; + string name = 2; +} + +// Tablet groups the topo information of a tablet together with the Vitess +// cluster it belongs to. +message Tablet { + Cluster cluster = 1; + topodata.Tablet tablet = 2; + + enum ServingState { + UNKNOWN = 0; + SERVING = 1; + NOT_SERVING = 2; + } + + ServingState state = 3; +} + +// VTGate represents information about a single VTGate host. +message VTGate { + // Hostname is the shortname of the VTGate. + string hostname = 1; + // Pool is group the VTGate serves queries for. Some deployments segment + // VTGates into groups or pools, based on the workloads they serve queries + // for. Use of this field is optional. + string pool = 2; + // Cell is the topology cell the VTGate is in. + string cell = 3; + // Cluster is the name of the cluster the VTGate serves. + string cluster = 4; + // Keyspaces is the list of keyspaces-to-watch for the VTGate. + repeated string keyspaces = 5; +} + +/* Request/Response types */ + +message GetGatesRequest { + repeated string cluster_ids = 1; +} + +message GetGatesResponse { + repeated VTGate gates = 1; +} + +message GetTabletRequest { + string hostname = 1; + // ClusterIDs is an optional parameter to narrow the scope of the search, if + // the caller knows which cluster the tablet may be in, or, to disamiguate if + // multiple clusters have a tablet with the same hostname. + repeated string cluster_ids = 2; +} + +message GetTabletsRequest { + repeated string cluster_ids = 1; +} + +message GetTabletsResponse { + repeated Tablet tablets = 1; +}