diff --git a/proto/pilosa.pb.go b/proto/pilosa.pb.go index 9ac5095f2..4cd578f2c 100644 --- a/proto/pilosa.pb.go +++ b/proto/pilosa.pb.go @@ -838,6 +838,341 @@ func (*IdsOrKeys) XXX_OneofWrappers() []interface{} { } } +type Index struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Index) Reset() { *m = Index{} } +func (m *Index) String() string { return proto.CompactTextString(m) } +func (*Index) ProtoMessage() {} +func (*Index) Descriptor() ([]byte, []int) { + return fileDescriptor_ef0691a44d1e275c, []int{13} +} + +func (m *Index) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Index.Unmarshal(m, b) +} +func (m *Index) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Index.Marshal(b, m, deterministic) +} +func (m *Index) XXX_Merge(src proto.Message) { + xxx_messageInfo_Index.Merge(m, src) +} +func (m *Index) XXX_Size() int { + return xxx_messageInfo_Index.Size(m) +} +func (m *Index) XXX_DiscardUnknown() { + xxx_messageInfo_Index.DiscardUnknown(m) +} + +var xxx_messageInfo_Index proto.InternalMessageInfo + +func (m *Index) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +type CreateIndexRequest struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Keys bool `protobuf:"varint,2,opt,name=keys,proto3" json:"keys,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateIndexRequest) Reset() { *m = CreateIndexRequest{} } +func (m *CreateIndexRequest) String() string { return proto.CompactTextString(m) } +func (*CreateIndexRequest) ProtoMessage() {} +func (*CreateIndexRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ef0691a44d1e275c, []int{14} +} + +func (m *CreateIndexRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CreateIndexRequest.Unmarshal(m, b) +} +func (m *CreateIndexRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CreateIndexRequest.Marshal(b, m, deterministic) +} +func (m *CreateIndexRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateIndexRequest.Merge(m, src) +} +func (m *CreateIndexRequest) XXX_Size() int { + return xxx_messageInfo_CreateIndexRequest.Size(m) +} +func (m *CreateIndexRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CreateIndexRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateIndexRequest proto.InternalMessageInfo + +func (m *CreateIndexRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *CreateIndexRequest) GetKeys() bool { + if m != nil { + return m.Keys + } + return false +} + +type CreateIndexResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateIndexResponse) Reset() { *m = CreateIndexResponse{} } +func (m *CreateIndexResponse) String() string { return proto.CompactTextString(m) } +func (*CreateIndexResponse) ProtoMessage() {} +func (*CreateIndexResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ef0691a44d1e275c, []int{15} +} + +func (m *CreateIndexResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CreateIndexResponse.Unmarshal(m, b) +} +func (m *CreateIndexResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CreateIndexResponse.Marshal(b, m, deterministic) +} +func (m *CreateIndexResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateIndexResponse.Merge(m, src) +} +func (m *CreateIndexResponse) XXX_Size() int { + return xxx_messageInfo_CreateIndexResponse.Size(m) +} +func (m *CreateIndexResponse) XXX_DiscardUnknown() { + xxx_messageInfo_CreateIndexResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateIndexResponse proto.InternalMessageInfo + +type GetIndexRequest struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetIndexRequest) Reset() { *m = GetIndexRequest{} } +func (m *GetIndexRequest) String() string { return proto.CompactTextString(m) } +func (*GetIndexRequest) ProtoMessage() {} +func (*GetIndexRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ef0691a44d1e275c, []int{16} +} + +func (m *GetIndexRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetIndexRequest.Unmarshal(m, b) +} +func (m *GetIndexRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetIndexRequest.Marshal(b, m, deterministic) +} +func (m *GetIndexRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetIndexRequest.Merge(m, src) +} +func (m *GetIndexRequest) XXX_Size() int { + return xxx_messageInfo_GetIndexRequest.Size(m) +} +func (m *GetIndexRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetIndexRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetIndexRequest proto.InternalMessageInfo + +func (m *GetIndexRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +type GetIndexResponse struct { + Index *Index `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetIndexResponse) Reset() { *m = GetIndexResponse{} } +func (m *GetIndexResponse) String() string { return proto.CompactTextString(m) } +func (*GetIndexResponse) ProtoMessage() {} +func (*GetIndexResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ef0691a44d1e275c, []int{17} +} + +func (m *GetIndexResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetIndexResponse.Unmarshal(m, b) +} +func (m *GetIndexResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetIndexResponse.Marshal(b, m, deterministic) +} +func (m *GetIndexResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetIndexResponse.Merge(m, src) +} +func (m *GetIndexResponse) XXX_Size() int { + return xxx_messageInfo_GetIndexResponse.Size(m) +} +func (m *GetIndexResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetIndexResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetIndexResponse proto.InternalMessageInfo + +func (m *GetIndexResponse) GetIndex() *Index { + if m != nil { + return m.Index + } + return nil +} + +type GetIndexesRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetIndexesRequest) Reset() { *m = GetIndexesRequest{} } +func (m *GetIndexesRequest) String() string { return proto.CompactTextString(m) } +func (*GetIndexesRequest) ProtoMessage() {} +func (*GetIndexesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ef0691a44d1e275c, []int{18} +} + +func (m *GetIndexesRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetIndexesRequest.Unmarshal(m, b) +} +func (m *GetIndexesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetIndexesRequest.Marshal(b, m, deterministic) +} +func (m *GetIndexesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetIndexesRequest.Merge(m, src) +} +func (m *GetIndexesRequest) XXX_Size() int { + return xxx_messageInfo_GetIndexesRequest.Size(m) +} +func (m *GetIndexesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetIndexesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetIndexesRequest proto.InternalMessageInfo + +type GetIndexesResponse struct { + Indexes []*Index `protobuf:"bytes,1,rep,name=indexes,proto3" json:"indexes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetIndexesResponse) Reset() { *m = GetIndexesResponse{} } +func (m *GetIndexesResponse) String() string { return proto.CompactTextString(m) } +func (*GetIndexesResponse) ProtoMessage() {} +func (*GetIndexesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ef0691a44d1e275c, []int{19} +} + +func (m *GetIndexesResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetIndexesResponse.Unmarshal(m, b) +} +func (m *GetIndexesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetIndexesResponse.Marshal(b, m, deterministic) +} +func (m *GetIndexesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetIndexesResponse.Merge(m, src) +} +func (m *GetIndexesResponse) XXX_Size() int { + return xxx_messageInfo_GetIndexesResponse.Size(m) +} +func (m *GetIndexesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetIndexesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetIndexesResponse proto.InternalMessageInfo + +func (m *GetIndexesResponse) GetIndexes() []*Index { + if m != nil { + return m.Indexes + } + return nil +} + +type DeleteIndexRequest struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteIndexRequest) Reset() { *m = DeleteIndexRequest{} } +func (m *DeleteIndexRequest) String() string { return proto.CompactTextString(m) } +func (*DeleteIndexRequest) ProtoMessage() {} +func (*DeleteIndexRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ef0691a44d1e275c, []int{20} +} + +func (m *DeleteIndexRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DeleteIndexRequest.Unmarshal(m, b) +} +func (m *DeleteIndexRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DeleteIndexRequest.Marshal(b, m, deterministic) +} +func (m *DeleteIndexRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteIndexRequest.Merge(m, src) +} +func (m *DeleteIndexRequest) XXX_Size() int { + return xxx_messageInfo_DeleteIndexRequest.Size(m) +} +func (m *DeleteIndexRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteIndexRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteIndexRequest proto.InternalMessageInfo + +func (m *DeleteIndexRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +type DeleteIndexResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteIndexResponse) Reset() { *m = DeleteIndexResponse{} } +func (m *DeleteIndexResponse) String() string { return proto.CompactTextString(m) } +func (*DeleteIndexResponse) ProtoMessage() {} +func (*DeleteIndexResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ef0691a44d1e275c, []int{21} +} + +func (m *DeleteIndexResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DeleteIndexResponse.Unmarshal(m, b) +} +func (m *DeleteIndexResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DeleteIndexResponse.Marshal(b, m, deterministic) +} +func (m *DeleteIndexResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteIndexResponse.Merge(m, src) +} +func (m *DeleteIndexResponse) XXX_Size() int { + return xxx_messageInfo_DeleteIndexResponse.Size(m) +} +func (m *DeleteIndexResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteIndexResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteIndexResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*QueryPQLRequest)(nil), "pilosa.QueryPQLRequest") proto.RegisterType((*QuerySQLRequest)(nil), "pilosa.QuerySQLRequest") @@ -852,60 +1187,79 @@ func init() { proto.RegisterType((*Uint64Array)(nil), "pilosa.Uint64Array") proto.RegisterType((*StringArray)(nil), "pilosa.StringArray") proto.RegisterType((*IdsOrKeys)(nil), "pilosa.IdsOrKeys") + proto.RegisterType((*Index)(nil), "pilosa.Index") + proto.RegisterType((*CreateIndexRequest)(nil), "pilosa.CreateIndexRequest") + proto.RegisterType((*CreateIndexResponse)(nil), "pilosa.CreateIndexResponse") + proto.RegisterType((*GetIndexRequest)(nil), "pilosa.GetIndexRequest") + proto.RegisterType((*GetIndexResponse)(nil), "pilosa.GetIndexResponse") + proto.RegisterType((*GetIndexesRequest)(nil), "pilosa.GetIndexesRequest") + proto.RegisterType((*GetIndexesResponse)(nil), "pilosa.GetIndexesResponse") + proto.RegisterType((*DeleteIndexRequest)(nil), "pilosa.DeleteIndexRequest") + proto.RegisterType((*DeleteIndexResponse)(nil), "pilosa.DeleteIndexResponse") } func init() { proto.RegisterFile("pilosa.proto", fileDescriptor_ef0691a44d1e275c) } var fileDescriptor_ef0691a44d1e275c = []byte{ - // 761 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0xcd, 0x72, 0xd3, 0x48, - 0x10, 0xb6, 0x22, 0xc5, 0xb6, 0xda, 0xf9, 0xdb, 0xc9, 0x6e, 0x56, 0x95, 0xda, 0xda, 0x55, 0x94, - 0xc3, 0x7a, 0x6b, 0xb7, 0x92, 0xac, 0x77, 0x03, 0x05, 0x84, 0x43, 0x12, 0xa0, 0x9c, 0x02, 0x0a, - 0x67, 0x42, 0x72, 0xe0, 0x36, 0xb6, 0xc6, 0x8e, 0x8a, 0xb1, 0xc6, 0xd6, 0x48, 0x09, 0x7e, 0x01, - 0xde, 0x87, 0x33, 0x17, 0x4e, 0x3c, 0x17, 0x35, 0x33, 0x1a, 0xd9, 0x0a, 0x98, 0x0a, 0x54, 0x71, - 0xf2, 0x74, 0x7f, 0x5f, 0xb7, 0xfa, 0x9b, 0xee, 0x69, 0xc3, 0xd2,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, - 0xa3, 0x2a, 0x38, 0xf2, 0xb1, 0xb4, 0x3e, 0x2e, 0x40, 0xb5, 0xa3, 0x68, 0xe8, 0x00, 0xea, 0x66, - 0x0f, 0xa3, 0x5f, 0x4d, 0xec, 0x8d, 0xcd, 0xbc, 0xb9, 0x3e, 0xbb, 0x00, 0xf2, 0xe7, 0x15, 0x54, - 0xf6, 0x2c, 0x74, 0x08, 0xcb, 0x86, 0x7b, 0x1e, 0x93, 0x64, 0x32, 0x3f, 0xc5, 0x2f, 0x06, 0x28, - 0xad, 0xa5, 0xa0, 0x52, 0x14, 0xd0, 0xf9, 0xac, 0x80, 0xce, 0x37, 0x14, 0xd0, 0xf9, 0x72, 0x01, - 0x9d, 0x5b, 0x14, 0x70, 0x1f, 0x6a, 0xf9, 0xe0, 0xa1, 0x62, 0xaf, 0x96, 0x27, 0x71, 0xee, 0xe7, - 0x8f, 0xb6, 0x5f, 0x6d, 0x0d, 0xa2, 0xf4, 0x32, 0xeb, 0xee, 0xf4, 0xf8, 0x70, 0x57, 0x93, 0xcc, - 0xcf, 0x55, 0x6b, 0x57, 0xfd, 0x5b, 0x76, 0xab, 0xea, 0xe7, 0xbf, 0x4f, 0x01, 0x00, 0x00, 0xff, - 0xff, 0x18, 0x84, 0x1c, 0xb4, 0x44, 0x07, 0x00, 0x00, + // 923 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xdb, 0x72, 0x1b, 0x45, + 0x10, 0xd5, 0x66, 0xd7, 0xba, 0xf4, 0xfa, 0x96, 0x31, 0x31, 0x8b, 0x42, 0x81, 0x32, 0x2e, 0x2a, + 0xa2, 0xa0, 0x9c, 0x20, 0x08, 0x29, 0xc0, 0x29, 0x2a, 0x76, 0x02, 0x72, 0x01, 0x85, 0x32, 0x21, + 0x79, 0xe0, 0x6d, 0x24, 0x8d, 0x9c, 0x2d, 0x56, 0x3b, 0xf2, 0xce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+ 0xbd, 0x0e, 0xca, 0xd3, 0x7c, 0x0d, 0x4d, 0xe7, 0x47, 0x6f, 0x2f, 0x33, 0x5d, 0x8a, 0x68, 0x15, + 0xc8, 0x13, 0xf4, 0x21, 0x2c, 0x69, 0x2e, 0x14, 0xad, 0xb6, 0xac, 0x50, 0xb4, 0xa6, 0x49, 0xb8, + 0x86, 0x4e, 0xa0, 0xe9, 0x3e, 0x05, 0x8a, 0x52, 0x96, 0x3e, 0x0e, 0xda, 0x07, 0xe5, 0xff, 0xa0, + 0x3c, 0xf6, 0xbe, 0x87, 0x1e, 0xc3, 0x8e, 0xe3, 0xbe, 0x48, 0x69, 0xb6, 0xd8, 0x9c, 0xe2, 0x96, + 0x03, 0x2a, 0xff, 0x8c, 0xa5, 0x02, 0x06, 0x2b, 0x05, 0x0c, 0xfe, 0x45, 0x01, 0x83, 0xf5, 0x05, + 0x0c, 0xde, 0xa0, 0x80, 0x2f, 0xa1, 0x61, 0xdf, 0x3e, 0x74, 0x58, 0x1c, 0xc6, 0xf2, 0x63, 0xb8, + 0x71, 0xfb, 0xd3, 0xa3, 0x9f, 0xef, 0x5c, 0xc4, 0xf2, 0xd5, 0x7c, 0x78, 0x3c, 0xe2, 0xd3, 0x7b, + 0x86, 0xe4, 0x7e, 0xae, 0x7a, 0xf7, 0xf4, 0x07, 0xdb, 0xb0, 0xae, 0x7f, 0x3e, 0xfd, 0x3b, 0x00, + 0x00, 0xff, 0xff, 0x75, 0x3f, 0x36, 0x94, 0xc7, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -920,6 +1274,10 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type PilosaClient interface { + CreateIndex(ctx context.Context, in *CreateIndexRequest, opts ...grpc.CallOption) (*CreateIndexResponse, error) + GetIndexes(ctx context.Context, in *GetIndexesRequest, opts ...grpc.CallOption) (*GetIndexesResponse, error) + GetIndex(ctx context.Context, in *GetIndexRequest, opts ...grpc.CallOption) (*GetIndexResponse, error) + DeleteIndex(ctx context.Context, in *DeleteIndexRequest, opts ...grpc.CallOption) (*DeleteIndexResponse, error) QuerySQL(ctx context.Context, in *QuerySQLRequest, opts ...grpc.CallOption) (Pilosa_QuerySQLClient, error) QuerySQLUnary(ctx context.Context, in *QuerySQLRequest, opts ...grpc.CallOption) (*TableResponse, error) QueryPQL(ctx context.Context, in *QueryPQLRequest, opts ...grpc.CallOption) (Pilosa_QueryPQLClient, error) @@ -935,6 +1293,42 @@ func NewPilosaClient(cc *grpc.ClientConn) PilosaClient { return &pilosaClient{cc} } +func (c *pilosaClient) CreateIndex(ctx context.Context, in *CreateIndexRequest, opts ...grpc.CallOption) (*CreateIndexResponse, error) { + out := new(CreateIndexResponse) + err := c.cc.Invoke(ctx, "/pilosa.Pilosa/CreateIndex", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *pilosaClient) GetIndexes(ctx context.Context, in *GetIndexesRequest, opts ...grpc.CallOption) (*GetIndexesResponse, error) { + out := new(GetIndexesResponse) + err := c.cc.Invoke(ctx, "/pilosa.Pilosa/GetIndexes", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *pilosaClient) GetIndex(ctx context.Context, in *GetIndexRequest, opts ...grpc.CallOption) (*GetIndexResponse, error) { + out := new(GetIndexResponse) + err := c.cc.Invoke(ctx, "/pilosa.Pilosa/GetIndex", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *pilosaClient) DeleteIndex(ctx context.Context, in *DeleteIndexRequest, opts ...grpc.CallOption) (*DeleteIndexResponse, error) { + out := new(DeleteIndexResponse) + err := c.cc.Invoke(ctx, "/pilosa.Pilosa/DeleteIndex", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *pilosaClient) QuerySQL(ctx context.Context, in *QuerySQLRequest, opts ...grpc.CallOption) (Pilosa_QuerySQLClient, error) { stream, err := c.cc.NewStream(ctx, &_Pilosa_serviceDesc.Streams[0], "/pilosa.Pilosa/QuerySQL", opts...) if err != nil { @@ -1051,6 +1445,10 @@ func (x *pilosaInspectClient) Recv() (*RowResponse, error) { // PilosaServer is the server API for Pilosa service. type PilosaServer interface { + CreateIndex(context.Context, *CreateIndexRequest) (*CreateIndexResponse, error) + GetIndexes(context.Context, *GetIndexesRequest) (*GetIndexesResponse, error) + GetIndex(context.Context, *GetIndexRequest) (*GetIndexResponse, error) + DeleteIndex(context.Context, *DeleteIndexRequest) (*DeleteIndexResponse, error) QuerySQL(*QuerySQLRequest, Pilosa_QuerySQLServer) error QuerySQLUnary(context.Context, *QuerySQLRequest) (*TableResponse, error) QueryPQL(*QueryPQLRequest, Pilosa_QueryPQLServer) error @@ -1062,6 +1460,18 @@ type PilosaServer interface { type UnimplementedPilosaServer struct { } +func (*UnimplementedPilosaServer) CreateIndex(ctx context.Context, req *CreateIndexRequest) (*CreateIndexResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateIndex not implemented") +} +func (*UnimplementedPilosaServer) GetIndexes(ctx context.Context, req *GetIndexesRequest) (*GetIndexesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetIndexes not implemented") +} +func (*UnimplementedPilosaServer) GetIndex(ctx context.Context, req *GetIndexRequest) (*GetIndexResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetIndex not implemented") +} +func (*UnimplementedPilosaServer) DeleteIndex(ctx context.Context, req *DeleteIndexRequest) (*DeleteIndexResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteIndex not implemented") +} func (*UnimplementedPilosaServer) QuerySQL(req *QuerySQLRequest, srv Pilosa_QuerySQLServer) error { return status.Errorf(codes.Unimplemented, "method QuerySQL not implemented") } @@ -1082,6 +1492,78 @@ func RegisterPilosaServer(s *grpc.Server, srv PilosaServer) { s.RegisterService(&_Pilosa_serviceDesc, srv) } +func _Pilosa_CreateIndex_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateIndexRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PilosaServer).CreateIndex(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pilosa.Pilosa/CreateIndex", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PilosaServer).CreateIndex(ctx, req.(*CreateIndexRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Pilosa_GetIndexes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetIndexesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PilosaServer).GetIndexes(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pilosa.Pilosa/GetIndexes", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PilosaServer).GetIndexes(ctx, req.(*GetIndexesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Pilosa_GetIndex_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetIndexRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PilosaServer).GetIndex(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pilosa.Pilosa/GetIndex", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PilosaServer).GetIndex(ctx, req.(*GetIndexRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Pilosa_DeleteIndex_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteIndexRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PilosaServer).DeleteIndex(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pilosa.Pilosa/DeleteIndex", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PilosaServer).DeleteIndex(ctx, req.(*DeleteIndexRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Pilosa_QuerySQL_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(QuerySQLRequest) if err := stream.RecvMsg(m); err != nil { @@ -1185,6 +1667,22 @@ var _Pilosa_serviceDesc = grpc.ServiceDesc{ ServiceName: "pilosa.Pilosa", HandlerType: (*PilosaServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "CreateIndex", + Handler: _Pilosa_CreateIndex_Handler, + }, + { + MethodName: "GetIndexes", + Handler: _Pilosa_GetIndexes_Handler, + }, + { + MethodName: "GetIndex", + Handler: _Pilosa_GetIndex_Handler, + }, + { + MethodName: "DeleteIndex", + Handler: _Pilosa_DeleteIndex_Handler, + }, { MethodName: "QuerySQLUnary", Handler: _Pilosa_QuerySQLUnary_Handler, diff --git a/proto/pilosa.proto b/proto/pilosa.proto index 898614478..80b82de86 100644 --- a/proto/pilosa.proto +++ b/proto/pilosa.proto @@ -85,7 +85,45 @@ message IdsOrKeys { } } +message Index { + string name = 1; +} + +message CreateIndexRequest { + string name = 1; + bool keys = 2; +} + +message CreateIndexResponse { +} + +message GetIndexRequest { + string name = 1; +} + +message GetIndexResponse { + Index index = 1; +} + +message GetIndexesRequest { +} + +message GetIndexesResponse { + repeated Index indexes = 1; +} + +message DeleteIndexRequest { + string name = 1; +} + +message DeleteIndexResponse { +} + service Pilosa { + rpc CreateIndex(CreateIndexRequest) returns (CreateIndexResponse) {}; + rpc GetIndexes(GetIndexesRequest) returns (GetIndexesResponse) {}; + rpc GetIndex(GetIndexRequest) returns (GetIndexResponse) {}; + rpc DeleteIndex(DeleteIndexRequest) returns (DeleteIndexResponse) {}; rpc QuerySQL(QuerySQLRequest) returns (stream RowResponse) {}; rpc QuerySQLUnary(QuerySQLRequest) returns (TableResponse) {}; rpc QueryPQL(QueryPQLRequest) returns (stream RowResponse) {}; diff --git a/server/grpc.go b/server/grpc.go index d8544ed97..55ad7e67d 100644 --- a/server/grpc.go +++ b/server/grpc.go @@ -68,7 +68,7 @@ func errToStatusError(err error) error { } // Check error string. - switch errors.Cause(err) { + switch cause := errors.Cause(err); cause { case pilosa.ErrIndexNotFound, pilosa.ErrFieldNotFound, pilosa.ErrForeignIndexNotFound, @@ -123,6 +123,10 @@ func errToStatusError(err error) error { pilosa.ErrTooManyWrites, pilosa.ErrNodeIDNotExists: return status.Error(codes.Internal, err.Error()) + default: + if _, ok := cause.(pilosa.ConflictError); ok { + return status.Error(codes.AlreadyExists, err.Error()) + } } return status.Error(codes.Unknown, err.Error()) @@ -267,6 +271,47 @@ func (h *GRPCHandler) QueryPQLUnary(ctx context.Context, req *pb.QueryPQLRequest return table, errToStatusError(nil) } +// CreateIndex creates a new Index +func (h *GRPCHandler) CreateIndex(ctx context.Context, req *pb.CreateIndexRequest) (*pb.CreateIndexResponse, error) { + // Always enable TrackExistence for gRPC-created indexes + opts := pilosa.IndexOptions{Keys: req.Keys, TrackExistence: true} + _, err := h.api.CreateIndex(ctx, req.Name, opts) + if err != nil { + return nil, errToStatusError(err) + } + return &pb.CreateIndexResponse{}, nil +} + +// GetIndex returns a single Index given a name +func (h *GRPCHandler) GetIndex(ctx context.Context, req *pb.GetIndexRequest) (*pb.GetIndexResponse, error) { + schema := h.api.Schema(ctx) + for _, index := range schema { + if req.Name == index.Name { + return &pb.GetIndexResponse{Index: &pb.Index{Name: index.Name}}, nil + } + } + return nil, status.Error(codes.NotFound, fmt.Sprintf("Index with name %s not found", req.Name)) +} + +// GetIndexes returns a list of all Indexes +func (h *GRPCHandler) GetIndexes(ctx context.Context, req *pb.GetIndexesRequest) (*pb.GetIndexesResponse, error) { + schema := h.api.Schema(ctx) + indexes := make([]*pb.Index, len(schema)) + for i, index := range schema { + indexes[i] = &pb.Index{Name: index.Name} + } + return &pb.GetIndexesResponse{Indexes: indexes}, nil +} + +// DeleteIndex deletes an Index +func (h *GRPCHandler) DeleteIndex(ctx context.Context, req *pb.DeleteIndexRequest) (*pb.DeleteIndexResponse, error) { + err := h.api.DeleteIndex(ctx, req.Name) + if err != nil { + return nil, errToStatusError(err) + } + return &pb.DeleteIndexResponse{}, nil +} + // VDSMGRPCHandler contains methods which handle the various gRPC requests, ported from VDSM. type VDSMGRPCHandler struct { grpcHandler *GRPCHandler diff --git a/server/grpc_test.go b/server/grpc_test.go index 79d40b0f1..49bf03103 100644 --- a/server/grpc_test.go +++ b/server/grpc_test.go @@ -986,6 +986,171 @@ func TestQuerySQLUnaryWithError(t *testing.T) { } } +func TestCRUDIndexes(t *testing.T) { + m := test.RunCommand(t) + defer m.Close() + + ctx := context.Background() + gh := server.NewGRPCHandler(m.API) + + t.Run("CreateIndex", func(t *testing.T) { + // Try CreateIndex for testindex1 + _, err := gh.CreateIndex(ctx, &pb.CreateIndexRequest{Name: "testindex1", Keys: true}) + if err != nil { + t.Fatal(err) + } + + schema := m.API.Schema(ctx) + if len(schema) != 1 { + t.Fatal("Schema should include one index") + } + if schema[0].Name != "testindex1" { + t.Fatal("Index name not set correctly") + } + if schema[0].Options.Keys != true { + t.Fatal("Index Keys not set correctly") + } + if schema[0].Options.TrackExistence != true { + t.Fatal("Index TrackExistence should be true when created by gRPC") + } + + // Try CreateIndex for testindex2 + _, err = gh.CreateIndex(ctx, &pb.CreateIndexRequest{Name: "testindex2"}) + if err != nil { + t.Fatal(err) + } + + schema = m.API.Schema(ctx) + if len(schema) != 2 { + t.Fatal("Schema should include two indexes") + } + + _ = m.API.DeleteIndex(ctx, "testindex1") + + schema = m.API.Schema(ctx) + if len(schema) != 1 { + t.Fatal("Schema should include one index") + } + if schema[0].Name != "testindex2" { + t.Fatal("Index name not set correctly") + } + if schema[0].Options.Keys != false { + t.Fatal("Index Keys not set correctly") + } + + // Check errors for CreateIndex: create index with same name + _, err = gh.CreateIndex(ctx, &pb.CreateIndexRequest{Name: "testindex2"}) + errStatus, _ := status.FromError(err) + if errStatus.Code() != codes.AlreadyExists { + t.Fatalf("Error code should be codes.AlreadyExists, but is %v", errStatus.Code()) + } + + // Check errors for CreateIndex: create index with no name + _, err = gh.CreateIndex(ctx, &pb.CreateIndexRequest{Name: ""}) + errStatus, _ = status.FromError(err) + if errStatus.Code() != codes.Unknown { + t.Fatalf("Error code should be codes.Unknown, but is %v", errStatus.Code()) + } + + // Check errors for CreateIndex: create index with invalid name + _, err = gh.CreateIndex(ctx, &pb.CreateIndexRequest{Name: "💩"}) + errStatus, _ = status.FromError(err) + if errStatus.Code() != codes.FailedPrecondition { + t.Fatalf("Error code should be codes.FailedPrecondition, but is %v", errStatus.Code()) + } + + _ = m.API.DeleteIndex(ctx, "testindex2") + }) + + t.Run("GetIndex", func(t *testing.T) { + _, err := m.API.CreateIndex(ctx, "testindex1", pilosa.IndexOptions{}) + if err != nil { + t.Fatal(err) + } + + // Check GetIndex for testindex1 + resp, err := gh.GetIndex(ctx, &pb.GetIndexRequest{Name: "testindex1"}) + if err != nil { + t.Fatal(err) + } + if resp.Index.Name != "testindex1" { + t.Fatalf("Index name does not match: %s", resp.Index.Name) + } + + // Check errors for GetIndex: get index that doesn't exist + _, err = gh.GetIndex(ctx, &pb.GetIndexRequest{Name: "wrongname"}) + errStatus, _ := status.FromError(err) + if errStatus.Code() != codes.NotFound { + t.Fatalf("Error code should be codes.NotFound, but is %v", errStatus.Code()) + } + + // Check errors for GetIndex: get index with invalid name + _, err = gh.GetIndex(ctx, &pb.GetIndexRequest{Name: "💩"}) + errStatus, _ = status.FromError(err) + if errStatus.Code() != codes.NotFound { + t.Fatalf("Error code should be codes.NotFound, but is %v", errStatus.Code()) + } + _ = m.API.DeleteIndex(ctx, "testindex1") + }) + + t.Run("GetIndexes", func(t *testing.T) { + _, err := m.API.CreateIndex(ctx, "testindex1", pilosa.IndexOptions{}) + if err != nil { + t.Fatal(err) + } + + // Check GetIndexes + resp2, err := gh.GetIndexes(ctx, &pb.GetIndexesRequest{}) + if err != nil { + t.Fatal(err) + } + if len(resp2.Indexes) != 1 && resp2.Indexes[0].Name != "testindex1" { + t.Fatalf("GetIndexes did not produce the correct result set: %v", resp2.Indexes) + } + + _, err = m.API.CreateIndex(ctx, "testindex2", pilosa.IndexOptions{}) + if err != nil { + t.Fatal(err) + } + + // Check GetIndexes again + resp, err := gh.GetIndexes(ctx, &pb.GetIndexesRequest{}) + if err != nil { + t.Fatal(err) + } + if len(resp.Indexes) != 2 { + t.Fatalf("GetIndexes did not produce the correct result set: %v", resp.Indexes) + } + _ = m.API.DeleteIndex(ctx, "testindex1") + _ = m.API.DeleteIndex(ctx, "testindex2") + }) + + t.Run("DeleteIndexes", func(t *testing.T) { + _, err := m.API.CreateIndex(ctx, "testindex1", pilosa.IndexOptions{}) + if err != nil { + t.Fatal(err) + } + + // Try to delete index + _, err = gh.DeleteIndex(ctx, &pb.DeleteIndexRequest{Name: "testindex1"}) + if err != nil { + t.Fatal(err) + } + + schema := m.API.Schema(ctx) + if len(schema) != 0 { + t.Fatal("Schema should include no index") + } + + // Try to delete non-existing index + _, err = gh.DeleteIndex(ctx, &pb.DeleteIndexRequest{Name: "doesnotexist"}) + errStatus, _ := status.FromError(err) + if errStatus.Code() != codes.NotFound { + t.Fatalf("Error code should be codes.NotFound, but is %v", errStatus.Code()) + } + }) +} + func setUpTestQuerySQLUnary(ctx context.Context, t *testing.T) (gh *server.GRPCHandler, tearDownFunc func()) { t.Helper()