mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 17:15:56 +00:00
Merge branch 'master' into arm64-support
This commit is contained in:
commit
53dfccbde4
7 changed files with 785 additions and 75 deletions
30
api.go
30
api.go
|
|
@ -1157,6 +1157,36 @@ func (api *API) Info() serverInfo {
|
|||
}
|
||||
}
|
||||
|
||||
func (api *API) TranslateKeys(body io.Reader) ([]byte, error) {
|
||||
reqBytes, err := ioutil.ReadAll(body)
|
||||
if err != nil {
|
||||
return nil, NewBadRequestError(errors.Wrap(err, "read body error"))
|
||||
}
|
||||
var req TranslateKeysRequest
|
||||
if err := api.Serializer.Unmarshal(reqBytes, &req); err != nil {
|
||||
return nil, NewBadRequestError(errors.Wrap(err, "unmarshal body error"))
|
||||
}
|
||||
var ids []uint64
|
||||
if req.Field == "" {
|
||||
ids, err = api.holder.translateFile.TranslateColumnsToUint64(req.Index, req.Keys)
|
||||
} else {
|
||||
ids, err = api.holder.translateFile.TranslateRowsToUint64(req.Index, req.Field, req.Keys)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp := TranslateKeysResponse{
|
||||
IDs: ids,
|
||||
}
|
||||
// Encode response.
|
||||
buf, err := api.Serializer.Marshal(&resp)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "translate keys response encoding error")
|
||||
}
|
||||
return buf, nil
|
||||
}
|
||||
|
||||
type serverInfo struct {
|
||||
ShardWidth uint64 `json:"shardWidth"`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -249,6 +249,22 @@ func (Serializer) Unmarshal(buf []byte, m pilosa.Message) error {
|
|||
}
|
||||
decodeBlockDataResponse(msg, mt)
|
||||
return nil
|
||||
case *pilosa.TranslateKeysRequest:
|
||||
msg := &internal.TranslateKeysRequest{}
|
||||
err := proto.Unmarshal(buf, msg)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "unmarshaling TranslateKeysRequest")
|
||||
}
|
||||
decodeTranslateKeysRequest(msg, mt)
|
||||
return nil
|
||||
case *pilosa.TranslateKeysResponse:
|
||||
msg := &internal.TranslateKeysResponse{}
|
||||
err := proto.Unmarshal(buf, msg)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "unmarshaling TranslateKeysResponse")
|
||||
}
|
||||
decodeTranslateKeysResponse(msg, mt)
|
||||
return nil
|
||||
default:
|
||||
panic(fmt.Sprintf("unhandled pilosa.Message of type %T: %#v", mt, m))
|
||||
}
|
||||
|
|
@ -308,6 +324,10 @@ func encodeToProto(m pilosa.Message) proto.Message {
|
|||
return encodeBlockDataRequest(mt)
|
||||
case *pilosa.BlockDataResponse:
|
||||
return encodeBlockDataResponse(mt)
|
||||
case *pilosa.TranslateKeysRequest:
|
||||
return encodeTranslateKeysRequest(mt)
|
||||
case *pilosa.TranslateKeysResponse:
|
||||
return encodeTranslateKeysResponse(mt)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
@ -695,6 +715,20 @@ func encodeRecalculateCaches(*pilosa.RecalculateCaches) *internal.RecalculateCac
|
|||
return &internal.RecalculateCaches{}
|
||||
}
|
||||
|
||||
func encodeTranslateKeysResponse(response *pilosa.TranslateKeysResponse) *internal.TranslateKeysResponse {
|
||||
return &internal.TranslateKeysResponse{
|
||||
IDs: response.IDs,
|
||||
}
|
||||
}
|
||||
|
||||
func encodeTranslateKeysRequest(request *pilosa.TranslateKeysRequest) *internal.TranslateKeysRequest {
|
||||
return &internal.TranslateKeysRequest{
|
||||
Index: request.Index,
|
||||
Field: request.Field,
|
||||
Keys: request.Keys,
|
||||
}
|
||||
}
|
||||
|
||||
func decodeResizeInstruction(ri *internal.ResizeInstruction, m *pilosa.ResizeInstruction) {
|
||||
m.JobID = ri.JobID
|
||||
m.Node = &pilosa.Node{}
|
||||
|
|
@ -999,6 +1033,16 @@ func decodeQueryResults(pb []*internal.QueryResult, m []interface{}) {
|
|||
}
|
||||
}
|
||||
|
||||
func decodeTranslateKeysRequest(pb *internal.TranslateKeysRequest, m *pilosa.TranslateKeysRequest) {
|
||||
m.Index = pb.Index
|
||||
m.Field = pb.Field
|
||||
m.Keys = pb.Keys
|
||||
}
|
||||
|
||||
func decodeTranslateKeysResponse(pb *internal.TranslateKeysResponse, m *pilosa.TranslateKeysResponse) {
|
||||
m.IDs = pb.IDs
|
||||
}
|
||||
|
||||
// QueryResult types.
|
||||
const (
|
||||
queryResultTypeNil uint32 = iota
|
||||
|
|
|
|||
10
handler.go
10
handler.go
|
|
@ -117,3 +117,13 @@ type BlockDataResponse struct {
|
|||
RowIDs []uint64
|
||||
ColumnIDs []uint64
|
||||
}
|
||||
|
||||
type TranslateKeysRequest struct {
|
||||
Index string
|
||||
Field string
|
||||
Keys []string
|
||||
}
|
||||
|
||||
type TranslateKeysResponse struct {
|
||||
IDs []uint64
|
||||
}
|
||||
|
|
|
|||
|
|
@ -198,6 +198,7 @@ func (h *Handler) populateValidators() {
|
|||
h.validators["GetNodes"] = queryValidationSpecRequired()
|
||||
h.validators["GetShardMax"] = queryValidationSpecRequired()
|
||||
h.validators["GetTranslateData"] = queryValidationSpecRequired("offset")
|
||||
h.validators["PostTranslateKeys"] = queryValidationSpecRequired()
|
||||
}
|
||||
|
||||
func (h *Handler) queryArgValidator(next http.Handler) http.Handler {
|
||||
|
|
@ -268,6 +269,7 @@ func newRouter(handler *Handler) *mux.Router {
|
|||
router.HandleFunc("/internal/nodes", handler.handleGetNodes).Methods("GET").Name("GetNodes")
|
||||
router.HandleFunc("/internal/shards/max", handler.handleGetShardsMax).Methods("GET").Name("GetShardsMax") // TODO: deprecate, but it's being used by the client
|
||||
router.HandleFunc("/internal/translate/data", handler.handleGetTranslateData).Methods("GET").Name("GetTranslateData")
|
||||
router.HandleFunc("/internal/translate/keys", handler.handlePostTranslateKeys).Methods("POST").Name("PostTranslateKeys")
|
||||
|
||||
router.Use(handler.queryArgValidator)
|
||||
router.Use(handler.extractTracing)
|
||||
|
|
@ -1570,3 +1572,25 @@ func (h *Handler) handlePostImportRoaring(w http.ResponseWriter, r *http.Request
|
|||
h.logger.Printf("writing import-roaring response: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func (h *Handler) handlePostTranslateKeys(w http.ResponseWriter, r *http.Request) {
|
||||
// Verify that request is only communicating over protobufs.
|
||||
if r.Header.Get("Content-Type") != "application/x-protobuf" {
|
||||
http.Error(w, "Unsupported media type", http.StatusUnsupportedMediaType)
|
||||
return
|
||||
} else if r.Header.Get("Accept") != "application/x-protobuf" {
|
||||
http.Error(w, "Not acceptable", http.StatusNotAcceptable)
|
||||
return
|
||||
}
|
||||
|
||||
buf, err := h.api.TranslateKeys(r.Body)
|
||||
if err != nil {
|
||||
http.Error(w, fmt.Sprintf("translate keys: %v", err), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
// Write response.
|
||||
_, err = w.Write(buf)
|
||||
if err != nil {
|
||||
h.logger.Printf("writing translate keys response: %v", err)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ func (m *Row) Reset() { *m = Row{} }
|
|||
func (m *Row) String() string { return proto.CompactTextString(m) }
|
||||
func (*Row) ProtoMessage() {}
|
||||
func (*Row) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_public_5eafd62083455670, []int{0}
|
||||
return fileDescriptor_public_7d901ba8e84abe50, []int{0}
|
||||
}
|
||||
func (m *Row) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
|
@ -97,7 +97,7 @@ func (m *RowIdentifiers) Reset() { *m = RowIdentifiers{} }
|
|||
func (m *RowIdentifiers) String() string { return proto.CompactTextString(m) }
|
||||
func (*RowIdentifiers) ProtoMessage() {}
|
||||
func (*RowIdentifiers) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_public_5eafd62083455670, []int{1}
|
||||
return fileDescriptor_public_7d901ba8e84abe50, []int{1}
|
||||
}
|
||||
func (m *RowIdentifiers) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
|
@ -153,7 +153,7 @@ func (m *Pair) Reset() { *m = Pair{} }
|
|||
func (m *Pair) String() string { return proto.CompactTextString(m) }
|
||||
func (*Pair) ProtoMessage() {}
|
||||
func (*Pair) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_public_5eafd62083455670, []int{2}
|
||||
return fileDescriptor_public_7d901ba8e84abe50, []int{2}
|
||||
}
|
||||
func (m *Pair) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
|
@ -215,7 +215,7 @@ func (m *FieldRow) Reset() { *m = FieldRow{} }
|
|||
func (m *FieldRow) String() string { return proto.CompactTextString(m) }
|
||||
func (*FieldRow) ProtoMessage() {}
|
||||
func (*FieldRow) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_public_5eafd62083455670, []int{3}
|
||||
return fileDescriptor_public_7d901ba8e84abe50, []int{3}
|
||||
}
|
||||
func (m *FieldRow) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
|
@ -270,7 +270,7 @@ func (m *GroupCount) Reset() { *m = GroupCount{} }
|
|||
func (m *GroupCount) String() string { return proto.CompactTextString(m) }
|
||||
func (*GroupCount) ProtoMessage() {}
|
||||
func (*GroupCount) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_public_5eafd62083455670, []int{4}
|
||||
return fileDescriptor_public_7d901ba8e84abe50, []int{4}
|
||||
}
|
||||
func (m *GroupCount) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
|
@ -325,7 +325,7 @@ func (m *ValCount) Reset() { *m = ValCount{} }
|
|||
func (m *ValCount) String() string { return proto.CompactTextString(m) }
|
||||
func (*ValCount) ProtoMessage() {}
|
||||
func (*ValCount) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_public_5eafd62083455670, []int{5}
|
||||
return fileDescriptor_public_7d901ba8e84abe50, []int{5}
|
||||
}
|
||||
func (m *ValCount) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
|
@ -381,7 +381,7 @@ func (m *Bit) Reset() { *m = Bit{} }
|
|||
func (m *Bit) String() string { return proto.CompactTextString(m) }
|
||||
func (*Bit) ProtoMessage() {}
|
||||
func (*Bit) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_public_5eafd62083455670, []int{6}
|
||||
return fileDescriptor_public_7d901ba8e84abe50, []int{6}
|
||||
}
|
||||
func (m *Bit) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
|
@ -444,7 +444,7 @@ func (m *ColumnAttrSet) Reset() { *m = ColumnAttrSet{} }
|
|||
func (m *ColumnAttrSet) String() string { return proto.CompactTextString(m) }
|
||||
func (*ColumnAttrSet) ProtoMessage() {}
|
||||
func (*ColumnAttrSet) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_public_5eafd62083455670, []int{7}
|
||||
return fileDescriptor_public_7d901ba8e84abe50, []int{7}
|
||||
}
|
||||
func (m *ColumnAttrSet) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
|
@ -510,7 +510,7 @@ func (m *Attr) Reset() { *m = Attr{} }
|
|||
func (m *Attr) String() string { return proto.CompactTextString(m) }
|
||||
func (*Attr) ProtoMessage() {}
|
||||
func (*Attr) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_public_5eafd62083455670, []int{8}
|
||||
return fileDescriptor_public_7d901ba8e84abe50, []int{8}
|
||||
}
|
||||
func (m *Attr) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
|
@ -592,7 +592,7 @@ func (m *AttrMap) Reset() { *m = AttrMap{} }
|
|||
func (m *AttrMap) String() string { return proto.CompactTextString(m) }
|
||||
func (*AttrMap) ProtoMessage() {}
|
||||
func (*AttrMap) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_public_5eafd62083455670, []int{9}
|
||||
return fileDescriptor_public_7d901ba8e84abe50, []int{9}
|
||||
}
|
||||
func (m *AttrMap) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
|
@ -644,7 +644,7 @@ func (m *QueryRequest) Reset() { *m = QueryRequest{} }
|
|||
func (m *QueryRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*QueryRequest) ProtoMessage() {}
|
||||
func (*QueryRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_public_5eafd62083455670, []int{10}
|
||||
return fileDescriptor_public_7d901ba8e84abe50, []int{10}
|
||||
}
|
||||
func (m *QueryRequest) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
|
@ -728,7 +728,7 @@ func (m *QueryResponse) Reset() { *m = QueryResponse{} }
|
|||
func (m *QueryResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*QueryResponse) ProtoMessage() {}
|
||||
func (*QueryResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_public_5eafd62083455670, []int{11}
|
||||
return fileDescriptor_public_7d901ba8e84abe50, []int{11}
|
||||
}
|
||||
func (m *QueryResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
|
@ -797,7 +797,7 @@ func (m *QueryResult) Reset() { *m = QueryResult{} }
|
|||
func (m *QueryResult) String() string { return proto.CompactTextString(m) }
|
||||
func (*QueryResult) ProtoMessage() {}
|
||||
func (*QueryResult) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_public_5eafd62083455670, []int{12}
|
||||
return fileDescriptor_public_7d901ba8e84abe50, []int{12}
|
||||
}
|
||||
func (m *QueryResult) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
|
@ -907,7 +907,7 @@ func (m *ImportRequest) Reset() { *m = ImportRequest{} }
|
|||
func (m *ImportRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ImportRequest) ProtoMessage() {}
|
||||
func (*ImportRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_public_5eafd62083455670, []int{13}
|
||||
return fileDescriptor_public_7d901ba8e84abe50, []int{13}
|
||||
}
|
||||
func (m *ImportRequest) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
|
@ -1008,7 +1008,7 @@ func (m *ImportValueRequest) Reset() { *m = ImportValueRequest{} }
|
|||
func (m *ImportValueRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ImportValueRequest) ProtoMessage() {}
|
||||
func (*ImportValueRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_public_5eafd62083455670, []int{14}
|
||||
return fileDescriptor_public_7d901ba8e84abe50, []int{14}
|
||||
}
|
||||
func (m *ImportValueRequest) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
|
@ -1079,6 +1079,116 @@ func (m *ImportValueRequest) GetValues() []int64 {
|
|||
return nil
|
||||
}
|
||||
|
||||
type TranslateKeysRequest struct {
|
||||
Index string `protobuf:"bytes,1,opt,name=Index,proto3" json:"Index,omitempty"`
|
||||
Field string `protobuf:"bytes,2,opt,name=Field,proto3" json:"Field,omitempty"`
|
||||
Keys []string `protobuf:"bytes,3,rep,name=Keys" json:"Keys,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *TranslateKeysRequest) Reset() { *m = TranslateKeysRequest{} }
|
||||
func (m *TranslateKeysRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*TranslateKeysRequest) ProtoMessage() {}
|
||||
func (*TranslateKeysRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_public_7d901ba8e84abe50, []int{15}
|
||||
}
|
||||
func (m *TranslateKeysRequest) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *TranslateKeysRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_TranslateKeysRequest.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalTo(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (dst *TranslateKeysRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_TranslateKeysRequest.Merge(dst, src)
|
||||
}
|
||||
func (m *TranslateKeysRequest) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *TranslateKeysRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_TranslateKeysRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_TranslateKeysRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *TranslateKeysRequest) GetIndex() string {
|
||||
if m != nil {
|
||||
return m.Index
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *TranslateKeysRequest) GetField() string {
|
||||
if m != nil {
|
||||
return m.Field
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *TranslateKeysRequest) GetKeys() []string {
|
||||
if m != nil {
|
||||
return m.Keys
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type TranslateKeysResponse struct {
|
||||
IDs []uint64 `protobuf:"varint,3,rep,packed,name=IDs" json:"IDs,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *TranslateKeysResponse) Reset() { *m = TranslateKeysResponse{} }
|
||||
func (m *TranslateKeysResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*TranslateKeysResponse) ProtoMessage() {}
|
||||
func (*TranslateKeysResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_public_7d901ba8e84abe50, []int{16}
|
||||
}
|
||||
func (m *TranslateKeysResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *TranslateKeysResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_TranslateKeysResponse.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalTo(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (dst *TranslateKeysResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_TranslateKeysResponse.Merge(dst, src)
|
||||
}
|
||||
func (m *TranslateKeysResponse) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *TranslateKeysResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_TranslateKeysResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_TranslateKeysResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *TranslateKeysResponse) GetIDs() []uint64 {
|
||||
if m != nil {
|
||||
return m.IDs
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ImportRoaringRequestView struct {
|
||||
Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"`
|
||||
Data []byte `protobuf:"bytes,2,opt,name=Data,proto3" json:"Data,omitempty"`
|
||||
|
|
@ -1091,7 +1201,7 @@ func (m *ImportRoaringRequestView) Reset() { *m = ImportRoaringRequestVi
|
|||
func (m *ImportRoaringRequestView) String() string { return proto.CompactTextString(m) }
|
||||
func (*ImportRoaringRequestView) ProtoMessage() {}
|
||||
func (*ImportRoaringRequestView) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_public_5eafd62083455670, []int{15}
|
||||
return fileDescriptor_public_7d901ba8e84abe50, []int{17}
|
||||
}
|
||||
func (m *ImportRoaringRequestView) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
|
@ -1146,7 +1256,7 @@ func (m *ImportRoaringRequest) Reset() { *m = ImportRoaringRequest{} }
|
|||
func (m *ImportRoaringRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ImportRoaringRequest) ProtoMessage() {}
|
||||
func (*ImportRoaringRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_public_5eafd62083455670, []int{16}
|
||||
return fileDescriptor_public_7d901ba8e84abe50, []int{18}
|
||||
}
|
||||
func (m *ImportRoaringRequest) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
|
@ -1205,6 +1315,8 @@ func init() {
|
|||
proto.RegisterType((*QueryResult)(nil), "internal.QueryResult")
|
||||
proto.RegisterType((*ImportRequest)(nil), "internal.ImportRequest")
|
||||
proto.RegisterType((*ImportValueRequest)(nil), "internal.ImportValueRequest")
|
||||
proto.RegisterType((*TranslateKeysRequest)(nil), "internal.TranslateKeysRequest")
|
||||
proto.RegisterType((*TranslateKeysResponse)(nil), "internal.TranslateKeysResponse")
|
||||
proto.RegisterType((*ImportRoaringRequestView)(nil), "internal.ImportRoaringRequestView")
|
||||
proto.RegisterType((*ImportRoaringRequest)(nil), "internal.ImportRoaringRequest")
|
||||
}
|
||||
|
|
@ -2091,6 +2203,92 @@ func (m *ImportValueRequest) MarshalTo(dAtA []byte) (int, error) {
|
|||
return i, nil
|
||||
}
|
||||
|
||||
func (m *TranslateKeysRequest) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalTo(dAtA)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *TranslateKeysRequest) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Index) > 0 {
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintPublic(dAtA, i, uint64(len(m.Index)))
|
||||
i += copy(dAtA[i:], m.Index)
|
||||
}
|
||||
if len(m.Field) > 0 {
|
||||
dAtA[i] = 0x12
|
||||
i++
|
||||
i = encodeVarintPublic(dAtA, i, uint64(len(m.Field)))
|
||||
i += copy(dAtA[i:], m.Field)
|
||||
}
|
||||
if len(m.Keys) > 0 {
|
||||
for _, s := range m.Keys {
|
||||
dAtA[i] = 0x1a
|
||||
i++
|
||||
l = len(s)
|
||||
for l >= 1<<7 {
|
||||
dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
|
||||
l >>= 7
|
||||
i++
|
||||
}
|
||||
dAtA[i] = uint8(l)
|
||||
i++
|
||||
i += copy(dAtA[i:], s)
|
||||
}
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
i += copy(dAtA[i:], m.XXX_unrecognized)
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func (m *TranslateKeysResponse) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalTo(dAtA)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *TranslateKeysResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.IDs) > 0 {
|
||||
dAtA23 := make([]byte, len(m.IDs)*10)
|
||||
var j22 int
|
||||
for _, num := range m.IDs {
|
||||
for num >= 1<<7 {
|
||||
dAtA23[j22] = uint8(uint64(num)&0x7f | 0x80)
|
||||
num >>= 7
|
||||
j22++
|
||||
}
|
||||
dAtA23[j22] = uint8(num)
|
||||
j22++
|
||||
}
|
||||
dAtA[i] = 0x1a
|
||||
i++
|
||||
i = encodeVarintPublic(dAtA, i, uint64(j22))
|
||||
i += copy(dAtA[i:], dAtA23[:j22])
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
i += copy(dAtA[i:], m.XXX_unrecognized)
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func (m *ImportRoaringRequestView) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
|
|
@ -2622,6 +2820,51 @@ func (m *ImportValueRequest) Size() (n int) {
|
|||
return n
|
||||
}
|
||||
|
||||
func (m *TranslateKeysRequest) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.Index)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovPublic(uint64(l))
|
||||
}
|
||||
l = len(m.Field)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovPublic(uint64(l))
|
||||
}
|
||||
if len(m.Keys) > 0 {
|
||||
for _, s := range m.Keys {
|
||||
l = len(s)
|
||||
n += 1 + l + sovPublic(uint64(l))
|
||||
}
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
n += len(m.XXX_unrecognized)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *TranslateKeysResponse) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.IDs) > 0 {
|
||||
l = 0
|
||||
for _, e := range m.IDs {
|
||||
l += sovPublic(uint64(e))
|
||||
}
|
||||
n += 1 + sovPublic(uint64(l)) + l
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
n += len(m.XXX_unrecognized)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *ImportRoaringRequestView) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
|
|
@ -5344,6 +5587,268 @@ func (m *ImportValueRequest) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
func (m *TranslateKeysRequest) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowPublic
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: TranslateKeysRequest: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: TranslateKeysRequest: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowPublic
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthPublic
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Index = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Field", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowPublic
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthPublic
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Field = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Keys", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowPublic
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthPublic
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Keys = append(m.Keys, string(dAtA[iNdEx:postIndex]))
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipPublic(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthPublic
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *TranslateKeysResponse) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowPublic
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: TranslateKeysResponse: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: TranslateKeysResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 3:
|
||||
if wireType == 0 {
|
||||
var v uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowPublic
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
v |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
m.IDs = append(m.IDs, v)
|
||||
} else if wireType == 2 {
|
||||
var packedLen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowPublic
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
packedLen |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if packedLen < 0 {
|
||||
return ErrInvalidLengthPublic
|
||||
}
|
||||
postIndex := iNdEx + packedLen
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
var elementCount int
|
||||
var count int
|
||||
for _, integer := range dAtA {
|
||||
if integer < 128 {
|
||||
count++
|
||||
}
|
||||
}
|
||||
elementCount = count
|
||||
if elementCount != 0 && len(m.IDs) == 0 {
|
||||
m.IDs = make([]uint64, 0, elementCount)
|
||||
}
|
||||
for iNdEx < postIndex {
|
||||
var v uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowPublic
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
v |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
m.IDs = append(m.IDs, v)
|
||||
}
|
||||
} else {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field IDs", wireType)
|
||||
}
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipPublic(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthPublic
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *ImportRoaringRequestView) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
|
|
@ -5662,63 +6167,65 @@ var (
|
|||
ErrIntOverflowPublic = fmt.Errorf("proto: integer overflow")
|
||||
)
|
||||
|
||||
func init() { proto.RegisterFile("public.proto", fileDescriptor_public_5eafd62083455670) }
|
||||
func init() { proto.RegisterFile("public.proto", fileDescriptor_public_7d901ba8e84abe50) }
|
||||
|
||||
var fileDescriptor_public_5eafd62083455670 = []byte{
|
||||
// 870 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xdd, 0x8e, 0xdb, 0x44,
|
||||
0x14, 0x66, 0x62, 0x27, 0x71, 0x4e, 0x36, 0xa1, 0x1a, 0x2d, 0xc5, 0x42, 0x55, 0xb0, 0x2c, 0x84,
|
||||
0x7c, 0xb5, 0x95, 0x82, 0x54, 0xf5, 0x8a, 0x9f, 0x6d, 0xb6, 0x28, 0x2a, 0xac, 0xe0, 0x6c, 0x09,
|
||||
0xe2, 0xd2, 0x6d, 0xa6, 0xad, 0x25, 0xc7, 0x63, 0xec, 0x31, 0x69, 0x9e, 0x83, 0x1b, 0x1e, 0x81,
|
||||
0x0b, 0x1e, 0xa4, 0x97, 0x88, 0x27, 0x80, 0xe5, 0x45, 0xd0, 0x9c, 0xf1, 0x64, 0x9c, 0x6c, 0x59,
|
||||
0x71, 0xc1, 0xdd, 0x7c, 0xe7, 0xcc, 0x39, 0xfe, 0xbe, 0x39, 0x3f, 0x09, 0x9c, 0x94, 0xcd, 0xb3,
|
||||
0x3c, 0x7b, 0x7e, 0x56, 0x56, 0x52, 0x49, 0x1e, 0x64, 0x85, 0x12, 0x55, 0x91, 0xe6, 0xf1, 0x0f,
|
||||
0xe0, 0xa1, 0xdc, 0xf2, 0x10, 0x86, 0x8f, 0x64, 0xde, 0x6c, 0x8a, 0x3a, 0x64, 0x91, 0x97, 0xf8,
|
||||
0x68, 0x21, 0xff, 0x08, 0xfa, 0x5f, 0x28, 0x55, 0xd5, 0x61, 0x2f, 0xf2, 0x92, 0xf1, 0x7c, 0x7a,
|
||||
0x66, 0x43, 0xcf, 0xb4, 0x19, 0x8d, 0x93, 0x73, 0xf0, 0x9f, 0x88, 0x5d, 0x1d, 0x7a, 0x91, 0x97,
|
||||
0x8c, 0x90, 0xce, 0xf1, 0x43, 0x98, 0xa2, 0xdc, 0x2e, 0xd7, 0xa2, 0x50, 0xd9, 0x8b, 0x4c, 0x98,
|
||||
0x5b, 0x28, 0xb7, 0xf6, 0x13, 0x74, 0xde, 0x47, 0xf6, 0x3a, 0x91, 0x9f, 0x82, 0xff, 0x4d, 0x9a,
|
||||
0x55, 0x7c, 0x0a, 0xbd, 0xe5, 0x22, 0x64, 0x11, 0x4b, 0x7c, 0xec, 0x2d, 0x17, 0xfc, 0x14, 0xfa,
|
||||
0x8f, 0x64, 0x53, 0xa8, 0xb0, 0x47, 0x26, 0x03, 0xf8, 0x1d, 0xf0, 0x9e, 0x88, 0x5d, 0xe8, 0x45,
|
||||
0x2c, 0x19, 0xa1, 0x3e, 0xc6, 0x0f, 0x20, 0x78, 0x9c, 0x89, 0x7c, 0xad, 0x95, 0x9d, 0x42, 0x9f,
|
||||
0xce, 0x94, 0x66, 0x84, 0x06, 0x68, 0xab, 0xe6, 0xb6, 0xb0, 0x99, 0x08, 0xc4, 0x5f, 0x01, 0x7c,
|
||||
0x59, 0xc9, 0xa6, 0x34, 0x79, 0x13, 0xe8, 0x13, 0x22, 0xba, 0xe3, 0x39, 0x77, 0xca, 0x6d, 0x72,
|
||||
0x34, 0x17, 0xde, 0xce, 0x2b, 0x9e, 0x43, 0xb0, 0x4a, 0xf3, 0x3d, 0xc7, 0x55, 0x9a, 0x13, 0x07,
|
||||
0x0f, 0xf5, 0xf1, 0x30, 0xc6, 0xb3, 0x31, 0xdf, 0x81, 0x77, 0x9e, 0x29, 0x47, 0x8f, 0x75, 0xe8,
|
||||
0xf1, 0x0f, 0x20, 0x30, 0x55, 0xd9, 0xf3, 0xde, 0x63, 0x7e, 0x0f, 0x46, 0x4f, 0xb3, 0x8d, 0xa8,
|
||||
0x55, 0xba, 0x29, 0xe9, 0x29, 0x3c, 0x74, 0x86, 0xf8, 0x7b, 0x98, 0x98, 0x9b, 0xba, 0x5a, 0x57,
|
||||
0x42, 0xdd, 0x78, 0xd9, 0xff, 0x56, 0xe5, 0x9b, 0x2f, 0xfd, 0x2b, 0x03, 0x5f, 0xfb, 0xac, 0x8b,
|
||||
0xed, 0x5d, 0xba, 0xb0, 0x4f, 0x77, 0xa5, 0x68, 0x99, 0xd2, 0x99, 0x47, 0x30, 0xbe, 0x52, 0x55,
|
||||
0x56, 0xbc, 0x5c, 0xa5, 0x79, 0x23, 0xda, 0x44, 0x5d, 0x93, 0xd6, 0xb8, 0x2c, 0x94, 0x71, 0xfb,
|
||||
0x24, 0x63, 0x8f, 0xb5, 0xc6, 0x73, 0x29, 0x73, 0xe3, 0xec, 0x47, 0x2c, 0x09, 0xd0, 0x19, 0xf8,
|
||||
0x0c, 0xe0, 0x71, 0x2e, 0xd3, 0x36, 0x76, 0x10, 0xb1, 0x84, 0x61, 0xc7, 0x12, 0xdf, 0x87, 0xa1,
|
||||
0x66, 0xfa, 0x75, 0x5a, 0x3a, 0xb5, 0xec, 0x16, 0xb5, 0xf1, 0x1b, 0x06, 0x27, 0xdf, 0x36, 0xa2,
|
||||
0xda, 0xa1, 0xf8, 0xb1, 0x11, 0x35, 0x55, 0x85, 0xb0, 0x6d, 0x25, 0x02, 0xfc, 0x2e, 0x0c, 0xae,
|
||||
0x5e, 0xa5, 0xd5, 0xda, 0xbc, 0x9d, 0x8f, 0x2d, 0xd2, 0x5a, 0xdd, 0x9b, 0xd7, 0xa4, 0x35, 0xc0,
|
||||
0xae, 0x49, 0x47, 0xa2, 0xd8, 0x48, 0x65, 0xc5, 0xb4, 0x88, 0x27, 0xf0, 0xee, 0xc5, 0xeb, 0xe7,
|
||||
0x79, 0xb3, 0x16, 0x28, 0xb7, 0x26, 0x7a, 0x40, 0x17, 0x8e, 0xcd, 0xfc, 0x63,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xf1, 0xe8, 0x7e, 0xfc, 0x17, 0x83,
|
||||
0xc9, 0x72, 0x53, 0xca, 0x4a, 0x75, 0xda, 0x76, 0x59, 0xac, 0xc5, 0x6b, 0xdb, 0xb6, 0x04, 0xdc,
|
||||
0x5e, 0xec, 0x1d, 0xed, 0x45, 0x6a, 0x5f, 0x6a, 0x57, 0x1f, 0x0d, 0xe8, 0xa8, 0xf4, 0x0f, 0x54,
|
||||
0xde, 0x83, 0x91, 0x5d, 0x40, 0x75, 0xd8, 0x27, 0x97, 0x33, 0xe8, 0x81, 0xdc, 0x6f, 0x20, 0xdd,
|
||||
0xc1, 0x5e, 0xe2, 0x61, 0xc7, 0xa2, 0x2b, 0x83, 0x72, 0x4b, 0xcb, 0x7f, 0x48, 0xcb, 0xdf, 0x42,
|
||||
0x1d, 0x69, 0xd2, 0x90, 0x33, 0x20, 0x67, 0xc7, 0x12, 0xff, 0xc6, 0x80, 0x1b, 0x8d, 0x34, 0xda,
|
||||
0xff, 0x9f, 0xd0, 0xdb, 0x05, 0xdd, 0x85, 0x01, 0x7d, 0xcf, 0x8a, 0x69, 0xd1, 0x11, 0xdd, 0xe1,
|
||||
0x0d, 0xba, 0xe7, 0x10, 0xb6, 0x15, 0x91, 0xa9, 0xde, 0x74, 0x2d, 0xdf, 0x55, 0x26, 0xb6, 0xba,
|
||||
0xa9, 0x2e, 0xd3, 0x8d, 0x68, 0x29, 0xd3, 0x59, 0xdb, 0x16, 0xa9, 0x4a, 0x89, 0xf0, 0x09, 0xd2,
|
||||
0x39, 0x7e, 0x01, 0xa7, 0x6f, 0xcb, 0x41, 0x3f, 0x23, 0xb9, 0x48, 0xcd, 0x24, 0x07, 0x68, 0x00,
|
||||
0x7f, 0x08, 0xfd, 0x9f, 0x32, 0xb1, 0xb5, 0x93, 0x1c, 0xbb, 0xee, 0xf9, 0x37, 0x22, 0x68, 0x02,
|
||||
0xce, 0xef, 0xbc, 0xb9, 0x9e, 0xb1, 0xdf, 0xaf, 0x67, 0xec, 0xcf, 0xeb, 0x19, 0xfb, 0xe5, 0xef,
|
||||
0xd9, 0x3b, 0xcf, 0x06, 0xf4, 0x97, 0xe1, 0x93, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x38, 0x60,
|
||||
0x42, 0x9e, 0x42, 0x08, 0x00, 0x00,
|
||||
var fileDescriptor_public_7d901ba8e84abe50 = []byte{
|
||||
// 902 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xdf, 0x8e, 0xdb, 0xc4,
|
||||
0x17, 0xfe, 0x4d, 0xec, 0x24, 0xce, 0xc9, 0x26, 0xbf, 0x6a, 0x94, 0x16, 0x0b, 0x55, 0x21, 0xb2,
|
||||
0x10, 0x32, 0x37, 0x5b, 0x29, 0x48, 0x55, 0xaf, 0xf8, 0xb3, 0xdd, 0x2d, 0x8a, 0x0a, 0x2b, 0x98,
|
||||
0x5d, 0x82, 0xb8, 0x9c, 0x36, 0xd3, 0xd6, 0x92, 0xe3, 0x09, 0xf6, 0x98, 0x74, 0x9f, 0x83, 0x1b,
|
||||
0x1e, 0x81, 0x0b, 0x1e, 0xa4, 0x97, 0x88, 0x27, 0x80, 0xe5, 0x45, 0xd0, 0x39, 0xe3, 0xc9, 0x38,
|
||||
0xd9, 0xa5, 0x42, 0x88, 0xbb, 0xf9, 0xce, 0x99, 0x73, 0xfc, 0x7d, 0x73, 0xfe, 0x24, 0x70, 0xb4,
|
||||
0xa9, 0x9f, 0xe5, 0xd9, 0xf3, 0xe3, 0x4d, 0xa9, 0x8d, 0xe6, 0x51, 0x56, 0x18, 0x55, 0x16, 0x32,
|
||||
0x4f, 0xbe, 0x83, 0x40, 0xe8, 0x2d, 0x8f, 0xa1, 0xff, 0x58, 0xe7, 0xf5, 0xba, 0xa8, 0x62, 0x36,
|
||||
0x0b, 0xd2, 0x50, 0x38, 0xc8, 0xdf, 0x87, 0xee, 0x67, 0xc6, 0x94, 0x55, 0xdc, 0x99, 0x05, 0xe9,
|
||||
0x70, 0x3e, 0x3e, 0x76, 0xa1, 0xc7, 0x68, 0x16, 0xd6, 0xc9, 0x39, 0x84, 0x4f, 0xd5, 0x55, 0x15,
|
||||
0x07, 0xb3, 0x20, 0x1d, 0x08, 0x3a, 0x27, 0x8f, 0x60, 0x2c, 0xf4, 0x76, 0xb1, 0x52, 0x85, 0xc9,
|
||||
0x5e, 0x64, 0xca, 0xde, 0x12, 0x7a, 0xeb, 0x3e, 0x41, 0xe7, 0x5d, 0x64, 0xa7, 0x15, 0xf9, 0x31,
|
||||
0x84, 0x5f, 0xc9, 0xac, 0xe4, 0x63, 0xe8, 0x2c, 0x4e, 0x63, 0x36, 0x63, 0x69, 0x28, 0x3a, 0x8b,
|
||||
0x53, 0x3e, 0x81, 0xee, 0x63, 0x5d, 0x17, 0x26, 0xee, 0x90, 0xc9, 0x02, 0x7e, 0x07, 0x82, 0xa7,
|
||||
0xea, 0x2a, 0x0e, 0x66, 0x2c, 0x1d, 0x08, 0x3c, 0x26, 0x0f, 0x21, 0x7a, 0x92, 0xa9, 0x7c, 0x85,
|
||||
0xca, 0x26, 0xd0, 0xa5, 0x33, 0xa5, 0x19, 0x08, 0x0b, 0xd0, 0x8a, 0xdc, 0x4e, 0x5d, 0x26, 0x02,
|
||||
0xc9, 0x17, 0x00, 0x9f, 0x97, 0xba, 0xde, 0xd8, 0xbc, 0x29, 0x74, 0x09, 0x11, 0xdd, 0xe1, 0x9c,
|
||||
0x7b, 0xe5, 0x2e, 0xb9, 0xb0, 0x17, 0x6e, 0xe7, 0x95, 0xcc, 0x21, 0x5a, 0xca, 0x7c, 0xc7, 0x71,
|
||||
0x29, 0x73, 0xe2, 0x10, 0x08, 0x3c, 0xee, 0xc7, 0x04, 0x2e, 0xe6, 0x1b, 0x08, 0x4e, 0x32, 0xe3,
|
||||
0xe9, 0xb1, 0x16, 0x3d, 0xfe, 0x2e, 0x44, 0xb6, 0x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xe1, 0xce, 0x8c, 0x07, 0xc4, 0x2c, 0xde, 0x7b, 0x8d, 0x96, 0x5f, 0x1c, 0xdc,
|
||||
0x4f, 0xfe, 0x60, 0x30, 0x5a, 0xac, 0x37, 0xba, 0x34, 0xad, 0xb6, 0x5d, 0x14, 0x2b, 0xf5, 0xda,
|
||||
0xb5, 0x2d, 0x01, 0xbf, 0x17, 0x3b, 0x07, 0x7b, 0x91, 0xda, 0x97, 0xda, 0x35, 0x14, 0x16, 0xb4,
|
||||
0x54, 0x86, 0x7b, 0x2a, 0xef, 0xc3, 0xc0, 0x2d, 0xa0, 0x2a, 0xee, 0x92, 0xcb, 0x1b, 0x70, 0x20,
|
||||
0x77, 0x1b, 0x08, 0x3b, 0x38, 0x48, 0x03, 0xd1, 0xb2, 0x60, 0x65, 0x84, 0xde, 0xd2, 0xf2, 0xef,
|
||||
0xd3, 0xf2, 0x77, 0x10, 0x23, 0x6d, 0x1a, 0x72, 0x46, 0xe4, 0x6c, 0x59, 0x92, 0x5f, 0x18, 0x70,
|
||||
0xab, 0x91, 0x46, 0xfb, 0xbf, 0x13, 0xfa, 0x76, 0x41, 0xf7, 0xa0, 0x47, 0xdf, 0x73, 0x62, 0x1a,
|
||||
0x74, 0x40, 0xb7, 0x7f, 0x83, 0xee, 0x12, 0x26, 0x97, 0xa5, 0x2c, 0xaa, 0x5c, 0x1a, 0x85, 0x86,
|
||||
0x7f, 0xc3, 0xf7, 0xb6, 0x1f, 0xd8, 0x0f, 0xe1, 0xee, 0x41, 0x5e, 0x3f, 0xdc, 0x28, 0x20, 0x20,
|
||||
0x01, 0x78, 0x4c, 0x4e, 0x20, 0x6e, 0x9a, 0x42, 0x4b, 0x5c, 0xb6, 0x0d, 0x85, 0x65, 0xa6, 0xb6,
|
||||
0x98, 0xfa, 0x5c, 0xae, 0x55, 0xc3, 0x82, 0xce, 0x68, 0x3b, 0x95, 0x46, 0x12, 0x87, 0x23, 0x41,
|
||||
0xe7, 0xe4, 0x05, 0x4c, 0x6e, 0xcb, 0x41, 0xbf, 0x64, 0xb9, 0x92, 0x76, 0x99, 0x44, 0xc2, 0x02,
|
||||
0xfe, 0x08, 0xba, 0x3f, 0x64, 0x6a, 0xeb, 0x96, 0x49, 0xe2, 0x1b, 0xf8, 0xef, 0x88, 0x08, 0x1b,
|
||||
0x70, 0x72, 0xe7, 0xcd, 0xf5, 0x94, 0xfd, 0x7a, 0x3d, 0x65, 0xbf, 0x5f, 0x4f, 0xd9, 0x4f, 0x7f,
|
||||
0x4e, 0xff, 0xf7, 0xac, 0x47, 0xff, 0x5a, 0x3e, 0xfa, 0x2b, 0x00, 0x00, 0xff, 0xff, 0xe8, 0x8e,
|
||||
0x85, 0x07, 0xc5, 0x08, 0x00, 0x00,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,6 +106,16 @@ message ImportValueRequest {
|
|||
repeated int64 Values = 6;
|
||||
}
|
||||
|
||||
message TranslateKeysRequest {
|
||||
string Index = 1;
|
||||
string Field = 2;
|
||||
repeated string Keys = 3;
|
||||
}
|
||||
|
||||
message TranslateKeysResponse {
|
||||
repeated uint64 IDs = 3;
|
||||
}
|
||||
|
||||
message ImportRoaringRequestView {
|
||||
string Name = 1;
|
||||
bytes Data = 2;
|
||||
|
|
|
|||
|
|
@ -713,6 +713,91 @@ func TestHandler_Endpoints(t *testing.T) {
|
|||
t.Fatalf("unexpected body: %q", w.Body.String())
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("translate keys", func(t *testing.T) {
|
||||
// create index
|
||||
w := httptest.NewRecorder()
|
||||
r := test.MustNewHTTPRequest("POST", "/index/i1-tr", strings.NewReader(`{"options":{"keys":true}}`))
|
||||
h.ServeHTTP(w, r)
|
||||
if w.Code != gohttp.StatusOK {
|
||||
t.Fatalf("unexpected status code: %d", w.Code)
|
||||
} else if w.Body.String() != `{"success":true}`+"\n" {
|
||||
t.Fatalf("unexpected body: %q", w.Body.String())
|
||||
}
|
||||
|
||||
// create field
|
||||
w = httptest.NewRecorder()
|
||||
r = test.MustNewHTTPRequest("POST", "/index/i1-tr/field/f1", strings.NewReader(`{"options":{"keys":true}}`))
|
||||
h.ServeHTTP(w, r)
|
||||
if w.Code != gohttp.StatusOK {
|
||||
t.Fatalf("unexpected status code: %d", w.Code)
|
||||
} else if w.Body.String() != `{"success":true}`+"\n" {
|
||||
t.Fatalf("unexpected body: %q", w.Body.String())
|
||||
}
|
||||
|
||||
// set some bits
|
||||
w = httptest.NewRecorder()
|
||||
r = test.MustNewHTTPRequest("POST", "/index/i1-tr/query", strings.NewReader(`Set("col1", f1="row1")`))
|
||||
h.ServeHTTP(w, r)
|
||||
if w.Code != gohttp.StatusOK {
|
||||
t.Fatalf("unexpected status code: %d", w.Code)
|
||||
}
|
||||
|
||||
// Generate request body for translate column keys request
|
||||
reqBody, err := cmd.API.Serializer.Marshal(&pilosa.TranslateKeysRequest{
|
||||
Index: "i1-tr",
|
||||
Keys: []string{"col1", "col2", "col3"},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// Generate protobuf request.
|
||||
w = httptest.NewRecorder()
|
||||
r = test.MustNewHTTPRequest("POST", "/internal/translate/keys", bytes.NewReader(reqBody))
|
||||
r.Header.Set("Content-Type", "application/x-protobuf")
|
||||
r.Header.Set("Accept", "application/x-protobuf")
|
||||
h.ServeHTTP(w, r)
|
||||
if w.Code != gohttp.StatusOK {
|
||||
t.Fatalf("unexpected status code: %d", w.Code)
|
||||
}
|
||||
target := []uint64{1, 2, 3}
|
||||
resp := pilosa.TranslateKeysResponse{}
|
||||
err = cmd.API.Serializer.Unmarshal(w.Body.Bytes(), &resp)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !reflect.DeepEqual(target, resp.IDs) {
|
||||
t.Fatalf("%v != %v", target, resp.IDs)
|
||||
}
|
||||
|
||||
// Generate request body for translate row keys request
|
||||
reqBody, err = cmd.API.Serializer.Marshal(&pilosa.TranslateKeysRequest{
|
||||
Index: "i1-tr",
|
||||
Field: "f1",
|
||||
Keys: []string{"row1", "row2"},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// Generate protobuf request.
|
||||
w = httptest.NewRecorder()
|
||||
r = test.MustNewHTTPRequest("POST", "/internal/translate/keys", bytes.NewReader(reqBody))
|
||||
r.Header.Set("Content-Type", "application/x-protobuf")
|
||||
r.Header.Set("Accept", "application/x-protobuf")
|
||||
h.ServeHTTP(w, r)
|
||||
if w.Code != gohttp.StatusOK {
|
||||
t.Fatalf("unexpected status code: %d", w.Code)
|
||||
}
|
||||
target = []uint64{1, 2}
|
||||
resp = pilosa.TranslateKeysResponse{}
|
||||
err = cmd.API.Serializer.Unmarshal(w.Body.Bytes(), &resp)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !reflect.DeepEqual(target, resp.IDs) {
|
||||
t.Fatalf("%v != %v", target, resp.IDs)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestClusterTranslator(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue