From 9612f1e7a87c1b4b539e1ebb6c658ac913b75958 Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Fri, 4 Jun 2021 09:18:27 +0100 Subject: [PATCH] remove the datastore --- datastore/.gitignore | 2 - datastore/Dockerfile | 3 - datastore/Makefile | 27 - datastore/README.md | 6 - datastore/generate.go | 3 - datastore/handler/datastore.go | 140 ---- datastore/main.go | 25 - datastore/micro.mu | 1 - datastore/proto/datastore.pb.go | 1111 ------------------------- datastore/proto/datastore.pb.micro.go | 161 ---- datastore/proto/datastore.proto | 112 --- datastore/publicapi.json | 12 - 12 files changed, 1603 deletions(-) delete mode 100644 datastore/.gitignore delete mode 100644 datastore/Dockerfile delete mode 100644 datastore/Makefile delete mode 100644 datastore/README.md delete mode 100644 datastore/generate.go delete mode 100644 datastore/handler/datastore.go delete mode 100644 datastore/main.go delete mode 100644 datastore/micro.mu delete mode 100644 datastore/proto/datastore.pb.go delete mode 100644 datastore/proto/datastore.pb.micro.go delete mode 100644 datastore/proto/datastore.proto delete mode 100644 datastore/publicapi.json diff --git a/datastore/.gitignore b/datastore/.gitignore deleted file mode 100644 index 1001c0a..0000000 --- a/datastore/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ - -datastore diff --git a/datastore/Dockerfile b/datastore/Dockerfile deleted file mode 100644 index 89fe95f..0000000 --- a/datastore/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM alpine -ADD datastore /datastore -ENTRYPOINT [ "/datastore" ] diff --git a/datastore/Makefile b/datastore/Makefile deleted file mode 100644 index 422cee1..0000000 --- a/datastore/Makefile +++ /dev/null @@ -1,27 +0,0 @@ - -GOPATH:=$(shell go env GOPATH) -.PHONY: init -init: - go get -u github.com/golang/protobuf/proto - go get -u github.com/golang/protobuf/protoc-gen-go - go get github.com/micro/micro/v3/cmd/protoc-gen-micro - go get github.com/micro/micro/v3/cmd/protoc-gen-openapi -.PHONY: proto -proto: - protoc --openapi_out=. --proto_path=. --micro_out=. --go_out=:. proto/datastore.proto - -.PHONY: api -api: - protoc --openapi_out=. --proto_path=. proto/datastore.proto - -.PHONY: build -build: - go build -o datastore *.go - -.PHONY: test -test: - go test -v ./... -cover - -.PHONY: docker -docker: - docker build . -t datastore:latest diff --git a/datastore/README.md b/datastore/README.md deleted file mode 100644 index 214352d..0000000 --- a/datastore/README.md +++ /dev/null @@ -1,6 +0,0 @@ -Document data storage - -# Datastore Service - -The Datastore service is a document store with a simplified query model for everyone. - diff --git a/datastore/generate.go b/datastore/generate.go deleted file mode 100644 index 7d9db91..0000000 --- a/datastore/generate.go +++ /dev/null @@ -1,3 +0,0 @@ -package main - -//go:generate make proto diff --git a/datastore/handler/datastore.go b/datastore/handler/datastore.go deleted file mode 100644 index 9d8183b..0000000 --- a/datastore/handler/datastore.go +++ /dev/null @@ -1,140 +0,0 @@ -package handler - -import ( - "context" - "encoding/json" - "strings" - - log "github.com/micro/micro/v3/service/logger" - "github.com/micro/micro/v3/service/model" - - datastore "github.com/micro/services/datastore/proto" -) - -var indexIndex = model.Index{ - FieldName: "TypeOf", -} - -type IndexRecord struct { - ID string - TypeOf string - Index model.Index -} - -type Datastore struct { -} - -func (e *Datastore) Create(ctx context.Context, req *datastore.CreateRequest, rsp *datastore.CreateResponse) error { - log.Info("Received Datastore.Create request") - m := map[string]interface{}{} - err := json.Unmarshal([]byte(req.Value), &m) - if err != nil { - return err - } - indexes, err := e.getIndexes(ctx) - if err != nil { - return err - } - db := model.New(map[string]interface{}{}, &model.Options{ - Indexes: indexes, - }) - return db.Context(ctx).Create(m) -} - -func (e *Datastore) Update(ctx context.Context, req *datastore.UpdateRequest, rsp *datastore.UpdateResponse) error { - log.Info("Received Datastore.Update request") - m := map[string]interface{}{} - err := json.Unmarshal([]byte(req.Value), &m) - if err != nil { - return err - } - indexes, err := e.getIndexes(ctx) - if err != nil { - return err - } - db := model.New(map[string]interface{}{}, &model.Options{ - Indexes: indexes, - }) - return db.Context(ctx).Update(m) -} - -func (e *Datastore) getIndexes(ctx context.Context) ([]model.Index, error) { - indexDb := model.New(map[string]interface{}{}, &model.Options{ - Indexes: []model.Index{indexIndex}, - }) - result := []IndexRecord{} - err := indexDb.Context(ctx).Read(model.QueryEquals("TypeOf", "_index"), &result) - if err != nil { - return nil, err - } - indexes := []model.Index{} - for _, v := range result { - indexes = append(indexes, v.Index) - } - return indexes, nil -} - -func (e *Datastore) Read(ctx context.Context, req *datastore.ReadRequest, rsp *datastore.ReadResponse) error { - log.Info("Received Datastore.Read request") - q := toQuery(req.Query) - result := []map[string]interface{}{} - indexes, err := e.getIndexes(ctx) - if err != nil { - return err - } - db := model.New(map[string]interface{}{}, &model.Options{ - Indexes: indexes, - }) - err = db.Context(ctx).Read(q, &result) - if err != nil { - return err - } - js, err := json.Marshal(result) - rsp.Value = string(js) - return err -} - -func (e *Datastore) CreateIndex(ctx context.Context, req *datastore.CreateIndexRequest, rsp *datastore.CreateIndexResponse) error { - log.Info("Received Datastore.Index request") - - index := toIndex(req.Index) - indexRecord := IndexRecord{ - ID: index.FieldName + index.Type + index.Order.FieldName + string(index.Order.Type), - Index: index, - TypeOf: "_index", - } - db := model.New(IndexRecord{}, &model.Options{ - Indexes: []model.Index{indexIndex}, - }) - return db.Context(ctx).Create(indexRecord) -} - -func (e *Datastore) Delete(ctx context.Context, req *datastore.DeleteRequest, rsp *datastore.DeleteResponse) error { - log.Info("Received Datastore.Delete request") - q := toQuery(req.Query) - return model.New(map[string]interface{}{}, nil).Context(ctx).Delete(q) -} - -func toQuery(pquery *datastore.Query) model.Query { - q := model.QueryEquals(pquery.Index.FieldName, pquery.Value) - if pquery.Order != nil { - q.Order.FieldName = pquery.Order.FieldName - q.Order.Type = model.OrderType(pquery.Order.OrderType.String()) - } - return q -} - -func toIndex(pindex *datastore.Index) model.Index { - i := model.Index{ - FieldName: pindex.FieldName, - Type: pindex.Type, - Unique: pindex.Unique, - } - if pindex.Order != nil { - i.Order = model.Order{ - FieldName: pindex.FieldName, - Type: model.OrderType(strings.ToLower(pindex.Order.OrderType.String())), - } - } - return i -} diff --git a/datastore/main.go b/datastore/main.go deleted file mode 100644 index 3918873..0000000 --- a/datastore/main.go +++ /dev/null @@ -1,25 +0,0 @@ -package main - -import ( - "github.com/micro/services/datastore/handler" - pb "github.com/micro/services/datastore/proto" - - "github.com/micro/micro/v3/service" - "github.com/micro/micro/v3/service/logger" -) - -func main() { - // Create service - srv := service.New( - service.Name("datastore"), - service.Version("latest"), - ) - - // Register handler - pb.RegisterDatastoreHandler(srv.Server(), new(handler.Datastore)) - - // Run service - if err := srv.Run(); err != nil { - logger.Fatal(err) - } -} diff --git a/datastore/micro.mu b/datastore/micro.mu deleted file mode 100644 index 7e81a1f..0000000 --- a/datastore/micro.mu +++ /dev/null @@ -1 +0,0 @@ -service datastore diff --git a/datastore/proto/datastore.pb.go b/datastore/proto/datastore.pb.go deleted file mode 100644 index 7380de2..0000000 --- a/datastore/proto/datastore.pb.go +++ /dev/null @@ -1,1111 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.25.0 -// protoc v3.15.5 -// source: proto/datastore.proto - -package datastore - -import ( - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Ordered or unordered keys. Ordered keys are padded. -// Default is true. This option only exists for strings, where ordering -// comes at the cost of having rather long padded keys. -type Order_OrderType int32 - -const ( - Order_UNORDERED Order_OrderType = 0 - Order_ASCENDING Order_OrderType = 1 - Order_DESCENDING Order_OrderType = 2 -) - -// Enum value maps for Order_OrderType. -var ( - Order_OrderType_name = map[int32]string{ - 0: "UNORDERED", - 1: "ASCENDING", - 2: "DESCENDING", - } - Order_OrderType_value = map[string]int32{ - "UNORDERED": 0, - "ASCENDING": 1, - "DESCENDING": 2, - } -) - -func (x Order_OrderType) Enum() *Order_OrderType { - p := new(Order_OrderType) - *p = x - return p -} - -func (x Order_OrderType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Order_OrderType) Descriptor() protoreflect.EnumDescriptor { - return file_proto_datastore_proto_enumTypes[0].Descriptor() -} - -func (Order_OrderType) Type() protoreflect.EnumType { - return &file_proto_datastore_proto_enumTypes[0] -} - -func (x Order_OrderType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use Order_OrderType.Descriptor instead. -func (Order_OrderType) EnumDescriptor() ([]byte, []int) { - return file_proto_datastore_proto_rawDescGZIP(), []int{1, 0} -} - -type Query struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Index *Index `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` - Order *Order `protobuf:"bytes,2,opt,name=order,proto3" json:"order,omitempty"` - Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` - Offset int64 `protobuf:"varint,4,opt,name=offset,proto3" json:"offset,omitempty"` - Limit int64 `protobuf:"varint,5,opt,name=limit,proto3" json:"limit,omitempty"` -} - -func (x *Query) Reset() { - *x = Query{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_datastore_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Query) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Query) ProtoMessage() {} - -func (x *Query) ProtoReflect() protoreflect.Message { - mi := &file_proto_datastore_proto_msgTypes[0] - 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 Query.ProtoReflect.Descriptor instead. -func (*Query) Descriptor() ([]byte, []int) { - return file_proto_datastore_proto_rawDescGZIP(), []int{0} -} - -func (x *Query) GetIndex() *Index { - if x != nil { - return x.Index - } - return nil -} - -func (x *Query) GetOrder() *Order { - if x != nil { - return x.Order - } - return nil -} - -func (x *Query) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -func (x *Query) GetOffset() int64 { - if x != nil { - return x.Offset - } - return 0 -} - -func (x *Query) GetLimit() int64 { - if x != nil { - return x.Limit - } - return 0 -} - -// Order is the order of the index -type Order struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Field to order on - // eg. age - FieldName string `protobuf:"bytes,1,opt,name=fieldName,proto3" json:"fieldName,omitempty"` - // Type of the ordering - // eg. ascending, descending, unordered - OrderType Order_OrderType `protobuf:"varint,2,opt,name=orderType,proto3,enum=datastore.Order_OrderType" json:"orderType,omitempty"` -} - -func (x *Order) Reset() { - *x = Order{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_datastore_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Order) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Order) ProtoMessage() {} - -func (x *Order) ProtoReflect() protoreflect.Message { - mi := &file_proto_datastore_proto_msgTypes[1] - 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 Order.ProtoReflect.Descriptor instead. -func (*Order) Descriptor() ([]byte, []int) { - return file_proto_datastore_proto_rawDescGZIP(), []int{1} -} - -func (x *Order) GetFieldName() string { - if x != nil { - return x.FieldName - } - return "" -} - -func (x *Order) GetOrderType() Order_OrderType { - if x != nil { - return x.OrderType - } - return Order_UNORDERED -} - -type Index struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Field to index on. - // eg. email - FieldName string `protobuf:"bytes,1,opt,name=fieldName,proto3" json:"fieldName,omitempty"` - // Type of index - // eg. eq - Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` - Order *Order `protobuf:"bytes,3,opt,name=order,proto3" json:"order,omitempty"` - // Do not allow duplicate values of this field in the index. - // Useful for emails, usernames, post slugs etc. - Unique bool `protobuf:"varint,4,opt,name=unique,proto3" json:"unique,omitempty"` - // Strings for ordering will be padded to a fix length - // Not a useful property for Querying, please ignore this at query time. - // Number is in bytes, not string characters. Choose a sufficiently big one. - // Consider that each character might take 4 bytes given the - // internals of reverse ordering. So a good rule of thumbs is expected - // characters in a string X 4 - StringOrderPadLength int64 `protobuf:"varint,5,opt,name=stringOrderPadLength,proto3" json:"stringOrderPadLength,omitempty"` - // True = base32 encode ordered strings for easier management - // or false = keep 4 bytes long runes that might dispaly weirdly - Base32Encode bool `protobuf:"varint,6,opt,name=Base32Encode,proto3" json:"Base32Encode,omitempty"` - FloatFormat string `protobuf:"bytes,7,opt,name=FloatFormat,proto3" json:"FloatFormat,omitempty"` - Float64Max float32 `protobuf:"fixed32,8,opt,name=Float64Max,proto3" json:"Float64Max,omitempty"` - Float32Max float32 `protobuf:"fixed32,9,opt,name=Float32Max,proto3" json:"Float32Max,omitempty"` -} - -func (x *Index) Reset() { - *x = Index{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_datastore_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Index) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Index) ProtoMessage() {} - -func (x *Index) ProtoReflect() protoreflect.Message { - mi := &file_proto_datastore_proto_msgTypes[2] - 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 Index.ProtoReflect.Descriptor instead. -func (*Index) Descriptor() ([]byte, []int) { - return file_proto_datastore_proto_rawDescGZIP(), []int{2} -} - -func (x *Index) GetFieldName() string { - if x != nil { - return x.FieldName - } - return "" -} - -func (x *Index) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *Index) GetOrder() *Order { - if x != nil { - return x.Order - } - return nil -} - -func (x *Index) GetUnique() bool { - if x != nil { - return x.Unique - } - return false -} - -func (x *Index) GetStringOrderPadLength() int64 { - if x != nil { - return x.StringOrderPadLength - } - return 0 -} - -func (x *Index) GetBase32Encode() bool { - if x != nil { - return x.Base32Encode - } - return false -} - -func (x *Index) GetFloatFormat() string { - if x != nil { - return x.FloatFormat - } - return "" -} - -func (x *Index) GetFloat64Max() float32 { - if x != nil { - return x.Float64Max - } - return 0 -} - -func (x *Index) GetFloat32Max() float32 { - if x != nil { - return x.Float32Max - } - return 0 -} - -type CreateRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // JSON marshalled record to save - Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *CreateRequest) Reset() { - *x = CreateRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_datastore_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CreateRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateRequest) ProtoMessage() {} - -func (x *CreateRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_datastore_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 CreateRequest.ProtoReflect.Descriptor instead. -func (*CreateRequest) Descriptor() ([]byte, []int) { - return file_proto_datastore_proto_rawDescGZIP(), []int{3} -} - -func (x *CreateRequest) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -type CreateResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *CreateResponse) Reset() { - *x = CreateResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_datastore_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CreateResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateResponse) ProtoMessage() {} - -func (x *CreateResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_datastore_proto_msgTypes[4] - 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 CreateResponse.ProtoReflect.Descriptor instead. -func (*CreateResponse) Descriptor() ([]byte, []int) { - return file_proto_datastore_proto_rawDescGZIP(), []int{4} -} - -type UpdateRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // JSON marshalled record to save - Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *UpdateRequest) Reset() { - *x = UpdateRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_datastore_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateRequest) ProtoMessage() {} - -func (x *UpdateRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_datastore_proto_msgTypes[5] - 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 UpdateRequest.ProtoReflect.Descriptor instead. -func (*UpdateRequest) Descriptor() ([]byte, []int) { - return file_proto_datastore_proto_rawDescGZIP(), []int{5} -} - -func (x *UpdateRequest) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -type UpdateResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *UpdateResponse) Reset() { - *x = UpdateResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_datastore_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateResponse) ProtoMessage() {} - -func (x *UpdateResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_datastore_proto_msgTypes[6] - 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 UpdateResponse.ProtoReflect.Descriptor instead. -func (*UpdateResponse) Descriptor() ([]byte, []int) { - return file_proto_datastore_proto_rawDescGZIP(), []int{6} -} - -type ReadRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Query *Query `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` -} - -func (x *ReadRequest) Reset() { - *x = ReadRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_datastore_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ReadRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ReadRequest) ProtoMessage() {} - -func (x *ReadRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_datastore_proto_msgTypes[7] - 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 ReadRequest.ProtoReflect.Descriptor instead. -func (*ReadRequest) Descriptor() ([]byte, []int) { - return file_proto_datastore_proto_rawDescGZIP(), []int{7} -} - -func (x *ReadRequest) GetQuery() *Query { - if x != nil { - return x.Query - } - return nil -} - -type ReadResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // JSON marshalled record found - Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *ReadResponse) Reset() { - *x = ReadResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_datastore_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ReadResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ReadResponse) ProtoMessage() {} - -func (x *ReadResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_datastore_proto_msgTypes[8] - 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 ReadResponse.ProtoReflect.Descriptor instead. -func (*ReadResponse) Descriptor() ([]byte, []int) { - return file_proto_datastore_proto_rawDescGZIP(), []int{8} -} - -func (x *ReadResponse) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -type DeleteRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Query *Query `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` -} - -func (x *DeleteRequest) Reset() { - *x = DeleteRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_datastore_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeleteRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteRequest) ProtoMessage() {} - -func (x *DeleteRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_datastore_proto_msgTypes[9] - 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 DeleteRequest.ProtoReflect.Descriptor instead. -func (*DeleteRequest) Descriptor() ([]byte, []int) { - return file_proto_datastore_proto_rawDescGZIP(), []int{9} -} - -func (x *DeleteRequest) GetQuery() *Query { - if x != nil { - return x.Query - } - return nil -} - -type DeleteResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *DeleteResponse) Reset() { - *x = DeleteResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_datastore_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeleteResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteResponse) ProtoMessage() {} - -func (x *DeleteResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_datastore_proto_msgTypes[10] - 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 DeleteResponse.ProtoReflect.Descriptor instead. -func (*DeleteResponse) Descriptor() ([]byte, []int) { - return file_proto_datastore_proto_rawDescGZIP(), []int{10} -} - -type CreateIndexRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Index *Index `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` -} - -func (x *CreateIndexRequest) Reset() { - *x = CreateIndexRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_datastore_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CreateIndexRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateIndexRequest) ProtoMessage() {} - -func (x *CreateIndexRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_datastore_proto_msgTypes[11] - 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 CreateIndexRequest.ProtoReflect.Descriptor instead. -func (*CreateIndexRequest) Descriptor() ([]byte, []int) { - return file_proto_datastore_proto_rawDescGZIP(), []int{11} -} - -func (x *CreateIndexRequest) GetIndex() *Index { - if x != nil { - return x.Index - } - return nil -} - -type CreateIndexResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *CreateIndexResponse) Reset() { - *x = CreateIndexResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_datastore_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CreateIndexResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateIndexResponse) ProtoMessage() {} - -func (x *CreateIndexResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_datastore_proto_msgTypes[12] - 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 CreateIndexResponse.ProtoReflect.Descriptor instead. -func (*CreateIndexResponse) Descriptor() ([]byte, []int) { - return file_proto_datastore_proto_rawDescGZIP(), []int{12} -} - -var File_proto_datastore_proto protoreflect.FileDescriptor - -var file_proto_datastore_proto_rawDesc = []byte{ - 0x0a, 0x15, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, - 0x72, 0x65, 0x22, 0x9b, 0x01, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x26, 0x0a, 0x05, - 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x64, 0x61, - 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x05, 0x69, - 0x6e, 0x64, 0x65, 0x78, 0x12, 0x26, 0x0a, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, - 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, - 0x6d, 0x69, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, - 0x22, 0x9a, 0x01, 0x0a, 0x05, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x66, 0x69, - 0x65, 0x6c, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, - 0x69, 0x65, 0x6c, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x38, 0x0a, 0x09, 0x6f, 0x72, 0x64, 0x65, - 0x72, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x64, 0x61, - 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x2e, 0x4f, 0x72, - 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x54, 0x79, - 0x70, 0x65, 0x22, 0x39, 0x0a, 0x09, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, - 0x0d, 0x0a, 0x09, 0x55, 0x4e, 0x4f, 0x52, 0x44, 0x45, 0x52, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0d, - 0x0a, 0x09, 0x41, 0x53, 0x43, 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0e, 0x0a, - 0x0a, 0x44, 0x45, 0x53, 0x43, 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x22, 0xb3, 0x02, - 0x0a, 0x05, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1c, 0x0a, 0x09, 0x66, 0x69, 0x65, 0x6c, 0x64, - 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, 0x69, 0x65, 0x6c, - 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x26, 0x0a, 0x05, 0x6f, 0x72, 0x64, - 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x73, - 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x05, 0x6f, 0x72, 0x64, 0x65, - 0x72, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x06, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x12, 0x32, 0x0a, 0x14, 0x73, 0x74, 0x72, - 0x69, 0x6e, 0x67, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x50, 0x61, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x14, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4f, - 0x72, 0x64, 0x65, 0x72, 0x50, 0x61, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x22, 0x0a, - 0x0c, 0x42, 0x61, 0x73, 0x65, 0x33, 0x32, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x0c, 0x42, 0x61, 0x73, 0x65, 0x33, 0x32, 0x45, 0x6e, 0x63, 0x6f, 0x64, - 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x46, 0x6f, 0x72, - 0x6d, 0x61, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x36, 0x34, 0x4d, 0x61, - 0x78, 0x18, 0x08, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0a, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x36, 0x34, - 0x4d, 0x61, 0x78, 0x12, 0x1e, 0x0a, 0x0a, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x32, 0x4d, 0x61, - 0x78, 0x18, 0x09, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0a, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x32, - 0x4d, 0x61, 0x78, 0x22, 0x25, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x10, 0x0a, 0x0e, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x25, 0x0a, 0x0d, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x22, 0x10, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x35, 0x0a, 0x0b, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, - 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x22, 0x24, 0x0a, 0x0c, - 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x22, 0x37, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x22, 0x10, 0x0a, 0x0e, 0x44, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3c, 0x0a, - 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x49, - 0x6e, 0x64, 0x65, 0x78, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x15, 0x0a, 0x13, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x32, 0xd9, 0x02, 0x0a, 0x09, 0x44, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, - 0x12, 0x3f, 0x0a, 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x18, 0x2e, 0x64, 0x61, 0x74, - 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, - 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x00, 0x12, 0x3f, 0x0a, 0x06, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x18, 0x2e, 0x64, 0x61, - 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, - 0x65, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x12, 0x39, 0x0a, 0x04, 0x52, 0x65, 0x61, 0x64, 0x12, 0x16, 0x2e, 0x64, 0x61, 0x74, - 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x52, - 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3f, 0x0a, - 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x18, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, - 0x6f, 0x72, 0x65, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x19, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4e, - 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1d, 0x2e, - 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x64, - 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x49, - 0x6e, 0x64, 0x65, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x11, - 0x5a, 0x0f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x6f, 0x72, - 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_proto_datastore_proto_rawDescOnce sync.Once - file_proto_datastore_proto_rawDescData = file_proto_datastore_proto_rawDesc -) - -func file_proto_datastore_proto_rawDescGZIP() []byte { - file_proto_datastore_proto_rawDescOnce.Do(func() { - file_proto_datastore_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_datastore_proto_rawDescData) - }) - return file_proto_datastore_proto_rawDescData -} - -var file_proto_datastore_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_proto_datastore_proto_msgTypes = make([]protoimpl.MessageInfo, 13) -var file_proto_datastore_proto_goTypes = []interface{}{ - (Order_OrderType)(0), // 0: datastore.Order.OrderType - (*Query)(nil), // 1: datastore.Query - (*Order)(nil), // 2: datastore.Order - (*Index)(nil), // 3: datastore.Index - (*CreateRequest)(nil), // 4: datastore.CreateRequest - (*CreateResponse)(nil), // 5: datastore.CreateResponse - (*UpdateRequest)(nil), // 6: datastore.UpdateRequest - (*UpdateResponse)(nil), // 7: datastore.UpdateResponse - (*ReadRequest)(nil), // 8: datastore.ReadRequest - (*ReadResponse)(nil), // 9: datastore.ReadResponse - (*DeleteRequest)(nil), // 10: datastore.DeleteRequest - (*DeleteResponse)(nil), // 11: datastore.DeleteResponse - (*CreateIndexRequest)(nil), // 12: datastore.CreateIndexRequest - (*CreateIndexResponse)(nil), // 13: datastore.CreateIndexResponse -} -var file_proto_datastore_proto_depIdxs = []int32{ - 3, // 0: datastore.Query.index:type_name -> datastore.Index - 2, // 1: datastore.Query.order:type_name -> datastore.Order - 0, // 2: datastore.Order.orderType:type_name -> datastore.Order.OrderType - 2, // 3: datastore.Index.order:type_name -> datastore.Order - 1, // 4: datastore.ReadRequest.query:type_name -> datastore.Query - 1, // 5: datastore.DeleteRequest.query:type_name -> datastore.Query - 3, // 6: datastore.CreateIndexRequest.index:type_name -> datastore.Index - 4, // 7: datastore.Datastore.Create:input_type -> datastore.CreateRequest - 6, // 8: datastore.Datastore.Update:input_type -> datastore.UpdateRequest - 8, // 9: datastore.Datastore.Read:input_type -> datastore.ReadRequest - 10, // 10: datastore.Datastore.Delete:input_type -> datastore.DeleteRequest - 12, // 11: datastore.Datastore.CreateIndex:input_type -> datastore.CreateIndexRequest - 5, // 12: datastore.Datastore.Create:output_type -> datastore.CreateResponse - 7, // 13: datastore.Datastore.Update:output_type -> datastore.UpdateResponse - 9, // 14: datastore.Datastore.Read:output_type -> datastore.ReadResponse - 11, // 15: datastore.Datastore.Delete:output_type -> datastore.DeleteResponse - 13, // 16: datastore.Datastore.CreateIndex:output_type -> datastore.CreateIndexResponse - 12, // [12:17] is the sub-list for method output_type - 7, // [7:12] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name -} - -func init() { file_proto_datastore_proto_init() } -func file_proto_datastore_proto_init() { - if File_proto_datastore_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_proto_datastore_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Query); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_datastore_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Order); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_datastore_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Index); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_datastore_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_datastore_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_datastore_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_datastore_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_datastore_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_datastore_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_datastore_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_datastore_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_datastore_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateIndexRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_datastore_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateIndexResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_proto_datastore_proto_rawDesc, - NumEnums: 1, - NumMessages: 13, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_proto_datastore_proto_goTypes, - DependencyIndexes: file_proto_datastore_proto_depIdxs, - EnumInfos: file_proto_datastore_proto_enumTypes, - MessageInfos: file_proto_datastore_proto_msgTypes, - }.Build() - File_proto_datastore_proto = out.File - file_proto_datastore_proto_rawDesc = nil - file_proto_datastore_proto_goTypes = nil - file_proto_datastore_proto_depIdxs = nil -} diff --git a/datastore/proto/datastore.pb.micro.go b/datastore/proto/datastore.pb.micro.go deleted file mode 100644 index 9f94d48..0000000 --- a/datastore/proto/datastore.pb.micro.go +++ /dev/null @@ -1,161 +0,0 @@ -// Code generated by protoc-gen-micro. DO NOT EDIT. -// source: proto/datastore.proto - -package datastore - -import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" -) - -import ( - context "context" - api "github.com/micro/micro/v3/service/api" - client "github.com/micro/micro/v3/service/client" - server "github.com/micro/micro/v3/service/server" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -// Reference imports to suppress errors if they are not otherwise used. -var _ api.Endpoint -var _ context.Context -var _ client.Option -var _ server.Option - -// Api Endpoints for Datastore service - -func NewDatastoreEndpoints() []*api.Endpoint { - return []*api.Endpoint{} -} - -// Client API for Datastore service - -type DatastoreService interface { - Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error) - Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error) - Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error) - Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error) - CreateIndex(ctx context.Context, in *CreateIndexRequest, opts ...client.CallOption) (*CreateIndexResponse, error) -} - -type datastoreService struct { - c client.Client - name string -} - -func NewDatastoreService(name string, c client.Client) DatastoreService { - return &datastoreService{ - c: c, - name: name, - } -} - -func (c *datastoreService) Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error) { - req := c.c.NewRequest(c.name, "Datastore.Create", in) - out := new(CreateResponse) - err := c.c.Call(ctx, req, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *datastoreService) Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error) { - req := c.c.NewRequest(c.name, "Datastore.Update", in) - out := new(UpdateResponse) - err := c.c.Call(ctx, req, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *datastoreService) Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error) { - req := c.c.NewRequest(c.name, "Datastore.Read", in) - out := new(ReadResponse) - err := c.c.Call(ctx, req, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *datastoreService) Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error) { - req := c.c.NewRequest(c.name, "Datastore.Delete", in) - out := new(DeleteResponse) - err := c.c.Call(ctx, req, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *datastoreService) CreateIndex(ctx context.Context, in *CreateIndexRequest, opts ...client.CallOption) (*CreateIndexResponse, error) { - req := c.c.NewRequest(c.name, "Datastore.CreateIndex", in) - out := new(CreateIndexResponse) - err := c.c.Call(ctx, req, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Server API for Datastore service - -type DatastoreHandler interface { - Create(context.Context, *CreateRequest, *CreateResponse) error - Update(context.Context, *UpdateRequest, *UpdateResponse) error - Read(context.Context, *ReadRequest, *ReadResponse) error - Delete(context.Context, *DeleteRequest, *DeleteResponse) error - CreateIndex(context.Context, *CreateIndexRequest, *CreateIndexResponse) error -} - -func RegisterDatastoreHandler(s server.Server, hdlr DatastoreHandler, opts ...server.HandlerOption) error { - type datastore interface { - Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error - Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error - Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error - Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error - CreateIndex(ctx context.Context, in *CreateIndexRequest, out *CreateIndexResponse) error - } - type Datastore struct { - datastore - } - h := &datastoreHandler{hdlr} - return s.Handle(s.NewHandler(&Datastore{h}, opts...)) -} - -type datastoreHandler struct { - DatastoreHandler -} - -func (h *datastoreHandler) Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error { - return h.DatastoreHandler.Create(ctx, in, out) -} - -func (h *datastoreHandler) Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error { - return h.DatastoreHandler.Update(ctx, in, out) -} - -func (h *datastoreHandler) Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error { - return h.DatastoreHandler.Read(ctx, in, out) -} - -func (h *datastoreHandler) Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error { - return h.DatastoreHandler.Delete(ctx, in, out) -} - -func (h *datastoreHandler) CreateIndex(ctx context.Context, in *CreateIndexRequest, out *CreateIndexResponse) error { - return h.DatastoreHandler.CreateIndex(ctx, in, out) -} diff --git a/datastore/proto/datastore.proto b/datastore/proto/datastore.proto deleted file mode 100644 index f1d79a2..0000000 --- a/datastore/proto/datastore.proto +++ /dev/null @@ -1,112 +0,0 @@ -syntax = "proto3"; - -package datastore; - -option go_package = "./proto;datastore"; - -// These endpoints are experimental and will likely change, -// especially related to indexes. -service Datastore { - rpc Create(CreateRequest) returns (CreateResponse) {} - rpc Update(UpdateRequest) returns (UpdateResponse) {} - rpc Read(ReadRequest) returns (ReadResponse) {} - rpc Delete(DeleteRequest) returns (DeleteResponse) {} - rpc CreateIndex(CreateIndexRequest) returns (CreateIndexResponse) {} -} - -message Query { - Index index = 1; - Order order = 2; - string value = 3; - int64 offset = 4; - int64 limit = 5; -} - -// Order is the order of the index -message Order { - // Field to order on - // eg. age - string fieldName = 1; - // Ordered or unordered keys. Ordered keys are padded. - // Default is true. This option only exists for strings, where ordering - // comes at the cost of having rather long padded keys. - enum OrderType { - UNORDERED = 0; - ASCENDING = 1; - DESCENDING = 2; - } - // Type of the ordering - // eg. ascending, descending, unordered - OrderType orderType = 2; -} - -message Index { - // Field to index on. - // eg. email - string fieldName = 1; - // Type of index - // eg. eq - string type = 2; - Order order = 3; - - // Do not allow duplicate values of this field in the index. - // Useful for emails, usernames, post slugs etc. - bool unique = 4; - - // Strings for ordering will be padded to a fix length - // Not a useful property for Querying, please ignore this at query time. - // Number is in bytes, not string characters. Choose a sufficiently big one. - // Consider that each character might take 4 bytes given the - // internals of reverse ordering. So a good rule of thumbs is expected - // characters in a string X 4 - int64 stringOrderPadLength = 5; - // True = base32 encode ordered strings for easier management - // or false = keep 4 bytes long runes that might dispaly weirdly - bool Base32Encode = 6; - - string FloatFormat = 7; - float Float64Max = 8; - float Float32Max = 9; -} - - -message CreateRequest { - // JSON marshalled record to save - string value = 1; -} - -message CreateResponse { -} - -message UpdateRequest { - // JSON marshalled record to save - string value = 1; -} - -message UpdateResponse { - -} - -message ReadRequest { - Query query = 1; -} - -message ReadResponse { - // JSON marshalled record found - string value = 1; -} - -message DeleteRequest { - Query query = 1; -} - -message DeleteResponse { -} - -message CreateIndexRequest { - Index index = 1; -} - -message CreateIndexResponse { - -} diff --git a/datastore/publicapi.json b/datastore/publicapi.json deleted file mode 100644 index 606c457..0000000 --- a/datastore/publicapi.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "datastore", - "icon": "📦", - "category": "storage", - "pricing": { - "Datastore.Create": 100, - "Datastore.Read": 100, - "Datastore.Update": 100, - "Datastore.Delete": 100, - "Datastore.CreateIndex": 100 - } -}