зеркало из https://github.com/github/vitess-gh.git
Add ServingState to tablets, add helper function
Signed-off-by: Andrew Mason <amason@slack-corp.com>
This commit is contained in:
Родитель
a5c00df26c
Коммит
1d6b5a527d
|
@ -26,6 +26,34 @@ var _ = math.Inf
|
|||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
type Tablet_ServingState int32
|
||||
|
||||
const (
|
||||
Tablet_UNKNOWN Tablet_ServingState = 0
|
||||
Tablet_SERVING Tablet_ServingState = 1
|
||||
Tablet_NOT_SERVING Tablet_ServingState = 2
|
||||
)
|
||||
|
||||
var Tablet_ServingState_name = map[int32]string{
|
||||
0: "UNKNOWN",
|
||||
1: "SERVING",
|
||||
2: "NOT_SERVING",
|
||||
}
|
||||
|
||||
var Tablet_ServingState_value = map[string]int32{
|
||||
"UNKNOWN": 0,
|
||||
"SERVING": 1,
|
||||
"NOT_SERVING": 2,
|
||||
}
|
||||
|
||||
func (x Tablet_ServingState) String() string {
|
||||
return proto.EnumName(Tablet_ServingState_name, int32(x))
|
||||
}
|
||||
|
||||
func (Tablet_ServingState) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor_609739e22a0a50b3, []int{1, 0}
|
||||
}
|
||||
|
||||
// Cluster represents information about a Vitess cluster.
|
||||
type Cluster struct {
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
|
@ -77,11 +105,12 @@ func (m *Cluster) GetName() string {
|
|||
// Tablet groups the topo information of a tablet together with the Vitess
|
||||
// cluster it belongs to.
|
||||
type Tablet struct {
|
||||
Cluster *Cluster `protobuf:"bytes,1,opt,name=cluster,proto3" json:"cluster,omitempty"`
|
||||
Tablet *topodata.Tablet `protobuf:"bytes,2,opt,name=tablet,proto3" json:"tablet,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
Cluster *Cluster `protobuf:"bytes,1,opt,name=cluster,proto3" json:"cluster,omitempty"`
|
||||
Tablet *topodata.Tablet `protobuf:"bytes,2,opt,name=tablet,proto3" json:"tablet,omitempty"`
|
||||
State Tablet_ServingState `protobuf:"varint,3,opt,name=state,proto3,enum=vtadmin.Tablet_ServingState" json:"state,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Tablet) Reset() { *m = Tablet{} }
|
||||
|
@ -123,6 +152,13 @@ func (m *Tablet) GetTablet() *topodata.Tablet {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (m *Tablet) GetState() Tablet_ServingState {
|
||||
if m != nil {
|
||||
return m.State
|
||||
}
|
||||
return Tablet_UNKNOWN
|
||||
}
|
||||
|
||||
// VTGate represents information about a single VTGate host.
|
||||
type VTGate struct {
|
||||
// Hostname is the shortname of the VTGate.
|
||||
|
@ -409,6 +445,7 @@ func (m *GetTabletsResponse) GetTablets() []*Tablet {
|
|||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterEnum("vtadmin.Tablet_ServingState", Tablet_ServingState_name, Tablet_ServingState_value)
|
||||
proto.RegisterType((*Cluster)(nil), "vtadmin.Cluster")
|
||||
proto.RegisterType((*Tablet)(nil), "vtadmin.Tablet")
|
||||
proto.RegisterType((*VTGate)(nil), "vtadmin.VTGate")
|
||||
|
@ -422,33 +459,37 @@ func init() {
|
|||
func init() { proto.RegisterFile("vtadmin.proto", fileDescriptor_609739e22a0a50b3) }
|
||||
|
||||
var fileDescriptor_609739e22a0a50b3 = []byte{
|
||||
// 407 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x4f, 0xaf, 0xd2, 0x40,
|
||||
0x14, 0xc5, 0x69, 0x81, 0x96, 0x5e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, 0x54, 0x08, 0xca, 0xf9, 0xb4, 0x60, 0xb1, 0x3e, 0xc5, 0x5b, 0x16, 0x9f, 0x44,
|
||||
0xac, 0xfe, 0x9f, 0xd8, 0x84, 0xd7, 0x9e, 0xba, 0x7e, 0xb8, 0x0b, 0x00, 0x00, 0xff, 0xff, 0xc2,
|
||||
0xb1, 0xce, 0x36, 0x78, 0x03, 0x00, 0x00,
|
||||
// 473 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x5d, 0x8b, 0xd3, 0x40,
|
||||
0x14, 0x6d, 0xb2, 0xdb, 0x66, 0x73, 0xa3, 0x6d, 0xbd, 0x4f, 0x31, 0x2e, 0x58, 0x82, 0x4a, 0x15,
|
||||
0x6c, 0x20, 0xfa, 0xd2, 0x27, 0x59, 0x45, 0xca, 0x22, 0xa4, 0x30, 0xad, 0x15, 0x7c, 0x59, 0xb2,
|
||||
0xcd, 0x50, 0x83, 0xd9, 0x4e, 0xec, 0xcc, 0x16, 0x7c, 0xf7, 0xef, 0x09, 0xfe, 0x24, 0x99, 0x8f,
|
||||
0x4c, 0x77, 0xdb, 0x22, 0xbe, 0xdd, 0x7b, 0xee, 0x3d, 0x77, 0xce, 0x39, 0x24, 0xf0, 0x70, 0x2b,
|
||||
0xf2, 0xe2, 0xa6, 0x5c, 0x8f, 0xea, 0x0d, 0x13, 0x0c, 0x3d, 0xd3, 0x46, 0x5d, 0xc1, 0x6a, 0x56,
|
||||
0xe4, 0x22, 0xd7, 0x83, 0xf8, 0x35, 0x78, 0x1f, 0xaa, 0x5b, 0x2e, 0xe8, 0x06, 0xbb, 0xe0, 0x96,
|
||||
0x45, 0xe8, 0x0c, 0x9c, 0xa1, 0x4f, 0xdc, 0xb2, 0x40, 0x84, 0xd3, 0x75, 0x7e, 0x43, 0x43, 0x57,
|
||||
0x21, 0xaa, 0x8e, 0x7f, 0x3b, 0xd0,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, 0x16, 0x3c, 0x74, 0x14, 0x05, 0x0c, 0x74, 0x59, 0xf0, 0x78, 0x0c, 0xfd,
|
||||
0x1d, 0x87, 0xd7, 0x6c, 0xcd, 0x29, 0x3e, 0x87, 0xf6, 0x4a, 0x02, 0x6a, 0x3d, 0x48, 0x7b, 0x36,
|
||||
0x3d, 0xed, 0x91, 0xe8, 0x69, 0x3c, 0x55, 0x54, 0x93, 0xbc, 0x79, 0xef, 0x5f, 0xf6, 0xf7, 0xb4,
|
||||
0xb8, 0x07, 0x5a, 0xde, 0xc2, 0x23, 0x7b, 0xf0, 0xff, 0x1d, 0xbc, 0x03, 0xbc, 0xcb, 0x32, 0x1e,
|
||||
0x5e, 0x82, 0xa7, 0xbf, 0x85, 0x43, 0x17, 0x46, 0x71, 0x33, 0x4f, 0xff, 0x38, 0xe0, 0x2d, 0xe6,
|
||||
0x17, 0x72, 0x86, 0x17, 0x70, 0xd6, 0xc4, 0x81, 0xa1, 0x65, 0xec, 0xa5, 0x1a, 0x3d, 0x3e, 0x32,
|
||||
0xd1, 0xef, 0xc6, 0x2d, 0x1c, 0x83, 0x6f, 0xf5, 0xe0, 0xbd, 0xcd, 0x7b, 0x51, 0x45, 0xfb, 0x82,
|
||||
0xe2, 0x16, 0x4e, 0x00, 0x76, 0x56, 0x30, 0x3a, 0xe4, 0x5a, 0x05, 0x4f, 0x8e, 0xce, 0x1a, 0x0d,
|
||||
0xef, 0x5f, 0x7c, 0x7d, 0xb6, 0x2d, 0x05, 0xe5, 0x7c, 0x54, 0xb2, 0x44, 0x57, 0xc9, 0x8a, 0x25,
|
||||
0x5b, 0x91, 0xa8, 0xff, 0x35, 0x31, 0xe4, 0xeb, 0x8e, 0x6a, 0xdf, 0xfc, 0x0d, 0x00, 0x00, 0xff,
|
||||
0xff, 0x51, 0x4b, 0xaa, 0x23, 0xe8, 0x03, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
// Package vtadminproto provides helper functions for working with vtadminpb
|
||||
// protobuf types.
|
||||
package vtadminproto
|
|
@ -0,0 +1,13 @@
|
|||
package vtadminproto
|
||||
|
||||
import vtadminpb "vitess.io/vitess/go/vt/proto/vtadmin"
|
||||
|
||||
// ParseTabletServingState returns a ServingState value from the given string.
|
||||
// If the string does not map to a valid value, this function returns UNKNOWN.
|
||||
func ParseTabletServingState(state string) vtadminpb.Tablet_ServingState {
|
||||
if s, ok := vtadminpb.Tablet_ServingState_value[state]; ok {
|
||||
return vtadminpb.Tablet_ServingState(s)
|
||||
}
|
||||
|
||||
return vtadminpb.Tablet_UNKNOWN
|
||||
}
|
|
@ -50,6 +50,14 @@ message Cluster {
|
|||
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.
|
||||
|
|
Загрузка…
Ссылка в новой задаче