1
0
Fork 0

Stick with simple proto

The proto was not well designed in the first place, but it's better to
deal with it as-is, and wait until another major release to fix it.
master
Philip O'Toole 2 years ago
parent 08af993b46
commit 3afa2ce80a

@ -215,8 +215,8 @@ func (c *Client) Execute(er *command.ExecuteRequest, nodeAddr string, username s
return nil, err return nil, err
} }
if a.Error != nil { if a.Error != "" {
return nil, errors.New(a.Error.GetError()) return nil, errors.New(a.Error)
} }
return a.Results, nil return a.Results, nil
} }
@ -298,8 +298,8 @@ func (c *Client) Query(qr *command.QueryRequest, nodeAddr string, username strin
return nil, err return nil, err
} }
if a.Error != nil { if a.Error != "" {
return nil, errors.New(a.Error.GetError()) return nil, errors.New(a.Error)
} }
return a.Rows, nil return a.Rows, nil
} }

@ -1,8 +1,8 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.28.0 // protoc-gen-go v1.28.0
// protoc v3.21.2 // protoc v3.6.1
// source: cluster/message.proto // source: message.proto
package cluster package cluster
@ -57,11 +57,11 @@ func (x Command_Type) String() string {
} }
func (Command_Type) Descriptor() protoreflect.EnumDescriptor { func (Command_Type) Descriptor() protoreflect.EnumDescriptor {
return file_cluster_message_proto_enumTypes[0].Descriptor() return file_message_proto_enumTypes[0].Descriptor()
} }
func (Command_Type) Type() protoreflect.EnumType { func (Command_Type) Type() protoreflect.EnumType {
return &file_cluster_message_proto_enumTypes[0] return &file_message_proto_enumTypes[0]
} }
func (x Command_Type) Number() protoreflect.EnumNumber { func (x Command_Type) Number() protoreflect.EnumNumber {
@ -70,56 +70,7 @@ func (x Command_Type) Number() protoreflect.EnumNumber {
// Deprecated: Use Command_Type.Descriptor instead. // Deprecated: Use Command_Type.Descriptor instead.
func (Command_Type) EnumDescriptor() ([]byte, []int) { func (Command_Type) EnumDescriptor() ([]byte, []int) {
return file_cluster_message_proto_rawDescGZIP(), []int{2, 0} return file_message_proto_rawDescGZIP(), []int{2, 0}
}
type ResultsError_Type int32
const (
ResultsError_RESULTS_ERROR_UNSPECIFIED ResultsError_Type = 0
ResultsError_RESULTS_ERROR_UNAUTHORIZED ResultsError_Type = 1
ResultsError_RESULTS_ERROR_NIL_QUERY_REQUEST ResultsError_Type = 2
)
// Enum value maps for ResultsError_Type.
var (
ResultsError_Type_name = map[int32]string{
0: "RESULTS_ERROR_UNSPECIFIED",
1: "RESULTS_ERROR_UNAUTHORIZED",
2: "RESULTS_ERROR_NIL_QUERY_REQUEST",
}
ResultsError_Type_value = map[string]int32{
"RESULTS_ERROR_UNSPECIFIED": 0,
"RESULTS_ERROR_UNAUTHORIZED": 1,
"RESULTS_ERROR_NIL_QUERY_REQUEST": 2,
}
)
func (x ResultsError_Type) Enum() *ResultsError_Type {
p := new(ResultsError_Type)
*p = x
return p
}
func (x ResultsError_Type) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (ResultsError_Type) Descriptor() protoreflect.EnumDescriptor {
return file_cluster_message_proto_enumTypes[1].Descriptor()
}
func (ResultsError_Type) Type() protoreflect.EnumType {
return &file_cluster_message_proto_enumTypes[1]
}
func (x ResultsError_Type) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use ResultsError_Type.Descriptor instead.
func (ResultsError_Type) EnumDescriptor() ([]byte, []int) {
return file_cluster_message_proto_rawDescGZIP(), []int{3, 0}
} }
type Credentials struct { type Credentials struct {
@ -134,7 +85,7 @@ type Credentials struct {
func (x *Credentials) Reset() { func (x *Credentials) Reset() {
*x = Credentials{} *x = Credentials{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_cluster_message_proto_msgTypes[0] mi := &file_message_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -147,7 +98,7 @@ func (x *Credentials) String() string {
func (*Credentials) ProtoMessage() {} func (*Credentials) ProtoMessage() {}
func (x *Credentials) ProtoReflect() protoreflect.Message { func (x *Credentials) ProtoReflect() protoreflect.Message {
mi := &file_cluster_message_proto_msgTypes[0] mi := &file_message_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -160,7 +111,7 @@ func (x *Credentials) ProtoReflect() protoreflect.Message {
// Deprecated: Use Credentials.ProtoReflect.Descriptor instead. // Deprecated: Use Credentials.ProtoReflect.Descriptor instead.
func (*Credentials) Descriptor() ([]byte, []int) { func (*Credentials) Descriptor() ([]byte, []int) {
return file_cluster_message_proto_rawDescGZIP(), []int{0} return file_message_proto_rawDescGZIP(), []int{0}
} }
func (x *Credentials) GetUsername() string { func (x *Credentials) GetUsername() string {
@ -188,7 +139,7 @@ type Address struct {
func (x *Address) Reset() { func (x *Address) Reset() {
*x = Address{} *x = Address{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_cluster_message_proto_msgTypes[1] mi := &file_message_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -201,7 +152,7 @@ func (x *Address) String() string {
func (*Address) ProtoMessage() {} func (*Address) ProtoMessage() {}
func (x *Address) ProtoReflect() protoreflect.Message { func (x *Address) ProtoReflect() protoreflect.Message {
mi := &file_cluster_message_proto_msgTypes[1] mi := &file_message_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -214,7 +165,7 @@ func (x *Address) ProtoReflect() protoreflect.Message {
// Deprecated: Use Address.ProtoReflect.Descriptor instead. // Deprecated: Use Address.ProtoReflect.Descriptor instead.
func (*Address) Descriptor() ([]byte, []int) { func (*Address) Descriptor() ([]byte, []int) {
return file_cluster_message_proto_rawDescGZIP(), []int{1} return file_message_proto_rawDescGZIP(), []int{1}
} }
func (x *Address) GetUrl() string { func (x *Address) GetUrl() string {
@ -240,7 +191,7 @@ type Command struct {
func (x *Command) Reset() { func (x *Command) Reset() {
*x = Command{} *x = Command{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_cluster_message_proto_msgTypes[2] mi := &file_message_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -253,7 +204,7 @@ func (x *Command) String() string {
func (*Command) ProtoMessage() {} func (*Command) ProtoMessage() {}
func (x *Command) ProtoReflect() protoreflect.Message { func (x *Command) ProtoReflect() protoreflect.Message {
mi := &file_cluster_message_proto_msgTypes[2] mi := &file_message_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -266,7 +217,7 @@ func (x *Command) ProtoReflect() protoreflect.Message {
// Deprecated: Use Command.ProtoReflect.Descriptor instead. // Deprecated: Use Command.ProtoReflect.Descriptor instead.
func (*Command) Descriptor() ([]byte, []int) { func (*Command) Descriptor() ([]byte, []int) {
return file_cluster_message_proto_rawDescGZIP(), []int{2} return file_message_proto_rawDescGZIP(), []int{2}
} }
func (x *Command) GetType() Command_Type { func (x *Command) GetType() Command_Type {
@ -320,74 +271,19 @@ func (*Command_ExecuteRequest) isCommand_Request() {}
func (*Command_QueryRequest) isCommand_Request() {} func (*Command_QueryRequest) isCommand_Request() {}
type ResultsError struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Type ResultsError_Type `protobuf:"varint,1,opt,name=type,proto3,enum=cluster.ResultsError_Type" json:"type,omitempty"`
Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`
}
func (x *ResultsError) Reset() {
*x = ResultsError{}
if protoimpl.UnsafeEnabled {
mi := &file_cluster_message_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ResultsError) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ResultsError) ProtoMessage() {}
func (x *ResultsError) ProtoReflect() protoreflect.Message {
mi := &file_cluster_message_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ResultsError.ProtoReflect.Descriptor instead.
func (*ResultsError) Descriptor() ([]byte, []int) {
return file_cluster_message_proto_rawDescGZIP(), []int{3}
}
func (x *ResultsError) GetType() ResultsError_Type {
if x != nil {
return x.Type
}
return ResultsError_RESULTS_ERROR_UNSPECIFIED
}
func (x *ResultsError) GetError() string {
if x != nil {
return x.Error
}
return ""
}
type CommandExecuteResponse struct { type CommandExecuteResponse struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Error *ResultsError `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"`
Results []*command.ExecuteResult `protobuf:"bytes,2,rep,name=results,proto3" json:"results,omitempty"` Results []*command.ExecuteResult `protobuf:"bytes,2,rep,name=results,proto3" json:"results,omitempty"`
} }
func (x *CommandExecuteResponse) Reset() { func (x *CommandExecuteResponse) Reset() {
*x = CommandExecuteResponse{} *x = CommandExecuteResponse{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_cluster_message_proto_msgTypes[4] mi := &file_message_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -400,7 +296,7 @@ func (x *CommandExecuteResponse) String() string {
func (*CommandExecuteResponse) ProtoMessage() {} func (*CommandExecuteResponse) ProtoMessage() {}
func (x *CommandExecuteResponse) ProtoReflect() protoreflect.Message { func (x *CommandExecuteResponse) ProtoReflect() protoreflect.Message {
mi := &file_cluster_message_proto_msgTypes[4] mi := &file_message_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -413,14 +309,14 @@ func (x *CommandExecuteResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use CommandExecuteResponse.ProtoReflect.Descriptor instead. // Deprecated: Use CommandExecuteResponse.ProtoReflect.Descriptor instead.
func (*CommandExecuteResponse) Descriptor() ([]byte, []int) { func (*CommandExecuteResponse) Descriptor() ([]byte, []int) {
return file_cluster_message_proto_rawDescGZIP(), []int{4} return file_message_proto_rawDescGZIP(), []int{3}
} }
func (x *CommandExecuteResponse) GetError() *ResultsError { func (x *CommandExecuteResponse) GetError() string {
if x != nil { if x != nil {
return x.Error return x.Error
} }
return nil return ""
} }
func (x *CommandExecuteResponse) GetResults() []*command.ExecuteResult { func (x *CommandExecuteResponse) GetResults() []*command.ExecuteResult {
@ -435,14 +331,14 @@ type CommandQueryResponse struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Error *ResultsError `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"`
Rows []*command.QueryRows `protobuf:"bytes,2,rep,name=rows,proto3" json:"rows,omitempty"` Rows []*command.QueryRows `protobuf:"bytes,2,rep,name=rows,proto3" json:"rows,omitempty"`
} }
func (x *CommandQueryResponse) Reset() { func (x *CommandQueryResponse) Reset() {
*x = CommandQueryResponse{} *x = CommandQueryResponse{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_cluster_message_proto_msgTypes[5] mi := &file_message_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -455,7 +351,7 @@ func (x *CommandQueryResponse) String() string {
func (*CommandQueryResponse) ProtoMessage() {} func (*CommandQueryResponse) ProtoMessage() {}
func (x *CommandQueryResponse) ProtoReflect() protoreflect.Message { func (x *CommandQueryResponse) ProtoReflect() protoreflect.Message {
mi := &file_cluster_message_proto_msgTypes[5] mi := &file_message_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -468,14 +364,14 @@ func (x *CommandQueryResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use CommandQueryResponse.ProtoReflect.Descriptor instead. // Deprecated: Use CommandQueryResponse.ProtoReflect.Descriptor instead.
func (*CommandQueryResponse) Descriptor() ([]byte, []int) { func (*CommandQueryResponse) Descriptor() ([]byte, []int) {
return file_cluster_message_proto_rawDescGZIP(), []int{5} return file_message_proto_rawDescGZIP(), []int{4}
} }
func (x *CommandQueryResponse) GetError() *ResultsError { func (x *CommandQueryResponse) GetError() string {
if x != nil { if x != nil {
return x.Error return x.Error
} }
return nil return ""
} }
func (x *CommandQueryResponse) GetRows() []*command.QueryRows { func (x *CommandQueryResponse) GetRows() []*command.QueryRows {
@ -485,126 +381,105 @@ func (x *CommandQueryResponse) GetRows() []*command.QueryRows {
return nil return nil
} }
var File_cluster_message_proto protoreflect.FileDescriptor var File_message_proto protoreflect.FileDescriptor
var file_cluster_message_proto_rawDesc = []byte{ var file_message_proto_rawDesc = []byte{
0x0a, 0x15, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x0a, 0x0d, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x1a, 0x15, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e,
0x1a, 0x15, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x45, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x64, 0x65, 0x45, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x12, 0x1a,
0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61,
0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61,
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x1b, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x1b, 0x0a, 0x07, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73,
0x0a, 0x07, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x22, 0xf0, 0x02, 0x0a, 0x07, 0x75, 0x72, 0x6c, 0x22, 0xf0, 0x02, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12,
0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x29, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x29, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e,
0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e,
0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x42, 0x0a, 0x0f, 0x65, 0x78,
0x70, 0x65, 0x12, 0x42, 0x0a, 0x0f, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x5f, 0x72, 0x65, 0x65, 0x63, 0x75, 0x74, 0x65, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x02, 0x20,
0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x45, 0x78,
0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x0e,
0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x0e, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3c,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3c, 0x0a, 0x0d, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x0a, 0x0d, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18,
0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e,
0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x0c,
0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x0c, 0x71, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x71, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x36, 0x0a, 0x0b,
0x75, 0x65, 0x73, 0x74, 0x12, 0x36, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28,
0x61, 0x6c, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x6c, 0x75, 0x73, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x72, 0x65, 0x64,
0x74, 0x65, 0x72, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x52, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x52, 0x0b, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74,
0x0b, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x22, 0x75, 0x0a, 0x04, 0x69, 0x61, 0x6c, 0x73, 0x22, 0x75, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x14,
0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x14, 0x43, 0x4f, 0x4d, 0x4d, 0x41, 0x4e, 0x44, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x41, 0x4e, 0x44, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x4b,
0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x21, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x21, 0x0a, 0x1d, 0x43, 0x4f, 0x4d, 0x4d, 0x41, 0x4e,
0x0a, 0x1d, 0x43, 0x4f, 0x4d, 0x4d, 0x41, 0x4e, 0x44, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x44, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x45, 0x54, 0x5f, 0x4e, 0x4f, 0x44, 0x45, 0x5f,
0x45, 0x54, 0x5f, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x41, 0x50, 0x49, 0x5f, 0x55, 0x52, 0x4c, 0x10, 0x41, 0x50, 0x49, 0x5f, 0x55, 0x52, 0x4c, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x43, 0x4f, 0x4d,
0x01, 0x12, 0x18, 0x0a, 0x14, 0x43, 0x4f, 0x4d, 0x4d, 0x41, 0x4e, 0x44, 0x5f, 0x54, 0x59, 0x50, 0x4d, 0x41, 0x4e, 0x44, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x58, 0x45, 0x43, 0x55, 0x54,
0x45, 0x5f, 0x45, 0x58, 0x45, 0x43, 0x55, 0x54, 0x45, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x45, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4f, 0x4d, 0x4d, 0x41, 0x4e, 0x44, 0x5f, 0x54,
0x4f, 0x4d, 0x4d, 0x41, 0x4e, 0x44, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x51, 0x55, 0x45, 0x52, 0x59, 0x50, 0x45, 0x5f, 0x51, 0x55, 0x45, 0x52, 0x59, 0x10, 0x03, 0x42, 0x09, 0x0a, 0x07, 0x72,
0x59, 0x10, 0x03, 0x42, 0x09, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xc0, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x60, 0x0a, 0x16, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e,
0x01, 0x0a, 0x0c, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x64, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x2e, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x45, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x30, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74,
0x72, 0x72, 0x6f, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e,
0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52,
0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x6a, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x22, 0x54, 0x0a, 0x14, 0x43, 0x6f, 0x6d, 0x6d,
0x19, 0x52, 0x45, 0x53, 0x55, 0x4c, 0x54, 0x53, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x55, 0x61, 0x6e, 0x64, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1e, 0x0a, 0x1a, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x52, 0x45, 0x53, 0x55, 0x4c, 0x54, 0x53, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x55, 0x4e, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x26, 0x0a, 0x04, 0x72, 0x6f, 0x77, 0x73, 0x18, 0x02,
0x41, 0x55, 0x54, 0x48, 0x4f, 0x52, 0x49, 0x5a, 0x45, 0x44, 0x10, 0x01, 0x12, 0x23, 0x0a, 0x1f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x51,
0x52, 0x45, 0x53, 0x55, 0x4c, 0x54, 0x53, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x4e, 0x49, 0x75, 0x65, 0x72, 0x79, 0x52, 0x6f, 0x77, 0x73, 0x52, 0x04, 0x72, 0x6f, 0x77, 0x73, 0x42, 0x22,
0x4c, 0x5f, 0x51, 0x55, 0x45, 0x52, 0x59, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x10, 0x5a, 0x20, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x72, 0x71, 0x6c,
0x02, 0x22, 0x77, 0x0a, 0x16, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x45, 0x78, 0x65, 0x63, 0x69, 0x74, 0x65, 0x2f, 0x72, 0x71, 0x6c, 0x69, 0x74, 0x65, 0x2f, 0x63, 0x6c, 0x75, 0x73, 0x74,
0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x65, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x6c, 0x75,
0x73, 0x74, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x45, 0x72, 0x72, 0x6f,
0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x30, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x75,
0x6c, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x6f, 0x6d, 0x6d,
0x61, 0x6e, 0x64, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c,
0x74, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x22, 0x6b, 0x0a, 0x14, 0x43, 0x6f,
0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x15, 0x2e, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x75,
0x6c, 0x74, 0x73, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12,
0x26, 0x0a, 0x04, 0x72, 0x6f, 0x77, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e,
0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x6f, 0x77,
0x73, 0x52, 0x04, 0x72, 0x6f, 0x77, 0x73, 0x42, 0x22, 0x5a, 0x20, 0x67, 0x69, 0x74, 0x68, 0x75,
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x72, 0x71, 0x6c, 0x69, 0x74, 0x65, 0x2f, 0x72, 0x71, 0x6c,
0x69, 0x74, 0x65, 0x2f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
} }
var ( var (
file_cluster_message_proto_rawDescOnce sync.Once file_message_proto_rawDescOnce sync.Once
file_cluster_message_proto_rawDescData = file_cluster_message_proto_rawDesc file_message_proto_rawDescData = file_message_proto_rawDesc
) )
func file_cluster_message_proto_rawDescGZIP() []byte { func file_message_proto_rawDescGZIP() []byte {
file_cluster_message_proto_rawDescOnce.Do(func() { file_message_proto_rawDescOnce.Do(func() {
file_cluster_message_proto_rawDescData = protoimpl.X.CompressGZIP(file_cluster_message_proto_rawDescData) file_message_proto_rawDescData = protoimpl.X.CompressGZIP(file_message_proto_rawDescData)
}) })
return file_cluster_message_proto_rawDescData return file_message_proto_rawDescData
} }
var file_cluster_message_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_message_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_cluster_message_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_message_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_cluster_message_proto_goTypes = []interface{}{ var file_message_proto_goTypes = []interface{}{
(Command_Type)(0), // 0: cluster.Command.Type (Command_Type)(0), // 0: cluster.Command.Type
(ResultsError_Type)(0), // 1: cluster.ResultsError.Type (*Credentials)(nil), // 1: cluster.Credentials
(*Credentials)(nil), // 2: cluster.Credentials (*Address)(nil), // 2: cluster.Address
(*Address)(nil), // 3: cluster.Address (*Command)(nil), // 3: cluster.Command
(*Command)(nil), // 4: cluster.Command (*CommandExecuteResponse)(nil), // 4: cluster.CommandExecuteResponse
(*ResultsError)(nil), // 5: cluster.ResultsError (*CommandQueryResponse)(nil), // 5: cluster.CommandQueryResponse
(*CommandExecuteResponse)(nil), // 6: cluster.CommandExecuteResponse (*command.ExecuteRequest)(nil), // 6: command.ExecuteRequest
(*CommandQueryResponse)(nil), // 7: cluster.CommandQueryResponse (*command.QueryRequest)(nil), // 7: command.QueryRequest
(*command.ExecuteRequest)(nil), // 8: command.ExecuteRequest (*command.ExecuteResult)(nil), // 8: command.ExecuteResult
(*command.QueryRequest)(nil), // 9: command.QueryRequest (*command.QueryRows)(nil), // 9: command.QueryRows
(*command.ExecuteResult)(nil), // 10: command.ExecuteResult }
(*command.QueryRows)(nil), // 11: command.QueryRows var file_message_proto_depIdxs = []int32{
} 0, // 0: cluster.Command.type:type_name -> cluster.Command.Type
var file_cluster_message_proto_depIdxs = []int32{ 6, // 1: cluster.Command.execute_request:type_name -> command.ExecuteRequest
0, // 0: cluster.Command.type:type_name -> cluster.Command.Type 7, // 2: cluster.Command.query_request:type_name -> command.QueryRequest
8, // 1: cluster.Command.execute_request:type_name -> command.ExecuteRequest 1, // 3: cluster.Command.credentials:type_name -> cluster.Credentials
9, // 2: cluster.Command.query_request:type_name -> command.QueryRequest 8, // 4: cluster.CommandExecuteResponse.results:type_name -> command.ExecuteResult
2, // 3: cluster.Command.credentials:type_name -> cluster.Credentials 9, // 5: cluster.CommandQueryResponse.rows:type_name -> command.QueryRows
1, // 4: cluster.ResultsError.type:type_name -> cluster.ResultsError.Type 6, // [6:6] is the sub-list for method output_type
5, // 5: cluster.CommandExecuteResponse.error:type_name -> cluster.ResultsError 6, // [6:6] is the sub-list for method input_type
10, // 6: cluster.CommandExecuteResponse.results:type_name -> command.ExecuteResult 6, // [6:6] is the sub-list for extension type_name
5, // 7: cluster.CommandQueryResponse.error:type_name -> cluster.ResultsError 6, // [6:6] is the sub-list for extension extendee
11, // 8: cluster.CommandQueryResponse.rows:type_name -> command.QueryRows 0, // [0:6] is the sub-list for field type_name
9, // [9:9] is the sub-list for method output_type }
9, // [9:9] is the sub-list for method input_type
9, // [9:9] is the sub-list for extension type_name func init() { file_message_proto_init() }
9, // [9:9] is the sub-list for extension extendee func file_message_proto_init() {
0, // [0:9] is the sub-list for field type_name if File_message_proto != nil {
}
func init() { file_cluster_message_proto_init() }
func file_cluster_message_proto_init() {
if File_cluster_message_proto != nil {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_cluster_message_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { file_message_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Credentials); i { switch v := v.(*Credentials); i {
case 0: case 0:
return &v.state return &v.state
@ -616,7 +491,7 @@ func file_cluster_message_proto_init() {
return nil return nil
} }
} }
file_cluster_message_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { file_message_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Address); i { switch v := v.(*Address); i {
case 0: case 0:
return &v.state return &v.state
@ -628,7 +503,7 @@ func file_cluster_message_proto_init() {
return nil return nil
} }
} }
file_cluster_message_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { file_message_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Command); i { switch v := v.(*Command); i {
case 0: case 0:
return &v.state return &v.state
@ -640,19 +515,7 @@ func file_cluster_message_proto_init() {
return nil return nil
} }
} }
file_cluster_message_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { file_message_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ResultsError); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_cluster_message_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CommandExecuteResponse); i { switch v := v.(*CommandExecuteResponse); i {
case 0: case 0:
return &v.state return &v.state
@ -664,7 +527,7 @@ func file_cluster_message_proto_init() {
return nil return nil
} }
} }
file_cluster_message_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { file_message_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CommandQueryResponse); i { switch v := v.(*CommandQueryResponse); i {
case 0: case 0:
return &v.state return &v.state
@ -677,7 +540,7 @@ func file_cluster_message_proto_init() {
} }
} }
} }
file_cluster_message_proto_msgTypes[2].OneofWrappers = []interface{}{ file_message_proto_msgTypes[2].OneofWrappers = []interface{}{
(*Command_ExecuteRequest)(nil), (*Command_ExecuteRequest)(nil),
(*Command_QueryRequest)(nil), (*Command_QueryRequest)(nil),
} }
@ -685,19 +548,19 @@ func file_cluster_message_proto_init() {
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{ File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_cluster_message_proto_rawDesc, RawDescriptor: file_message_proto_rawDesc,
NumEnums: 2, NumEnums: 1,
NumMessages: 6, NumMessages: 5,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },
GoTypes: file_cluster_message_proto_goTypes, GoTypes: file_message_proto_goTypes,
DependencyIndexes: file_cluster_message_proto_depIdxs, DependencyIndexes: file_message_proto_depIdxs,
EnumInfos: file_cluster_message_proto_enumTypes, EnumInfos: file_message_proto_enumTypes,
MessageInfos: file_cluster_message_proto_msgTypes, MessageInfos: file_message_proto_msgTypes,
}.Build() }.Build()
File_cluster_message_proto = out.File File_message_proto = out.File
file_cluster_message_proto_rawDesc = nil file_message_proto_rawDesc = nil
file_cluster_message_proto_goTypes = nil file_message_proto_goTypes = nil
file_cluster_message_proto_depIdxs = nil file_message_proto_depIdxs = nil
} }

@ -31,22 +31,12 @@ message Command {
Credentials credentials = 4; Credentials credentials = 4;
} }
message ResultsError {
enum Type {
RESULTS_ERROR_UNSPECIFIED = 0;
RESULTS_ERROR_UNAUTHORIZED = 1;
RESULTS_ERROR_NIL_QUERY_REQUEST =2;
}
Type type = 1;
string error = 2;
}
message CommandExecuteResponse { message CommandExecuteResponse {
ResultsError error = 1; string error = 1;
repeated command.ExecuteResult results = 2; repeated command.ExecuteResult results = 2;
} }
message CommandQueryResponse { message CommandQueryResponse {
ResultsError error = 1; string error = 1;
repeated command.QueryRows rows = 2; repeated command.QueryRows rows = 2;
} }

@ -237,22 +237,13 @@ func (s *Service) handleConn(conn net.Conn) {
resp := &CommandExecuteResponse{} resp := &CommandExecuteResponse{}
er := c.GetExecuteRequest() er := c.GetExecuteRequest()
if er == nil { if er == nil {
resp.Error = &ResultsError{ resp.Error = "ExecuteRequest is nil"
Type: ResultsError_RESULTS_ERROR_NIL_QUERY_REQUEST,
Error: "Query Request is nil",
}
} else if !s.checkCommandPerm(c, auth.PermExecute) { } else if !s.checkCommandPerm(c, auth.PermExecute) {
resp.Error = &ResultsError{ resp.Error = "unauthorized"
Type: ResultsError_RESULTS_ERROR_UNAUTHORIZED,
Error: "Unauthorized",
}
} else { } else {
res, err := s.db.Execute(er) res, err := s.db.Execute(er)
if err != nil { if err != nil {
resp.Error = &ResultsError{ resp.Error = err.Error()
Type: ResultsError_RESULTS_ERROR_UNSPECIFIED,
Error: err.Error(),
}
} else { } else {
resp.Results = make([]*command.ExecuteResult, len(res)) resp.Results = make([]*command.ExecuteResult, len(res))
for i := range res { for i := range res {
@ -278,22 +269,13 @@ func (s *Service) handleConn(conn net.Conn) {
qr := c.GetQueryRequest() qr := c.GetQueryRequest()
if qr == nil { if qr == nil {
resp.Error = &ResultsError{ resp.Error = "QueryRequest is nil"
Type: ResultsError_RESULTS_ERROR_NIL_QUERY_REQUEST,
Error: "Query Request is nil",
}
} else if !s.checkCommandPerm(c, auth.PermQuery) { } else if !s.checkCommandPerm(c, auth.PermQuery) {
resp.Error = &ResultsError{ resp.Error = "unauthorized"
Type: ResultsError_RESULTS_ERROR_UNAUTHORIZED,
Error: "Unauthorized",
}
} else { } else {
res, err := s.db.Query(qr) res, err := s.db.Query(qr)
if err != nil { if err != nil {
resp.Error = &ResultsError{ resp.Error = err.Error()
Type: ResultsError_RESULTS_ERROR_UNSPECIFIED,
Error: err.Error(),
}
} else { } else {
resp.Rows = make([]*command.QueryRows, len(res)) resp.Rows = make([]*command.QueryRows, len(res))
for i := range res { for i := range res {

@ -204,15 +204,23 @@ func Test_NewServiceTestExecuteQueryAuthNoCredentials(t *testing.T) {
} }
} }
// Test_NewServiceTestExecuteQueryAuth tests that for a cluster with a credential
// store, configured users with execute permissions can execute and users with
// query permissions can query, and can't if they don't have those permissions.
func Test_NewServiceTestExecuteQueryAuth(t *testing.T) { func Test_NewServiceTestExecuteQueryAuth(t *testing.T) {
ml := mustNewMockTransport() ml := mustNewMockTransport()
db := mustNewMockDatabase() db := mustNewMockDatabase()
// Test that for a cluster with a credential store configed f := func(username string, password string, perm string) bool {
// users with execute permissions can execute and users with if username == "alice" && password == "secret1" && perm == "execute" {
// query permissions can query and can't if they don't have those return true
// permissions } else if username == "bob" && password == "secret1" && perm == "query" {
c := mustNewMockCredentialStoreBob() return true
}
return false
}
c := &mockCredentialStore{aaFunc: f}
s := New(ml, db, c) s := New(ml, db, c)
if s == nil { if s == nil {
t.Fatalf("failed to create cluster service") t.Fatalf("failed to create cluster service")
@ -237,12 +245,12 @@ func Test_NewServiceTestExecuteQueryAuth(t *testing.T) {
} }
qr := &command.QueryRequest{} qr := &command.QueryRequest{}
_, err = cl.Query(qr, s.Addr(), "bob", "secret1", 5*time.Second) _, err = cl.Query(qr, s.Addr(), "bob", "secret1", 5*time.Second)
if err != nil { if err != nil && err.Error() != "unauthorized" {
fmt.Println(err) fmt.Println(err)
t.Fatal("bob improperly unauthorized to query") t.Fatal("bob improperly unauthorized to query")
} }
_, err = cl.Query(qr, s.Addr(), "alice", "secret1", 5*time.Second) _, err = cl.Query(qr, s.Addr(), "alice", "secret1", 5*time.Second)
if err == nil { if err != nil && err.Error() != "unauthorized" {
t.Fatal("alice improperly authorized to query") t.Fatal("alice improperly authorized to query")
} }
} }
@ -361,16 +369,3 @@ func (m *mockCredentialStore) AA(username, password, perm string) bool {
func mustNewMockCredentialStore() *mockCredentialStore { func mustNewMockCredentialStore() *mockCredentialStore {
return &mockCredentialStore{HasPermOK: true} return &mockCredentialStore{HasPermOK: true}
} }
func mustNewMockCredentialStoreBob() *mockCredentialStore {
f := func(username string, password string, perm string) bool {
fmt.Println(username, password, perm)
if username == "alice" && password == "secret1" && perm == "execute" {
return true
} else if username == "bob" && password == "secret1" && perm == "query" {
return true
}
return false
}
return &mockCredentialStore{aaFunc: f}
}

@ -1108,7 +1108,7 @@ func (s *Service) execute(w http.ResponseWriter, r *http.Request) {
} }
results, resultsErr = s.cluster.Execute(er, addr, username, password, timeout) results, resultsErr = s.cluster.Execute(er, addr, username, password, timeout)
if resultsErr != nil && resultsErr.Error() == "Unauthorized" { if resultsErr != nil && resultsErr.Error() == "unauthorized" {
w.WriteHeader(http.StatusUnauthorized) w.WriteHeader(http.StatusUnauthorized)
return return
} }
@ -1205,7 +1205,7 @@ func (s *Service) handleQuery(w http.ResponseWriter, r *http.Request) {
username = "" username = ""
} }
results, resultsErr = s.cluster.Query(qr, addr, username, password, timeout) results, resultsErr = s.cluster.Query(qr, addr, username, password, timeout)
if resultsErr != nil && resultsErr.Error() == "Unauthorized" { if resultsErr != nil && resultsErr.Error() == "unauthorized" {
w.WriteHeader(http.StatusUnauthorized) w.WriteHeader(http.StatusUnauthorized)
return return
} }

Loading…
Cancel
Save