Use shared types from pilosa proto file and enable generic proxying of query calls

This commit is contained in:
Cody Soyland 2020-09-17 16:27:48 -05:00
parent 83704e7973
commit fdce92eb40
7 changed files with 211 additions and 1126 deletions

View file

@ -166,10 +166,14 @@ generate-stringer:
generate-pql: require-peg
cd pql && peg -inline pql.peg && cd ..
# dunno if protoc-gen-gofast is actually needed here
generate-proto-grpc: require-protoc require-protoc-gen-gofast
generate-proto-grpc: require-protoc require-protoc-gen-go
protoc -I proto proto/pilosa.proto --go_out=plugins=grpc:proto
protoc -I proto proto/vdsm/vdsm.proto --go_out=plugins=grpc:proto
# TODO: Modify above commands and remove the below mv if possible.
# See https://go-review.googlesource.com/c/protobuf/+/219298/ for info on --go-opt
# I couldn't get it to work during development - Cody
cp -r proto/github.com/pilosa/pilosa/v2/proto/ proto/
rm -rf proto/github.com
# `go generate` all needed packages
generate: generate-protoc generate-statik generate-stringer generate-pql
@ -387,6 +391,9 @@ install-stringer:
install-protoc-gen-gofast:
GO111MODULE=off go get -u github.com/gogo/protobuf/protoc-gen-gofast
install-protoc-gen-go:
GO111MODULE=off go get -u github.com/golang/protobuf/protoc-gen-go
install-protoc:
@echo This tool cannot automatically install protoc. Please download and install protoc from https://google.github.io/proto-lens/installing-protoc.html

