diff --git a/go/cmd/vtctldclient/commands.go b/go/cmd/vtctldclient/commands.go index d10ceecac14..f479957f17a 100644 --- a/go/cmd/vtctldclient/commands.go +++ b/go/cmd/vtctldclient/commands.go @@ -17,16 +17,17 @@ limitations under the License. package main import ( - "encoding/json" "fmt" + "strings" "time" "github.com/golang/protobuf/ptypes" "github.com/spf13/cobra" "vitess.io/vitess/go/vt/log" - vtctldatapb "vitess.io/vitess/go/vt/proto/vtctldata" "vitess.io/vitess/go/vt/topo/topoproto" + + vtctldatapb "vitess.io/vitess/go/vt/proto/vtctldata" ) var ( @@ -36,6 +37,21 @@ var ( Args: cobra.ExactArgs(1), RunE: commandFindAllShardsInKeyspace, } + getCellInfoNamesCmd = &cobra.Command{ + Use: "GetCellInfoNames", + Args: cobra.NoArgs, + RunE: commandGetCellInfoNames, + } + getCellInfoCmd = &cobra.Command{ + Use: "GetCellInfo cell", + Args: cobra.ExactArgs(1), + RunE: commandGetCellInfo, + } + getCellsAliasesCmd = &cobra.Command{ + Use: "GetCellsAliases", + Args: cobra.NoArgs, + RunE: commandGetCellsAliases, + } getKeyspaceCmd = &cobra.Command{ Use: "GetKeyspace keyspace", Aliases: []string{"getkeyspace"}, @@ -65,12 +81,57 @@ func commandFindAllShardsInKeyspace(cmd *cobra.Command, args []string) error { return err } - data, err := json.Marshal(&resp) + data, err := MarshalJSON(resp) + if err != nil { + return err + } + + fmt.Printf("%s\n", data) + return nil +} + +func commandGetCellInfoNames(cmd *cobra.Command, args []string) error { + resp, err := client.GetCellInfoNames(commandCtx, &vtctldatapb.GetCellInfoNamesRequest{}) + if err != nil { + return err + } + + fmt.Printf("%s\n", strings.Join(resp.Names, "\n")) + + return nil +} + +func commandGetCellInfo(cmd *cobra.Command, args []string) error { + cell := cmd.Flags().Arg(0) + resp, err := client.GetCellInfo(commandCtx, &vtctldatapb.GetCellInfoRequest{Cell: cell}) + + if err != nil { + return err + } + + data, err := MarshalJSON(resp.CellInfo) if err != nil { return err } fmt.Printf("%s\n", data) + + return nil +} + +func commandGetCellsAliases(cmd *cobra.Command, args []string) error { + resp, err := client.GetCellsAliases(commandCtx, &vtctldatapb.GetCellsAliasesRequest{}) + if err != nil { + return err + } + + data, err := MarshalJSON(resp.Aliases) + if err != nil { + return err + } + + fmt.Printf("%s\n", data) + return nil } @@ -95,7 +156,12 @@ func commandGetKeyspaces(cmd *cobra.Command, args []string) error { return err } - fmt.Printf("%+v\n", resp.Keyspaces) + data, err := MarshalJSON(resp.Keyspaces) + if err != nil { + return err + } + + fmt.Printf("%s\n", data) return nil } @@ -133,6 +199,9 @@ func commandInitShardPrimary(cmd *cobra.Command, args []string) error { func init() { rootCmd.AddCommand(findAllShardsInKeyspaceCmd) + rootCmd.AddCommand(getCellInfoNamesCmd) + rootCmd.AddCommand(getCellInfoCmd) + rootCmd.AddCommand(getCellsAliasesCmd) rootCmd.AddCommand(getKeyspaceCmd) rootCmd.AddCommand(getKeyspacesCmd) diff --git a/go/cmd/vtctldclient/json.go b/go/cmd/vtctldclient/json.go new file mode 100644 index 00000000000..b7cb3eeff0e --- /dev/null +++ b/go/cmd/vtctldclient/json.go @@ -0,0 +1,61 @@ +/* +Copyright 2021 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. +*/ + +package main + +import ( + "bytes" + "encoding/json" + "fmt" + + "github.com/golang/protobuf/jsonpb" + "github.com/golang/protobuf/proto" +) + +// MarshalJSON marshals obj to a JSON string. It uses the jsonpb marshaler for +// proto.Message types, with some sensible defaults, and falls back to the +// standard Go marshaler otherwise. In both cases, the marshaled JSON is +// indented with two spaces for readability. +// +// Unfortunately jsonpb only works for types that implement proto.Message, +// either by being a proto message type or by anonymously embedding one, so for +// other types that may have nested struct fields, we still use the standard Go +// marshaler, which will result in different formattings. +func MarshalJSON(obj interface{}) ([]byte, error) { + switch obj := obj.(type) { + case proto.Message: + b := bytes.NewBuffer(nil) + m := jsonpb.Marshaler{ + EnumsAsInts: false, + EmitDefaults: true, + Indent: " ", + OrigName: true, + } + + if err := m.Marshal(b, obj); err != nil { + return nil, fmt.Errorf("jsonpb.Marshal = %v", err) + } + + return b.Bytes(), nil + default: + data, err := json.MarshalIndent(obj, "", " ") + if err != nil { + return nil, fmt.Errorf("json.Marshal = %v", err) + } + + return data, nil + } +} diff --git a/go/vt/proto/vtctldata/vtctldata.pb.go b/go/vt/proto/vtctldata/vtctldata.pb.go index 67e4403037a..0c35388f963 100644 --- a/go/vt/proto/vtctldata/vtctldata.pb.go +++ b/go/vt/proto/vtctldata/vtctldata.pb.go @@ -113,6 +113,224 @@ func (m *ExecuteVtctlCommandResponse) GetEvent() *logutil.Event { return nil } +type GetCellInfoNamesRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetCellInfoNamesRequest) Reset() { *m = GetCellInfoNamesRequest{} } +func (m *GetCellInfoNamesRequest) String() string { return proto.CompactTextString(m) } +func (*GetCellInfoNamesRequest) ProtoMessage() {} +func (*GetCellInfoNamesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f41247b323a1ab2e, []int{2} +} + +func (m *GetCellInfoNamesRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetCellInfoNamesRequest.Unmarshal(m, b) +} +func (m *GetCellInfoNamesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetCellInfoNamesRequest.Marshal(b, m, deterministic) +} +func (m *GetCellInfoNamesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetCellInfoNamesRequest.Merge(m, src) +} +func (m *GetCellInfoNamesRequest) XXX_Size() int { + return xxx_messageInfo_GetCellInfoNamesRequest.Size(m) +} +func (m *GetCellInfoNamesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetCellInfoNamesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetCellInfoNamesRequest proto.InternalMessageInfo + +type GetCellInfoNamesResponse struct { + Names []string `protobuf:"bytes,1,rep,name=names,proto3" json:"names,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetCellInfoNamesResponse) Reset() { *m = GetCellInfoNamesResponse{} } +func (m *GetCellInfoNamesResponse) String() string { return proto.CompactTextString(m) } +func (*GetCellInfoNamesResponse) ProtoMessage() {} +func (*GetCellInfoNamesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f41247b323a1ab2e, []int{3} +} + +func (m *GetCellInfoNamesResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetCellInfoNamesResponse.Unmarshal(m, b) +} +func (m *GetCellInfoNamesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetCellInfoNamesResponse.Marshal(b, m, deterministic) +} +func (m *GetCellInfoNamesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetCellInfoNamesResponse.Merge(m, src) +} +func (m *GetCellInfoNamesResponse) XXX_Size() int { + return xxx_messageInfo_GetCellInfoNamesResponse.Size(m) +} +func (m *GetCellInfoNamesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetCellInfoNamesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetCellInfoNamesResponse proto.InternalMessageInfo + +func (m *GetCellInfoNamesResponse) GetNames() []string { + if m != nil { + return m.Names + } + return nil +} + +type GetCellInfoRequest struct { + Cell string `protobuf:"bytes,1,opt,name=cell,proto3" json:"cell,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetCellInfoRequest) Reset() { *m = GetCellInfoRequest{} } +func (m *GetCellInfoRequest) String() string { return proto.CompactTextString(m) } +func (*GetCellInfoRequest) ProtoMessage() {} +func (*GetCellInfoRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f41247b323a1ab2e, []int{4} +} + +func (m *GetCellInfoRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetCellInfoRequest.Unmarshal(m, b) +} +func (m *GetCellInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetCellInfoRequest.Marshal(b, m, deterministic) +} +func (m *GetCellInfoRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetCellInfoRequest.Merge(m, src) +} +func (m *GetCellInfoRequest) XXX_Size() int { + return xxx_messageInfo_GetCellInfoRequest.Size(m) +} +func (m *GetCellInfoRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetCellInfoRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetCellInfoRequest proto.InternalMessageInfo + +func (m *GetCellInfoRequest) GetCell() string { + if m != nil { + return m.Cell + } + return "" +} + +type GetCellInfoResponse struct { + CellInfo *topodata.CellInfo `protobuf:"bytes,1,opt,name=cell_info,json=cellInfo,proto3" json:"cell_info,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetCellInfoResponse) Reset() { *m = GetCellInfoResponse{} } +func (m *GetCellInfoResponse) String() string { return proto.CompactTextString(m) } +func (*GetCellInfoResponse) ProtoMessage() {} +func (*GetCellInfoResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f41247b323a1ab2e, []int{5} +} + +func (m *GetCellInfoResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetCellInfoResponse.Unmarshal(m, b) +} +func (m *GetCellInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetCellInfoResponse.Marshal(b, m, deterministic) +} +func (m *GetCellInfoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetCellInfoResponse.Merge(m, src) +} +func (m *GetCellInfoResponse) XXX_Size() int { + return xxx_messageInfo_GetCellInfoResponse.Size(m) +} +func (m *GetCellInfoResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetCellInfoResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetCellInfoResponse proto.InternalMessageInfo + +func (m *GetCellInfoResponse) GetCellInfo() *topodata.CellInfo { + if m != nil { + return m.CellInfo + } + return nil +} + +type GetCellsAliasesRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetCellsAliasesRequest) Reset() { *m = GetCellsAliasesRequest{} } +func (m *GetCellsAliasesRequest) String() string { return proto.CompactTextString(m) } +func (*GetCellsAliasesRequest) ProtoMessage() {} +func (*GetCellsAliasesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f41247b323a1ab2e, []int{6} +} + +func (m *GetCellsAliasesRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetCellsAliasesRequest.Unmarshal(m, b) +} +func (m *GetCellsAliasesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetCellsAliasesRequest.Marshal(b, m, deterministic) +} +func (m *GetCellsAliasesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetCellsAliasesRequest.Merge(m, src) +} +func (m *GetCellsAliasesRequest) XXX_Size() int { + return xxx_messageInfo_GetCellsAliasesRequest.Size(m) +} +func (m *GetCellsAliasesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetCellsAliasesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetCellsAliasesRequest proto.InternalMessageInfo + +type GetCellsAliasesResponse struct { + Aliases map[string]*topodata.CellsAlias `protobuf:"bytes,1,rep,name=aliases,proto3" json:"aliases,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetCellsAliasesResponse) Reset() { *m = GetCellsAliasesResponse{} } +func (m *GetCellsAliasesResponse) String() string { return proto.CompactTextString(m) } +func (*GetCellsAliasesResponse) ProtoMessage() {} +func (*GetCellsAliasesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f41247b323a1ab2e, []int{7} +} + +func (m *GetCellsAliasesResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetCellsAliasesResponse.Unmarshal(m, b) +} +func (m *GetCellsAliasesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetCellsAliasesResponse.Marshal(b, m, deterministic) +} +func (m *GetCellsAliasesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetCellsAliasesResponse.Merge(m, src) +} +func (m *GetCellsAliasesResponse) XXX_Size() int { + return xxx_messageInfo_GetCellsAliasesResponse.Size(m) +} +func (m *GetCellsAliasesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetCellsAliasesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetCellsAliasesResponse proto.InternalMessageInfo + +func (m *GetCellsAliasesResponse) GetAliases() map[string]*topodata.CellsAlias { + if m != nil { + return m.Aliases + } + return nil +} + type GetKeyspacesRequest struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -123,7 +341,7 @@ func (m *GetKeyspacesRequest) Reset() { *m = GetKeyspacesRequest{} } func (m *GetKeyspacesRequest) String() string { return proto.CompactTextString(m) } func (*GetKeyspacesRequest) ProtoMessage() {} func (*GetKeyspacesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f41247b323a1ab2e, []int{2} + return fileDescriptor_f41247b323a1ab2e, []int{8} } func (m *GetKeyspacesRequest) XXX_Unmarshal(b []byte) error { @@ -155,7 +373,7 @@ func (m *GetKeyspacesResponse) Reset() { *m = GetKeyspacesResponse{} } func (m *GetKeyspacesResponse) String() string { return proto.CompactTextString(m) } func (*GetKeyspacesResponse) ProtoMessage() {} func (*GetKeyspacesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f41247b323a1ab2e, []int{3} + return fileDescriptor_f41247b323a1ab2e, []int{9} } func (m *GetKeyspacesResponse) XXX_Unmarshal(b []byte) error { @@ -194,7 +412,7 @@ func (m *GetKeyspaceRequest) Reset() { *m = GetKeyspaceRequest{} } func (m *GetKeyspaceRequest) String() string { return proto.CompactTextString(m) } func (*GetKeyspaceRequest) ProtoMessage() {} func (*GetKeyspaceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f41247b323a1ab2e, []int{4} + return fileDescriptor_f41247b323a1ab2e, []int{10} } func (m *GetKeyspaceRequest) XXX_Unmarshal(b []byte) error { @@ -233,7 +451,7 @@ func (m *GetKeyspaceResponse) Reset() { *m = GetKeyspaceResponse{} } func (m *GetKeyspaceResponse) String() string { return proto.CompactTextString(m) } func (*GetKeyspaceResponse) ProtoMessage() {} func (*GetKeyspaceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f41247b323a1ab2e, []int{5} + return fileDescriptor_f41247b323a1ab2e, []int{11} } func (m *GetKeyspaceResponse) XXX_Unmarshal(b []byte) error { @@ -276,7 +494,7 @@ func (m *InitShardPrimaryRequest) Reset() { *m = InitShardPrimaryRequest func (m *InitShardPrimaryRequest) String() string { return proto.CompactTextString(m) } func (*InitShardPrimaryRequest) ProtoMessage() {} func (*InitShardPrimaryRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f41247b323a1ab2e, []int{6} + return fileDescriptor_f41247b323a1ab2e, []int{12} } func (m *InitShardPrimaryRequest) XXX_Unmarshal(b []byte) error { @@ -343,7 +561,7 @@ func (m *InitShardPrimaryResponse) Reset() { *m = InitShardPrimaryRespon func (m *InitShardPrimaryResponse) String() string { return proto.CompactTextString(m) } func (*InitShardPrimaryResponse) ProtoMessage() {} func (*InitShardPrimaryResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f41247b323a1ab2e, []int{7} + return fileDescriptor_f41247b323a1ab2e, []int{13} } func (m *InitShardPrimaryResponse) XXX_Unmarshal(b []byte) error { @@ -383,7 +601,7 @@ func (m *Keyspace) Reset() { *m = Keyspace{} } func (m *Keyspace) String() string { return proto.CompactTextString(m) } func (*Keyspace) ProtoMessage() {} func (*Keyspace) Descriptor() ([]byte, []int) { - return fileDescriptor_f41247b323a1ab2e, []int{8} + return fileDescriptor_f41247b323a1ab2e, []int{14} } func (m *Keyspace) XXX_Unmarshal(b []byte) error { @@ -429,7 +647,7 @@ func (m *FindAllShardsInKeyspaceRequest) Reset() { *m = FindAllShardsInK func (m *FindAllShardsInKeyspaceRequest) String() string { return proto.CompactTextString(m) } func (*FindAllShardsInKeyspaceRequest) ProtoMessage() {} func (*FindAllShardsInKeyspaceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f41247b323a1ab2e, []int{9} + return fileDescriptor_f41247b323a1ab2e, []int{15} } func (m *FindAllShardsInKeyspaceRequest) XXX_Unmarshal(b []byte) error { @@ -468,7 +686,7 @@ func (m *FindAllShardsInKeyspaceResponse) Reset() { *m = FindAllShardsIn func (m *FindAllShardsInKeyspaceResponse) String() string { return proto.CompactTextString(m) } func (*FindAllShardsInKeyspaceResponse) ProtoMessage() {} func (*FindAllShardsInKeyspaceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f41247b323a1ab2e, []int{10} + return fileDescriptor_f41247b323a1ab2e, []int{16} } func (m *FindAllShardsInKeyspaceResponse) XXX_Unmarshal(b []byte) error { @@ -509,7 +727,7 @@ func (m *Shard) Reset() { *m = Shard{} } func (m *Shard) String() string { return proto.CompactTextString(m) } func (*Shard) ProtoMessage() {} func (*Shard) Descriptor() ([]byte, []int) { - return fileDescriptor_f41247b323a1ab2e, []int{11} + return fileDescriptor_f41247b323a1ab2e, []int{17} } func (m *Shard) XXX_Unmarshal(b []byte) error { @@ -569,7 +787,7 @@ func (m *TableMaterializeSettings) Reset() { *m = TableMaterializeSettin func (m *TableMaterializeSettings) String() string { return proto.CompactTextString(m) } func (*TableMaterializeSettings) ProtoMessage() {} func (*TableMaterializeSettings) Descriptor() ([]byte, []int) { - return fileDescriptor_f41247b323a1ab2e, []int{12} + return fileDescriptor_f41247b323a1ab2e, []int{18} } func (m *TableMaterializeSettings) XXX_Unmarshal(b []byte) error { @@ -632,7 +850,7 @@ func (m *MaterializeSettings) Reset() { *m = MaterializeSettings{} } func (m *MaterializeSettings) String() string { return proto.CompactTextString(m) } func (*MaterializeSettings) ProtoMessage() {} func (*MaterializeSettings) Descriptor() ([]byte, []int) { - return fileDescriptor_f41247b323a1ab2e, []int{13} + return fileDescriptor_f41247b323a1ab2e, []int{19} } func (m *MaterializeSettings) XXX_Unmarshal(b []byte) error { @@ -705,6 +923,13 @@ func (m *MaterializeSettings) GetTabletTypes() string { func init() { proto.RegisterType((*ExecuteVtctlCommandRequest)(nil), "vtctldata.ExecuteVtctlCommandRequest") proto.RegisterType((*ExecuteVtctlCommandResponse)(nil), "vtctldata.ExecuteVtctlCommandResponse") + proto.RegisterType((*GetCellInfoNamesRequest)(nil), "vtctldata.GetCellInfoNamesRequest") + proto.RegisterType((*GetCellInfoNamesResponse)(nil), "vtctldata.GetCellInfoNamesResponse") + proto.RegisterType((*GetCellInfoRequest)(nil), "vtctldata.GetCellInfoRequest") + proto.RegisterType((*GetCellInfoResponse)(nil), "vtctldata.GetCellInfoResponse") + proto.RegisterType((*GetCellsAliasesRequest)(nil), "vtctldata.GetCellsAliasesRequest") + proto.RegisterType((*GetCellsAliasesResponse)(nil), "vtctldata.GetCellsAliasesResponse") + proto.RegisterMapType((map[string]*topodata.CellsAlias)(nil), "vtctldata.GetCellsAliasesResponse.AliasesEntry") proto.RegisterType((*GetKeyspacesRequest)(nil), "vtctldata.GetKeyspacesRequest") proto.RegisterType((*GetKeyspacesResponse)(nil), "vtctldata.GetKeyspacesResponse") proto.RegisterType((*GetKeyspaceRequest)(nil), "vtctldata.GetKeyspaceRequest") @@ -723,54 +948,61 @@ func init() { func init() { proto.RegisterFile("vtctldata.proto", fileDescriptor_f41247b323a1ab2e) } var fileDescriptor_f41247b323a1ab2e = []byte{ - // 778 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0x5d, 0x8f, 0xdb, 0x44, - 0x14, 0x95, 0x93, 0x4d, 0x88, 0x6f, 0x48, 0xb2, 0x4c, 0xba, 0xaa, 0x31, 0xa2, 0x04, 0x43, 0xd3, - 0x48, 0x48, 0x0e, 0x14, 0x09, 0x21, 0xc4, 0xcb, 0x76, 0x9b, 0xa2, 0xa5, 0x6a, 0x85, 0xa6, 0x2b, - 0x90, 0x78, 0xc0, 0x9a, 0xb5, 0x27, 0xc1, 0xda, 0x89, 0xc7, 0xcc, 0x8c, 0xb3, 0x0d, 0xcf, 0xbc, - 0xf0, 0x67, 0xf8, 0x09, 0xfc, 0x36, 0xe4, 0xf9, 0x70, 0xbc, 0x65, 0x97, 0x8f, 0xb7, 0x99, 0x73, - 0xe7, 0xde, 0x7b, 0xee, 0xb9, 0x27, 0x31, 0x4c, 0x76, 0x2a, 0x55, 0x2c, 0x23, 0x8a, 0xc4, 0xa5, - 0xe0, 0x8a, 0x23, 0xbf, 0x01, 0xc2, 0x11, 0xe3, 0x9b, 0x4a, 0xe5, 0xcc, 0x44, 0xc2, 0xb1, 0xe2, - 0x25, 0x3f, 0xbc, 0x0c, 0x1f, 0x6c, 0x38, 0xdf, 0x30, 0xba, 0xd4, 0xb7, 0xcb, 0x6a, 0xbd, 0xcc, - 0x2a, 0x41, 0x54, 0xce, 0x0b, 0x13, 0x8f, 0x7e, 0x80, 0x70, 0xf5, 0x9a, 0xa6, 0x95, 0xa2, 0xd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 0x30, 0xd6, 0xaa, 0x24, 0xd2, 0xf2, 0x0c, 0x7a, 0xda, 0x3e, 0x1f, 0xb5, 0xd6, 0x79, - 0x97, 0xb2, 0x78, 0xa4, 0x53, 0x9b, 0x09, 0x11, 0x1c, 0xa5, 0x94, 0xb1, 0xa0, 0x6f, 0x16, 0x58, - 0x9f, 0x8d, 0xf8, 0xfa, 0x7f, 0x43, 0xed, 0x4b, 0x2a, 0x83, 0xb7, 0x9c, 0xf8, 0x35, 0x76, 0x51, - 0x43, 0x4f, 0x16, 0x3f, 0xce, 0x77, 0xb9, 0xa2, 0x52, 0xc6, 0x39, 0x5f, 0x9a, 0xd3, 0x72, 0xc3, - 0x97, 0x3b, 0x65, 0x3e, 0x31, 0xcb, 0x86, 0xc8, 0x65, 0x5f, 0x03, 0x9f, 0xff, 0x15, 0x00, 0x00, - 0xff, 0xff, 0x0a, 0x35, 0x2b, 0x50, 0xbe, 0x06, 0x00, 0x00, + // 896 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0xdf, 0x6f, 0xdb, 0x54, + 0x14, 0x56, 0xd2, 0xa5, 0x8b, 0x4f, 0xd6, 0xa4, 0xdc, 0xb6, 0xd4, 0x33, 0x62, 0x14, 0xc3, 0xba, + 0x08, 0x24, 0x67, 0x14, 0x09, 0x21, 0xc4, 0x4b, 0xd7, 0x65, 0x28, 0x4c, 0xab, 0x26, 0xaf, 0x02, + 0x89, 0x07, 0xac, 0x5b, 0xe7, 0x24, 0x58, 0xbd, 0xf1, 0x35, 0xbe, 0x37, 0xe9, 0xc2, 0x33, 0x2f, + 0xfc, 0x33, 0x3c, 0xf2, 0xc8, 0xdf, 0x86, 0xee, 0x2f, 0xdb, 0xd9, 0x5a, 0x60, 0x6f, 0xf7, 0x7e, + 0xe7, 0x7e, 0xe7, 0xc7, 0x77, 0xce, 0xb1, 0x61, 0xb0, 0x92, 0xa9, 0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xdf, 0xd1, 0xe3, 0xf3, 0x49, 0xa3, 0x9d, 0xb7, 0x29, 0x1b, 0xef, 0x68, 0x6a, 0x55, + 0xa1, 0xfb, 0x15, 0x6d, 0xd7, 0xbf, 0x22, 0x23, 0xbe, 0xfe, 0x6e, 0xc8, 0x75, 0x81, 0xc2, 0xbf, + 0xeb, 0xc4, 0x57, 0xd8, 0x85, 0x82, 0x9e, 0x0c, 0x7f, 0x3a, 0x5e, 0x65, 0x12, 0x85, 0x88, 0x32, + 0x3e, 0x32, 0xa7, 0xd1, 0x9c, 0x8f, 0x56, 0xd2, 0xfc, 0xf4, 0x47, 0x55, 0x22, 0x97, 0xdb, 0x1a, + 0xf8, 0xf2, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd7, 0x9d, 0x28, 0x4a, 0x50, 0x08, 0x00, 0x00, } diff --git a/go/vt/proto/vtctlservice/vtctlservice.pb.go b/go/vt/proto/vtctlservice/vtctlservice.pb.go index 4ff9e86487e..453d9b966ee 100644 --- a/go/vt/proto/vtctlservice/vtctlservice.pb.go +++ b/go/vt/proto/vtctlservice/vtctlservice.pb.go @@ -29,24 +29,27 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package func init() { proto.RegisterFile("vtctlservice.proto", fileDescriptor_27055cdbb1148d2b) } var fileDescriptor_27055cdbb1148d2b = []byte{ - // 263 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xdf, 0x4b, 0xc3, 0x30, - 0x10, 0xc7, 0x55, 0x70, 0x0f, 0x71, 0xa0, 0x9c, 0x0f, 0xc2, 0x40, 0x85, 0x89, 0xc2, 0x14, 0x1a, - 0x99, 0x7f, 0x81, 0x8a, 0xca, 0x10, 0xc4, 0x1f, 0xe0, 0x83, 0xe0, 0x43, 0x6c, 0x0e, 0x17, 0x68, - 0x93, 0x2e, 0x77, 0x2b, 0xee, 0x9f, 0x17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0x9d, 0xac, 0x59, - 0x86, 0x9b, 0x90, 0xe9, 0xc5, 0xbc, 0xf4, 0x82, 0x76, 0xf2, 0x11, 0x00, 0x00, 0xff, 0xff, 0xae, - 0x74, 0xb6, 0x52, 0x5c, 0x02, 0x00, 0x00, + // 320 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x5f, 0x4b, 0xf3, 0x30, + 0x14, 0xc6, 0xdf, 0xf7, 0x62, 0xbb, 0x88, 0x83, 0x49, 0xbc, 0x10, 0x06, 0x4e, 0xac, 0x28, 0x4c, + 0xa1, 0x95, 0xf9, 0x09, 0xe6, 0x50, 0x29, 0xc2, 0xf0, 0x0f, 0x78, 0x31, 0xf0, 0x22, 0xb6, 0x47, + 0x17, 0x48, 0x93, 0x2e, 0x27, 0x2b, 0xee, 0x23, 0xf8, 0xad, 0xc5, 0xcc, 0xd4, 0xd8, 0xb5, 0xd3, + 0xbb, 0xe4, 0xfc, 0x9e, 0xf3, 0xe4, 0x90, 0x87, 0x43, 0x68, 0x61, 0x12, 0x23, 0x10, 0x74, 0xc1, + 0x13, 0x08, 0x73, 0xad, 0x8c, 0xa2, 0x1d, 0xbf, 0xd6, 0xeb, 0xda, 0x5b, 0xca, 0x0c, 0x5b, 0xe1, + 0xe1, 0x9c, 0xb4, 0x1e, 0x3f, 0x4b, 0x74, 0x46, 0x76, 0x2e, 0xdf, 0x20, 0x59, 0x18, 0xb0, 0xf7, + 0xb1, 0xca, 0x32, 0x26, 0x53, 0x7a, 0x14, 0x7e, 0x77, 0xd4, 0xf0, 0x7b, 0x98, 0x2f, 0x00, 0x4d, + 0xef, 0xf8, 0x37, 0x19, 0xe6, 0x4a, 0x22, 0x04, 0xff, 0xce, 0xfe, 0x0f, 0xdf, 0x5b, 0xa4, 0x6d, + 0x61, 0x4a, 0x35, 0xd9, 0xbd, 0xe2, 0x32, 0x1d, 0x09, 0xf1, 0x30, 0x63, 0x3a, 0xc5, 0x58, 0xde, + 0xc0, 0x12, 0x73, 0x96, 0x00, 0x1d, 0x78, 0x8e, 0x0d, 0x1a, 0xf7, 0xf8, 0xc9, 0x5f, 0xa4, 0x6e, + 0x00, 0xfa, 0x44, 0xb6, 0xaf, 0xc1, 0x8c, 0x41, 0x88, 0x58, 0xbe, 0xa8, 0x09, 0xcb, 0x00, 0x69, + 0xe0, 0x39, 0x54, 0xa1, 0x7b, 0xe5, 0x70, 0xa3, 0xa6, 0xb4, 0x9f, 0x90, 0x2d, 0x8f, 0xd2, 0xbd, + 0xfa, 0x2e, 0x67, 0xda, 0x6f, 0xc2, 0xa5, 0xdf, 0x94, 0x74, 0xbf, 0x00, 0x8e, 0x04, 0x67, 0x08, + 0x48, 0x0f, 0xd6, 0x9b, 0x1c, 0x73, 0xbe, 0xc1, 0x26, 0x49, 0x65, 0xd6, 0xf2, 0xcb, 0x2b, 0xb3, + 0x56, 0xbf, 0xb9, 0xdf, 0x84, 0x4b, 0xbf, 0x3b, 0xd2, 0xf1, 0x00, 0xd2, 0x86, 0x8e, 0x72, 0xca, + 0xfd, 0x46, 0xee, 0xa7, 0x15, 0x4b, 0x6e, 0x6c, 0x9e, 0xb7, 0x9a, 0x67, 0x4c, 0x2f, 0x7f, 0xa4, + 0x55, 0x85, 0x75, 0x69, 0xad, 0x6b, 0x9c, 0xfd, 0xc5, 0xe9, 0x74, 0x50, 0x70, 0x03, 0x88, 0x21, + 0x57, 0xd1, 0xea, 0x14, 0xbd, 0xaa, 0xa8, 0x30, 0x91, 0x5d, 0x8f, 0xc8, 0x5f, 0x9e, 0xe7, 0xb6, + 0xad, 0x9d, 0x7f, 0x04, 0x00, 0x00, 0xff, 0xff, 0x79, 0x0f, 0x93, 0xa5, 0x67, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -160,8 +163,17 @@ var _Vtctl_serviceDesc = grpc.ServiceDesc{ // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type VtctldClient interface { - // FindAllShardsInKeyspace returns a map of shard names to shard references for a given keyspace. + // FindAllShardsInKeyspace returns a map of shard names to shard references + // for a given keyspace. FindAllShardsInKeyspace(ctx context.Context, in *vtctldata.FindAllShardsInKeyspaceRequest, opts ...grpc.CallOption) (*vtctldata.FindAllShardsInKeyspaceResponse, error) + // GetCellInfoNames returns all the cells for which we have a CellInfo object, + // meaning we have a topology service registered. + GetCellInfoNames(ctx context.Context, in *vtctldata.GetCellInfoNamesRequest, opts ...grpc.CallOption) (*vtctldata.GetCellInfoNamesResponse, error) + // GetCellInfo returns the information for a cell. + GetCellInfo(ctx context.Context, in *vtctldata.GetCellInfoRequest, opts ...grpc.CallOption) (*vtctldata.GetCellInfoResponse, error) + // GetCellsAliases returns a mapping of cell alias to cells identified by that + // alias. + GetCellsAliases(ctx context.Context, in *vtctldata.GetCellsAliasesRequest, opts ...grpc.CallOption) (*vtctldata.GetCellsAliasesResponse, error) // GetKeyspace reads the given keyspace from the topo and returns it. GetKeyspace(ctx context.Context, in *vtctldata.GetKeyspaceRequest, opts ...grpc.CallOption) (*vtctldata.GetKeyspaceResponse, error) // GetKeyspaces returns the keyspace struct of all keyspaces in the topo. @@ -192,6 +204,33 @@ func (c *vtctldClient) FindAllShardsInKeyspace(ctx context.Context, in *vtctldat return out, nil } +func (c *vtctldClient) GetCellInfoNames(ctx context.Context, in *vtctldata.GetCellInfoNamesRequest, opts ...grpc.CallOption) (*vtctldata.GetCellInfoNamesResponse, error) { + out := new(vtctldata.GetCellInfoNamesResponse) + err := c.cc.Invoke(ctx, "/vtctlservice.Vtctld/GetCellInfoNames", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *vtctldClient) GetCellInfo(ctx context.Context, in *vtctldata.GetCellInfoRequest, opts ...grpc.CallOption) (*vtctldata.GetCellInfoResponse, error) { + out := new(vtctldata.GetCellInfoResponse) + err := c.cc.Invoke(ctx, "/vtctlservice.Vtctld/GetCellInfo", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *vtctldClient) GetCellsAliases(ctx context.Context, in *vtctldata.GetCellsAliasesRequest, opts ...grpc.CallOption) (*vtctldata.GetCellsAliasesResponse, error) { + out := new(vtctldata.GetCellsAliasesResponse) + err := c.cc.Invoke(ctx, "/vtctlservice.Vtctld/GetCellsAliases", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *vtctldClient) GetKeyspace(ctx context.Context, in *vtctldata.GetKeyspaceRequest, opts ...grpc.CallOption) (*vtctldata.GetKeyspaceResponse, error) { out := new(vtctldata.GetKeyspaceResponse) err := c.cc.Invoke(ctx, "/vtctlservice.Vtctld/GetKeyspace", in, out, opts...) @@ -221,8 +260,17 @@ func (c *vtctldClient) InitShardPrimary(ctx context.Context, in *vtctldata.InitS // VtctldServer is the server API for Vtctld service. type VtctldServer interface { - // FindAllShardsInKeyspace returns a map of shard names to shard references for a given keyspace. + // FindAllShardsInKeyspace returns a map of shard names to shard references + // for a given keyspace. FindAllShardsInKeyspace(context.Context, *vtctldata.FindAllShardsInKeyspaceRequest) (*vtctldata.FindAllShardsInKeyspaceResponse, error) + // GetCellInfoNames returns all the cells for which we have a CellInfo object, + // meaning we have a topology service registered. + GetCellInfoNames(context.Context, *vtctldata.GetCellInfoNamesRequest) (*vtctldata.GetCellInfoNamesResponse, error) + // GetCellInfo returns the information for a cell. + GetCellInfo(context.Context, *vtctldata.GetCellInfoRequest) (*vtctldata.GetCellInfoResponse, error) + // GetCellsAliases returns a mapping of cell alias to cells identified by that + // alias. + GetCellsAliases(context.Context, *vtctldata.GetCellsAliasesRequest) (*vtctldata.GetCellsAliasesResponse, error) // GetKeyspace reads the given keyspace from the topo and returns it. GetKeyspace(context.Context, *vtctldata.GetKeyspaceRequest) (*vtctldata.GetKeyspaceResponse, error) // GetKeyspaces returns the keyspace struct of all keyspaces in the topo. @@ -243,6 +291,15 @@ type UnimplementedVtctldServer struct { func (*UnimplementedVtctldServer) FindAllShardsInKeyspace(ctx context.Context, req *vtctldata.FindAllShardsInKeyspaceRequest) (*vtctldata.FindAllShardsInKeyspaceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method FindAllShardsInKeyspace not implemented") } +func (*UnimplementedVtctldServer) GetCellInfoNames(ctx context.Context, req *vtctldata.GetCellInfoNamesRequest) (*vtctldata.GetCellInfoNamesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetCellInfoNames not implemented") +} +func (*UnimplementedVtctldServer) GetCellInfo(ctx context.Context, req *vtctldata.GetCellInfoRequest) (*vtctldata.GetCellInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetCellInfo not implemented") +} +func (*UnimplementedVtctldServer) GetCellsAliases(ctx context.Context, req *vtctldata.GetCellsAliasesRequest) (*vtctldata.GetCellsAliasesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetCellsAliases not implemented") +} func (*UnimplementedVtctldServer) GetKeyspace(ctx context.Context, req *vtctldata.GetKeyspaceRequest) (*vtctldata.GetKeyspaceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetKeyspace not implemented") } @@ -275,6 +332,60 @@ func _Vtctld_FindAllShardsInKeyspace_Handler(srv interface{}, ctx context.Contex return interceptor(ctx, in, info, handler) } +func _Vtctld_GetCellInfoNames_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(vtctldata.GetCellInfoNamesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(VtctldServer).GetCellInfoNames(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vtctlservice.Vtctld/GetCellInfoNames", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(VtctldServer).GetCellInfoNames(ctx, req.(*vtctldata.GetCellInfoNamesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Vtctld_GetCellInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(vtctldata.GetCellInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(VtctldServer).GetCellInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vtctlservice.Vtctld/GetCellInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(VtctldServer).GetCellInfo(ctx, req.(*vtctldata.GetCellInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Vtctld_GetCellsAliases_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(vtctldata.GetCellsAliasesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(VtctldServer).GetCellsAliases(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vtctlservice.Vtctld/GetCellsAliases", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(VtctldServer).GetCellsAliases(ctx, req.(*vtctldata.GetCellsAliasesRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Vtctld_GetKeyspace_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(vtctldata.GetKeyspaceRequest) if err := dec(in); err != nil { @@ -337,6 +448,18 @@ var _Vtctld_serviceDesc = grpc.ServiceDesc{ MethodName: "FindAllShardsInKeyspace", Handler: _Vtctld_FindAllShardsInKeyspace_Handler, }, + { + MethodName: "GetCellInfoNames", + Handler: _Vtctld_GetCellInfoNames_Handler, + }, + { + MethodName: "GetCellInfo", + Handler: _Vtctld_GetCellInfo_Handler, + }, + { + MethodName: "GetCellsAliases", + Handler: _Vtctld_GetCellsAliases_Handler, + }, { MethodName: "GetKeyspace", Handler: _Vtctld_GetKeyspace_Handler, diff --git a/go/vt/vtctl/grpcvtctldclient/client_gen.go b/go/vt/vtctl/grpcvtctldclient/client_gen.go index 42d47095e0d..6e50ca8958a 100644 --- a/go/vt/vtctl/grpcvtctldclient/client_gen.go +++ b/go/vt/vtctl/grpcvtctldclient/client_gen.go @@ -37,6 +37,33 @@ func (client *gRPCVtctldClient) FindAllShardsInKeyspace(ctx context.Context, in return client.c.FindAllShardsInKeyspace(ctx, in, opts...) } +// GetCellInfo is part of the vtctlservicepb.VtctldClient interface. +func (client *gRPCVtctldClient) GetCellInfo(ctx context.Context, in *vtctldatapb.GetCellInfoRequest, opts ...grpc.CallOption) (*vtctldatapb.GetCellInfoResponse, error) { + if client.c == nil { + return nil, status.Error(codes.Unavailable, connClosedMsg) + } + + return client.c.GetCellInfo(ctx, in, opts...) +} + +// GetCellInfoNames is part of the vtctlservicepb.VtctldClient interface. +func (client *gRPCVtctldClient) GetCellInfoNames(ctx context.Context, in *vtctldatapb.GetCellInfoNamesRequest, opts ...grpc.CallOption) (*vtctldatapb.GetCellInfoNamesResponse, error) { + if client.c == nil { + return nil, status.Error(codes.Unavailable, connClosedMsg) + } + + return client.c.GetCellInfoNames(ctx, in, opts...) +} + +// GetCellsAliases is part of the vtctlservicepb.VtctldClient interface. +func (client *gRPCVtctldClient) GetCellsAliases(ctx context.Context, in *vtctldatapb.GetCellsAliasesRequest, opts ...grpc.CallOption) (*vtctldatapb.GetCellsAliasesResponse, error) { + if client.c == nil { + return nil, status.Error(codes.Unavailable, connClosedMsg) + } + + return client.c.GetCellsAliases(ctx, in, opts...) +} + // GetKeyspace is part of the vtctlservicepb.VtctldClient interface. func (client *gRPCVtctldClient) GetKeyspace(ctx context.Context, in *vtctldatapb.GetKeyspaceRequest, opts ...grpc.CallOption) (*vtctldatapb.GetKeyspaceResponse, error) { if client.c == nil { diff --git a/go/vt/vtctl/grpcvtctldserver/server.go b/go/vt/vtctl/grpcvtctldserver/server.go index db0ee1c40a3..6ff1c8093d3 100644 --- a/go/vt/vtctl/grpcvtctldserver/server.go +++ b/go/vt/vtctl/grpcvtctldserver/server.go @@ -78,6 +78,44 @@ func (s *VtctldServer) FindAllShardsInKeyspace(ctx context.Context, req *vtctlda }, nil } +// GetCellInfoNames is part of the vtctlservicepb.VtctldServer interface. +func (s *VtctldServer) GetCellInfoNames(ctx context.Context, req *vtctldatapb.GetCellInfoNamesRequest) (*vtctldatapb.GetCellInfoNamesResponse, error) { + names, err := s.ts.GetCellInfoNames(ctx) + if err != nil { + return nil, err + } + + return &vtctldatapb.GetCellInfoNamesResponse{Names: names}, nil +} + +// GetCellInfo is part of the vtctlservicepb.VtctldServer interface. +func (s *VtctldServer) GetCellInfo(ctx context.Context, req *vtctldatapb.GetCellInfoRequest) (*vtctldatapb.GetCellInfoResponse, error) { + if req.Cell == "" { + return nil, vterrors.Errorf(vtrpc.Code_INVALID_ARGUMENT, "cell field is required") + } + + // We use a strong read, because users using this command want the latest + // data, and this is user-generated, not used in any automated process. + strongRead := true + ci, err := s.ts.GetCellInfo(ctx, req.Cell, strongRead) + if err != nil { + return nil, err + } + + return &vtctldatapb.GetCellInfoResponse{CellInfo: ci}, nil +} + +// GetCellsAliases is part of the vtctlservicepb.VtctldServer interface. +func (s *VtctldServer) GetCellsAliases(ctx context.Context, req *vtctldatapb.GetCellsAliasesRequest) (*vtctldatapb.GetCellsAliasesResponse, error) { + strongRead := true + aliases, err := s.ts.GetCellsAliases(ctx, strongRead) + if err != nil { + return nil, err + } + + return &vtctldatapb.GetCellsAliasesResponse{Aliases: aliases}, nil +} + // GetKeyspace is part of the vtctlservicepb.VtctldServer interface. func (s *VtctldServer) GetKeyspace(ctx context.Context, req *vtctldatapb.GetKeyspaceRequest) (*vtctldatapb.GetKeyspaceResponse, error) { keyspace, err := s.ts.GetKeyspace(ctx, req.Keyspace) diff --git a/go/vt/vtctl/grpcvtctldserver/server_test.go b/go/vt/vtctl/grpcvtctldserver/server_test.go index eb16e7538b2..0bd54106b3c 100644 --- a/go/vt/vtctl/grpcvtctldserver/server_test.go +++ b/go/vt/vtctl/grpcvtctldserver/server_test.go @@ -19,6 +19,7 @@ package grpcvtctldserver import ( "context" "errors" + "fmt" "testing" "github.com/stretchr/testify/assert" @@ -93,6 +94,88 @@ func TestGetKeyspace(t *testing.T) { assert.Error(t, err) } +func TestGetCellInfoNames(t *testing.T) { + ctx := context.Background() + ts := memorytopo.NewServer("cell1", "cell2", "cell3") + vtctld := NewVtctldServer(ts) + + resp, err := vtctld.GetCellInfoNames(ctx, &vtctldatapb.GetCellInfoNamesRequest{}) + assert.NoError(t, err) + assert.ElementsMatch(t, []string{"cell1", "cell2", "cell3"}, resp.Names) + + vtctld.ts = memorytopo.NewServer() + + resp, err = vtctld.GetCellInfoNames(ctx, &vtctldatapb.GetCellInfoNamesRequest{}) + assert.NoError(t, err) + assert.Empty(t, resp.Names) + + var topofactory *memorytopo.Factory + vtctld.ts, topofactory = memorytopo.NewServerAndFactory("cell1") + + topofactory.SetError(assert.AnError) + _, err = vtctld.GetCellInfoNames(ctx, &vtctldatapb.GetCellInfoNamesRequest{}) + assert.Error(t, err) +} + +func TestGetCellInfo(t *testing.T) { + ctx := context.Background() + ts := memorytopo.NewServer() + vtctld := NewVtctldServer(ts) + + expected := &topodatapb.CellInfo{ + ServerAddress: "example.com", + Root: "vitess", + } + input := *expected // shallow copy + require.NoError(t, ts.CreateCellInfo(ctx, "cell1", &input)) + + resp, err := vtctld.GetCellInfo(ctx, &vtctldatapb.GetCellInfoRequest{Cell: "cell1"}) + assert.NoError(t, err) + assert.Equal(t, expected, resp.CellInfo) + + _, err = vtctld.GetCellInfo(ctx, &vtctldatapb.GetCellInfoRequest{Cell: "does_not_exist"}) + assert.Error(t, err) + + _, err = vtctld.GetCellInfo(ctx, &vtctldatapb.GetCellInfoRequest{}) + assert.Error(t, err) +} + +func TestGetCellsAliases(t *testing.T) { + ctx := context.Background() + ts := memorytopo.NewServer("c11", "c12", "c13", "c21", "c22") + vtctld := NewVtctldServer(ts) + + alias1 := &topodatapb.CellsAlias{ + Cells: []string{"c11", "c12", "c13"}, + } + alias2 := &topodatapb.CellsAlias{ + Cells: []string{"c21", "c22"}, + } + + for i, alias := range []*topodatapb.CellsAlias{alias1, alias2} { + input := *alias // shallow copy + name := fmt.Sprintf("a%d", i+1) + + require.NoError(t, ts.CreateCellsAlias(ctx, name, &input), "cannot create cells alias %d (idx = %d) = %+v", i+1, i, &input) + } + + expected := map[string]*topodatapb.CellsAlias{ + "a1": alias1, + "a2": alias2, + } + + resp, err := vtctld.GetCellsAliases(ctx, &vtctldatapb.GetCellsAliasesRequest{}) + assert.NoError(t, err) + assert.Equal(t, expected, resp.Aliases) + + ts, topofactory := memorytopo.NewServerAndFactory() + vtctld.ts = ts + + topofactory.SetError(assert.AnError) + _, err = vtctld.GetCellsAliases(ctx, &vtctldatapb.GetCellsAliasesRequest{}) + assert.Error(t, err) +} + func TestGetKeyspaces(t *testing.T) { ctx := context.Background() ts, topofactory := memorytopo.NewServerAndFactory("cell1") diff --git a/proto/vtctldata.proto b/proto/vtctldata.proto index c9cc662ca7d..bdbd048fd5a 100644 --- a/proto/vtctldata.proto +++ b/proto/vtctldata.proto @@ -38,6 +38,28 @@ message ExecuteVtctlCommandResponse { logutil.Event event = 1; } +message GetCellInfoNamesRequest { +} + +message GetCellInfoNamesResponse { + repeated string names = 1; +} + +message GetCellInfoRequest { + string cell = 1; +} + +message GetCellInfoResponse { + topodata.CellInfo cell_info = 1; +} + +message GetCellsAliasesRequest { +} + +message GetCellsAliasesResponse { + map aliases = 1; +} + message GetKeyspacesRequest { } diff --git a/proto/vtctlservice.proto b/proto/vtctlservice.proto index 6c5b020469d..1dd2588f98c 100644 --- a/proto/vtctlservice.proto +++ b/proto/vtctlservice.proto @@ -31,8 +31,17 @@ service Vtctl { // Service Vtctld exposes gRPC endpoints for each vt command. service Vtctld { - // FindAllShardsInKeyspace returns a map of shard names to shard references for a given keyspace. + // FindAllShardsInKeyspace returns a map of shard names to shard references + // for a given keyspace. rpc FindAllShardsInKeyspace(vtctldata.FindAllShardsInKeyspaceRequest) returns (vtctldata.FindAllShardsInKeyspaceResponse) {}; + // GetCellInfoNames returns all the cells for which we have a CellInfo object, + // meaning we have a topology service registered. + rpc GetCellInfoNames(vtctldata.GetCellInfoNamesRequest) returns (vtctldata.GetCellInfoNamesResponse) {}; + // GetCellInfo returns the information for a cell. + rpc GetCellInfo(vtctldata.GetCellInfoRequest) returns (vtctldata.GetCellInfoResponse) {}; + // GetCellsAliases returns a mapping of cell alias to cells identified by that + // alias. + rpc GetCellsAliases(vtctldata.GetCellsAliasesRequest) returns (vtctldata.GetCellsAliasesResponse) {}; // GetKeyspace reads the given keyspace from the topo and returns it. rpc GetKeyspace(vtctldata.GetKeyspaceRequest) returns (vtctldata.GetKeyspaceResponse) {}; // GetKeyspaces returns the keyspace struct of all keyspaces in the topo.