View file

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package pilosa
package proto
import (
"fmt"

View file

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: pilosa.proto
package pilosa
package proto
import (
context "context"
@ -841,52 +841,54 @@ func init() {
func init() { proto.RegisterFile("pilosa.proto", fileDescriptor_ef0691a44d1e275c) }
var fileDescriptor_ef0691a44d1e275c = []byte{
// 718 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xdd, 0x52, 0xd3, 0x4e,
0x14, 0x6f, 0x48, 0x68, 0x9b, 0x53, 0xbe, 0xfe, 0xcb, 0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, 0x08, 0xd3, 0xdb, 0xe4, 0x60, 0xf5, 0x96, 0x94, 0x52, 0x6b, 0x2a, 0x14, 0x37, 0xa7,
0x9c, 0x82, 0x5b, 0xd4, 0x80, 0xee, 0x82, 0x1d, 0x47, 0x42, 0xd5, 0x3e, 0x73, 0x38, 0x24, 0x03,
0xdd, 0x03, 0xe7, 0x33, 0x9d, 0x98, 0xaf, 0x31, 0x63, 0x0e, 0x14, 0x65, 0xaf, 0x0e, 0x8e, 0x5c,
0x96, 0xad, 0x9f, 0x73, 0x50, 0xef, 0x28, 0x1a, 0xda, 0x81, 0xa6, 0xb9, 0xa7, 0xe8, 0xba, 0xb1,
0xbd, 0x70, 0x61, 0xd7, 0x57, 0xcb, 0x4b, 0x9e, 0xaf, 0x57, 0x50, 0xdb, 0xb4, 0xd0, 0x2e, 0x2c,
0x1a, 0xee, 0x71, 0x42, 0xd2, 0xc9, 0x6c, 0x17, 0xd7, 0x0c, 0x50, 0x39, 0x3d, 0x41, 0xad, 0x48,
0xa0, 0xf3, 0x5b, 0x02, 0x9d, 0x7f, 0x48, 0xa0, 0xf3, 0xe7, 0x04, 0x3a, 0x97, 0x48, 0xe0, 0x39,
0x34, 0xf2, 0xc1, 0x43, 0xc5, 0xed, 0xac, 0x4e, 0xe2, 0xcc, 0xf0, 0xdd, 0xba, 0xfa, 0xaf, 0x3d,
0xfa, 0x15, 0x00, 0x00, 0xff, 0xff, 0x7e, 0x8d, 0x53, 0x0b, 0xe7, 0x06, 0x00, 0x00,
// 745 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xdd, 0x72, 0xd3, 0x3a,
0x10, 0x8e, 0x6b, 0x37, 0x89, 0x37, 0xfd, 0x3b, 0xea, 0x39, 0x3d, 0x99, 0xce, 0x99, 0x83, 0xeb,
0x5e, 0x10, 0x06, 0xa6, 0x2d, 0x81, 0xc2, 0x00, 0xe5, 0xa2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xfa, 0xe0, 0x66, 0x39, 0xa0, 0xdb, 0x60, 0x87, 0x81, 0x50,
0xb9, 0xcf, 0x6c, 0x0e, 0xc9, 0x40, 0x77, 0xc0, 0xf9, 0x48, 0x27, 0xe6, 0x35, 0x66, 0xf4, 0x81,
0xa2, 0x1c, 0x94, 0xc1, 0x91, 0xc3, 0xd2, 0xfc, 0x3e, 0x07, 0xe5, 0xb6, 0xa2, 0xa1, 0x3d, 0xa8,
0x9a, 0x7d, 0x8a, 0xfe, 0x35, 0xb6, 0x57, 0x36, 0xec, 0xfa, 0x6a, 0x7e, 0xc8, 0xd3, 0xf1, 0xf2,
0x4b, 0x3b, 0x16, 0xda, 0x87, 0x45, 0xc3, 0x3d, 0x8d, 0x48, 0x3c, 0x99, 0x7d, 0xc5, 0x3f, 0x06,
0x28, 0xac, 0x1e, 0xbf, 0x94, 0x05, 0xd0, 0xfe, 0x29, 0x80, 0xf6, 0x1f, 0x04, 0xd0, 0xfe, 0x75,
0x00, 0xed, 0x6b, 0x04, 0xf0, 0x14, 0x2a, 0x69, 0xe3, 0xa1, 0x6c, 0x77, 0x16, 0x3b, 0x71, 0xa6,
0xfb, 0x83, 0xcd, 0x0f, 0x1b, 0xfd, 0x30, 0x39, 0x1f, 0x77, 0xb6, 0xba, 0x7c, 0xb0, 0xad, 0x49,
0xe6, 0x73, 0xd1, 0xdc, 0x56, 0x7f, 0xbd, 0x4e, 0x59, 0x7d, 0x1e, 0xfc, 0x08, 0x00, 0x00, 0xff,
0xff, 0x60, 0xce, 0x2e, 0x49, 0x0c, 0x07, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.

View file

@ -3,6 +3,8 @@ package pilosa;
//import "public.proto";
option go_package = "github.com/pilosa/pilosa/v2/proto";
message QueryPQLRequest {
string index = 1;
string pql = 2;

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,10 @@
syntax = "proto3";
package vdsm;
option go_package = "github.com/pilosa/pilosa/v2/proto/vdsm";
import "pilosa.proto";
// deprecated
message DataSource {
int64 id = 1;
@ -56,92 +60,14 @@ message DeleteVDSRequest {
message DeleteVDSResponse {
}
message QueryPQLRequest {
string index = 1;
string pql = 2;
}
message QuerySQLRequest {
string sql = 1;
}
message StatusError{
uint32 Code = 1;
string Message = 2;
}
message RowResponse{
repeated ColumnInfo headers = 1;
repeated ColumnResponse columns = 2;
StatusError StatusError = 3;
}
message Row {
repeated ColumnResponse columns = 1;
}
message TableResponse{
repeated ColumnInfo headers = 1;
repeated Row rows = 2;
StatusError StatusError = 3;
}
message ColumnInfo {
string name = 1;
string datatype = 2;
}
message ColumnResponse{
oneof columnVal {
string stringVal = 1;
uint64 uint64Val = 2;
int64 int64Val = 3;
bool boolVal = 4;
bytes blobVal = 5;
Uint64Array uint64ArrayVal = 6;
StringArray stringArrayVal = 7;
double float64Val = 8;
Decimal decimalVal = 9;
}
}
message Decimal {
int64 value = 1;
int64 scale = 2;
}
message InspectRequest {
string vds = 1;
IdsOrKeys records = 2;
repeated string filterFields = 3;
uint64 limit = 4;
uint64 offset = 5;
string query = 6;
}
message Uint64Array {
repeated uint64 vals = 1;
}
message StringArray {
repeated string vals = 1;
}
message IdsOrKeys {
oneof type {
Uint64Array ids = 1;
StringArray keys = 2;
}
}
service Molecula {
rpc GetVDSs(GetVDSsRequest) returns (GetVDSsResponse) {};
rpc GetVDS(GetVDSRequest) returns (GetVDSResponse) {};
rpc PostVDS(PostVDSRequest) returns (PostVDSResponse) {};
rpc DeleteVDS(DeleteVDSRequest) returns (DeleteVDSResponse) {};
rpc QuerySQL(QuerySQLRequest) returns (stream RowResponse) {};
rpc QuerySQLUnary(QuerySQLRequest) returns (TableResponse) {};
rpc QueryPQL(QueryPQLRequest) returns (stream RowResponse) {};
rpc QueryPQLUnary(QueryPQLRequest) returns (TableResponse) {};
rpc Inspect(InspectRequest) returns (stream RowResponse) {};
rpc QuerySQL(pilosa.QuerySQLRequest) returns (stream pilosa.RowResponse) {};
rpc QuerySQLUnary(pilosa.QuerySQLRequest) returns (pilosa.TableResponse) {};
rpc QueryPQL(pilosa.QueryPQLRequest) returns (stream pilosa.RowResponse) {};
rpc QueryPQLUnary(pilosa.QueryPQLRequest) returns (pilosa.TableResponse) {};
rpc Inspect(pilosa.InspectRequest) returns (stream pilosa.RowResponse) {};
}

View file

@ -325,36 +325,24 @@ func (h *VDSMGRPCHandler) DeleteVDS(ctx context.Context, req *vdsm_pb.DeleteVDSR
}
}
func (*VDSMGRPCHandler) QuerySQL(req *vdsm_pb.QuerySQLRequest, srv vdsm_pb.Molecula_QuerySQLServer) error {
return status.Errorf(codes.Unimplemented, "method QuerySQL not implemented")
func (h *VDSMGRPCHandler) QuerySQL(req *pb.QuerySQLRequest, srv vdsm_pb.Molecula_QuerySQLServer) error {
return h.grpcHandler.QuerySQL(req, srv)
}
func (h *VDSMGRPCHandler) QuerySQLUnary(ctx context.Context, req *vdsm_pb.QuerySQLRequest) (*vdsm_pb.TableResponse, error) {
pReq := pb.QuerySQLRequest(*req)
resp, err := h.grpcHandler.QuerySQLUnary(ctx, &pReq)
if err != nil {
return nil, err
}
pResp, err := tableToTable(resp)
return pResp, err
func (h *VDSMGRPCHandler) QuerySQLUnary(ctx context.Context, req *pb.QuerySQLRequest) (*pb.TableResponse, error) {
return h.grpcHandler.QuerySQLUnary(ctx, req)
}
func (*VDSMGRPCHandler) QueryPQL(req *vdsm_pb.QueryPQLRequest, srv vdsm_pb.Molecula_QueryPQLServer) error {
return status.Errorf(codes.Unimplemented, "method QueryPQL not implemented")
func (h *VDSMGRPCHandler) QueryPQL(req *pb.QueryPQLRequest, srv vdsm_pb.Molecula_QueryPQLServer) error {
return h.grpcHandler.QueryPQL(req, srv)
}
func (h *VDSMGRPCHandler) QueryPQLUnary(ctx context.Context, req *vdsm_pb.QueryPQLRequest) (*vdsm_pb.TableResponse, error) {
pReq := pb.QueryPQLRequest(*req)
resp, err := h.grpcHandler.QueryPQLUnary(ctx, &pReq)
if err != nil {
return nil, err
}
pResp, err := tableToTable(resp)
return pResp, err
func (h *VDSMGRPCHandler) QueryPQLUnary(ctx context.Context, req *pb.QueryPQLRequest) (*pb.TableResponse, error) {
return h.grpcHandler.QueryPQLUnary(ctx, req)
}
func (*VDSMGRPCHandler) Inspect(req *vdsm_pb.InspectRequest, srv vdsm_pb.Molecula_InspectServer) error {
return status.Errorf(codes.Unimplemented, "method Inspect not implemented")
func (h *VDSMGRPCHandler) Inspect(req *pb.InspectRequest, srv vdsm_pb.Molecula_InspectServer) error {
return h.grpcHandler.Inspect(req, srv)
}
// ResultUint64 is a wrapper around a uint64 result type
@ -1247,50 +1235,50 @@ func NewGRPCServer(opts ...grpcServerOption) (*grpcServer, error) {
return server, nil
}
// tableToTable is a helper function used by QueryPQLUnary
// to convert a pb.TableResponse into a vdsm_pb.TableResponse.
func tableToTable(ptbl *pb.TableResponse) (*vdsm_pb.TableResponse, error) {
vtbl := &vdsm_pb.TableResponse{
Headers: make([]*vdsm_pb.ColumnInfo, len(ptbl.Headers)),
Rows: make([]*vdsm_pb.Row, len(ptbl.Rows)),
}
// Headers
for i, info := range ptbl.Headers {
vtbl.Headers[i] = &vdsm_pb.ColumnInfo{Name: info.Name, Datatype: info.Datatype}
}
// Rows
for r := range ptbl.Rows {
columns := make([]*vdsm_pb.ColumnResponse, len(ptbl.Rows[r].Columns))
for i, col := range ptbl.Rows[r].Columns {
switch v := col.GetColumnVal().(type) {
case *pb.ColumnResponse_StringVal:
columns[i] = &vdsm_pb.ColumnResponse{ColumnVal: &vdsm_pb.ColumnResponse_StringVal{StringVal: v.StringVal}}
case *pb.ColumnResponse_Uint64Val:
columns[i] = &vdsm_pb.ColumnResponse{ColumnVal: &vdsm_pb.ColumnResponse_Uint64Val{Uint64Val: v.Uint64Val}}
case *pb.ColumnResponse_Int64Val:
columns[i] = &vdsm_pb.ColumnResponse{ColumnVal: &vdsm_pb.ColumnResponse_Int64Val{Int64Val: v.Int64Val}}
case *pb.ColumnResponse_BoolVal:
columns[i] = &vdsm_pb.ColumnResponse{ColumnVal: &vdsm_pb.ColumnResponse_BoolVal{BoolVal: v.BoolVal}}
case *pb.ColumnResponse_BlobVal:
columns[i] = &vdsm_pb.ColumnResponse{ColumnVal: &vdsm_pb.ColumnResponse_BlobVal{BlobVal: v.BlobVal}}
case *pb.ColumnResponse_Uint64ArrayVal:
columns[i] = &vdsm_pb.ColumnResponse{ColumnVal: &vdsm_pb.ColumnResponse_Uint64ArrayVal{Uint64ArrayVal: &vdsm_pb.Uint64Array{Vals: v.Uint64ArrayVal.Vals}}}
case *pb.ColumnResponse_StringArrayVal:
columns[i] = &vdsm_pb.ColumnResponse{ColumnVal: &vdsm_pb.ColumnResponse_StringArrayVal{StringArrayVal: &vdsm_pb.StringArray{Vals: v.StringArrayVal.Vals}}}
case *pb.ColumnResponse_Float64Val:
columns[i] = &vdsm_pb.ColumnResponse{ColumnVal: &vdsm_pb.ColumnResponse_Float64Val{Float64Val: v.Float64Val}}
case *pb.ColumnResponse_DecimalVal:
columns[i] = &vdsm_pb.ColumnResponse{ColumnVal: &vdsm_pb.ColumnResponse_DecimalVal{DecimalVal: &vdsm_pb.Decimal{Value: v.DecimalVal.Value, Scale: v.DecimalVal.Scale}}}
case nil:
columns[i] = &vdsm_pb.ColumnResponse{ColumnVal: nil}
default:
return nil, errors.Errorf("unhandled columnval type: %T", col.GetColumnVal())
}
}
vtbl.Rows[r] = &vdsm_pb.Row{Columns: columns}
}
return vtbl, nil
}
//// tableToTable is a helper function used by QueryPQLUnary
//// to convert a pb.TableResponse into a vdsm_pb.TableResponse.
//func tableToTable(ptbl *pb.TableResponse) (*vdsm_pb.TableResponse, error) {
// vtbl := &vdsm_pb.TableResponse{
// Headers: make([]*vdsm_pb.ColumnInfo, len(ptbl.Headers)),
// Rows: make([]*vdsm_pb.Row, len(ptbl.Rows)),
// }
//
// // Headers
// for i, info := range ptbl.Headers {
// vtbl.Headers[i] = &vdsm_pb.ColumnInfo{Name: info.Name, Datatype: info.Datatype}
// }
//
// // Rows
// for r := range ptbl.Rows {
// columns := make([]*vdsm_pb.ColumnResponse, len(ptbl.Rows[r].Columns))
// for i, col := range ptbl.Rows[r].Columns {
// switch v := col.GetColumnVal().(type) {
// case *pb.ColumnResponse_StringVal:
// columns[i] = &vdsm_pb.ColumnResponse{ColumnVal: &vdsm_pb.ColumnResponse_StringVal{StringVal: v.StringVal}}
// case *pb.ColumnResponse_Uint64Val:
// columns[i] = &vdsm_pb.ColumnResponse{ColumnVal: &vdsm_pb.ColumnResponse_Uint64Val{Uint64Val: v.Uint64Val}}
// case *pb.ColumnResponse_Int64Val:
// columns[i] = &vdsm_pb.ColumnResponse{ColumnVal: &vdsm_pb.ColumnResponse_Int64Val{Int64Val: v.Int64Val}}
// case *pb.ColumnResponse_BoolVal:
// columns[i] = &vdsm_pb.ColumnResponse{ColumnVal: &vdsm_pb.ColumnResponse_BoolVal{BoolVal: v.BoolVal}}
// case *pb.ColumnResponse_BlobVal:
// columns[i] = &vdsm_pb.ColumnResponse{ColumnVal: &vdsm_pb.ColumnResponse_BlobVal{BlobVal: v.BlobVal}}
// case *pb.ColumnResponse_Uint64ArrayVal:
// columns[i] = &vdsm_pb.ColumnResponse{ColumnVal: &vdsm_pb.ColumnResponse_Uint64ArrayVal{Uint64ArrayVal: &vdsm_pb.Uint64Array{Vals: v.Uint64ArrayVal.Vals}}}
// case *pb.ColumnResponse_StringArrayVal:
// columns[i] = &vdsm_pb.ColumnResponse{ColumnVal: &vdsm_pb.ColumnResponse_StringArrayVal{StringArrayVal: &vdsm_pb.StringArray{Vals: v.StringArrayVal.Vals}}}
// case *pb.ColumnResponse_Float64Val:
// columns[i] = &vdsm_pb.ColumnResponse{ColumnVal: &vdsm_pb.ColumnResponse_Float64Val{Float64Val: v.Float64Val}}
// case *pb.ColumnResponse_DecimalVal:
// columns[i] = &vdsm_pb.ColumnResponse{ColumnVal: &vdsm_pb.ColumnResponse_DecimalVal{DecimalVal: &vdsm_pb.Decimal{Value: v.DecimalVal.Value, Scale: v.DecimalVal.Scale}}}
// case nil:
// columns[i] = &vdsm_pb.ColumnResponse{ColumnVal: nil}
// default:
// return nil, errors.Errorf("unhandled columnval type: %T", col.GetColumnVal())
// }
// }
// vtbl.Rows[r] = &vdsm_pb.Row{Columns: columns}
// }
//
// return vtbl, nil
//}