mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-14 16:52:58 +02:00
databroker: add support for querying the databroker (#1443)
* databroker: add support for querying the databroker * remove query method, use getall so encryption works * add test * return early
This commit is contained in:
parent
fdec45fe04
commit
2364da14c8
8 changed files with 534 additions and 118 deletions
|
@ -9,6 +9,7 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"reflect"
|
"reflect"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -220,6 +221,43 @@ func (srv *Server) GetAll(ctx context.Context, req *databroker.GetAllRequest) (*
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Query queries for records.
|
||||||
|
func (srv *Server) Query(ctx context.Context, req *databroker.QueryRequest) (*databroker.QueryResponse, error) {
|
||||||
|
_, span := trace.StartSpan(ctx, "databroker.grpc.Query")
|
||||||
|
defer span.End()
|
||||||
|
srv.log.Info().
|
||||||
|
Str("type", req.GetType()).
|
||||||
|
Str("query", req.GetQuery()).
|
||||||
|
Int64("offset", req.GetOffset()).
|
||||||
|
Int64("limit", req.GetLimit()).
|
||||||
|
Msg("query")
|
||||||
|
|
||||||
|
query := strings.ToLower(req.GetQuery())
|
||||||
|
|
||||||
|
db, _, err := srv.getDB(req.GetType(), true)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
all, err := db.GetAll(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var filtered []*databroker.Record
|
||||||
|
for _, record := range all {
|
||||||
|
if record.DeletedAt == nil && storage.MatchAny(record.GetData(), query) {
|
||||||
|
filtered = append(filtered, record)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
records, totalCount := databroker.ApplyOffsetAndLimit(filtered, int(req.GetOffset()), int(req.GetLimit()))
|
||||||
|
return &databroker.QueryResponse{
|
||||||
|
Records: records,
|
||||||
|
TotalCount: int64(totalCount),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
// Set updates a record in the in-memory list, or adds a new one.
|
// Set updates a record in the in-memory list, or adds a new one.
|
||||||
func (srv *Server) Set(ctx context.Context, req *databroker.SetRequest) (*databroker.SetResponse, error) {
|
func (srv *Server) Set(ctx context.Context, req *databroker.SetRequest) (*databroker.SetResponse, error) {
|
||||||
_, span := trace.StartSpan(ctx, "databroker.grpc.Set")
|
_, span := trace.StartSpan(ctx, "databroker.grpc.Set")
|
||||||
|
|
|
@ -5,3 +5,17 @@ package databroker
|
||||||
func GetUserID(provider, providerUserID string) string {
|
func GetUserID(provider, providerUserID string) string {
|
||||||
return provider + "/" + providerUserID
|
return provider + "/" + providerUserID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ApplyOffsetAndLimit applies the offset and limit to the list of records.
|
||||||
|
func ApplyOffsetAndLimit(all []*Record, offset, limit int) (records []*Record, totalCount int) {
|
||||||
|
records = all
|
||||||
|
if offset < len(records) {
|
||||||
|
records = records[offset:]
|
||||||
|
} else {
|
||||||
|
records = nil
|
||||||
|
}
|
||||||
|
if limit <= len(records) {
|
||||||
|
records = records[:limit]
|
||||||
|
}
|
||||||
|
return records, len(all)
|
||||||
|
}
|
||||||
|
|
|
@ -441,6 +441,132 @@ func (x *GetAllResponse) GetRecordVersion() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type QueryRequest struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
|
||||||
|
Query string `protobuf:"bytes,2,opt,name=query,proto3" json:"query,omitempty"`
|
||||||
|
Offset int64 `protobuf:"varint,3,opt,name=offset,proto3" json:"offset,omitempty"`
|
||||||
|
Limit int64 `protobuf:"varint,4,opt,name=limit,proto3" json:"limit,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *QueryRequest) Reset() {
|
||||||
|
*x = QueryRequest{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_databroker_proto_msgTypes[7]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *QueryRequest) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*QueryRequest) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *QueryRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_databroker_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 QueryRequest.ProtoReflect.Descriptor instead.
|
||||||
|
func (*QueryRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return file_databroker_proto_rawDescGZIP(), []int{7}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *QueryRequest) GetType() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Type
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *QueryRequest) GetQuery() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Query
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *QueryRequest) GetOffset() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Offset
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *QueryRequest) GetLimit() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Limit
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type QueryResponse struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Records []*Record `protobuf:"bytes,1,rep,name=records,proto3" json:"records,omitempty"`
|
||||||
|
TotalCount int64 `protobuf:"varint,2,opt,name=total_count,json=totalCount,proto3" json:"total_count,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *QueryResponse) Reset() {
|
||||||
|
*x = QueryResponse{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_databroker_proto_msgTypes[8]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *QueryResponse) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*QueryResponse) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *QueryResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_databroker_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 QueryResponse.ProtoReflect.Descriptor instead.
|
||||||
|
func (*QueryResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return file_databroker_proto_rawDescGZIP(), []int{8}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *QueryResponse) GetRecords() []*Record {
|
||||||
|
if x != nil {
|
||||||
|
return x.Records
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *QueryResponse) GetTotalCount() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.TotalCount
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
type SetRequest struct {
|
type SetRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
|
@ -454,7 +580,7 @@ type SetRequest struct {
|
||||||
func (x *SetRequest) Reset() {
|
func (x *SetRequest) Reset() {
|
||||||
*x = SetRequest{}
|
*x = SetRequest{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_databroker_proto_msgTypes[7]
|
mi := &file_databroker_proto_msgTypes[9]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
|
@ -467,7 +593,7 @@ func (x *SetRequest) String() string {
|
||||||
func (*SetRequest) ProtoMessage() {}
|
func (*SetRequest) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *SetRequest) ProtoReflect() protoreflect.Message {
|
func (x *SetRequest) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_databroker_proto_msgTypes[7]
|
mi := &file_databroker_proto_msgTypes[9]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
@ -480,7 +606,7 @@ func (x *SetRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
|
||||||
// Deprecated: Use SetRequest.ProtoReflect.Descriptor instead.
|
// Deprecated: Use SetRequest.ProtoReflect.Descriptor instead.
|
||||||
func (*SetRequest) Descriptor() ([]byte, []int) {
|
func (*SetRequest) Descriptor() ([]byte, []int) {
|
||||||
return file_databroker_proto_rawDescGZIP(), []int{7}
|
return file_databroker_proto_rawDescGZIP(), []int{9}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SetRequest) GetType() string {
|
func (x *SetRequest) GetType() string {
|
||||||
|
@ -516,7 +642,7 @@ type SetResponse struct {
|
||||||
func (x *SetResponse) Reset() {
|
func (x *SetResponse) Reset() {
|
||||||
*x = SetResponse{}
|
*x = SetResponse{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_databroker_proto_msgTypes[8]
|
mi := &file_databroker_proto_msgTypes[10]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
|
@ -529,7 +655,7 @@ func (x *SetResponse) String() string {
|
||||||
func (*SetResponse) ProtoMessage() {}
|
func (*SetResponse) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *SetResponse) ProtoReflect() protoreflect.Message {
|
func (x *SetResponse) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_databroker_proto_msgTypes[8]
|
mi := &file_databroker_proto_msgTypes[10]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
@ -542,7 +668,7 @@ func (x *SetResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
|
||||||
// Deprecated: Use SetResponse.ProtoReflect.Descriptor instead.
|
// Deprecated: Use SetResponse.ProtoReflect.Descriptor instead.
|
||||||
func (*SetResponse) Descriptor() ([]byte, []int) {
|
func (*SetResponse) Descriptor() ([]byte, []int) {
|
||||||
return file_databroker_proto_rawDescGZIP(), []int{8}
|
return file_databroker_proto_rawDescGZIP(), []int{10}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SetResponse) GetRecord() *Record {
|
func (x *SetResponse) GetRecord() *Record {
|
||||||
|
@ -572,7 +698,7 @@ type SyncRequest struct {
|
||||||
func (x *SyncRequest) Reset() {
|
func (x *SyncRequest) Reset() {
|
||||||
*x = SyncRequest{}
|
*x = SyncRequest{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_databroker_proto_msgTypes[9]
|
mi := &file_databroker_proto_msgTypes[11]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
|
@ -585,7 +711,7 @@ func (x *SyncRequest) String() string {
|
||||||
func (*SyncRequest) ProtoMessage() {}
|
func (*SyncRequest) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *SyncRequest) ProtoReflect() protoreflect.Message {
|
func (x *SyncRequest) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_databroker_proto_msgTypes[9]
|
mi := &file_databroker_proto_msgTypes[11]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
@ -598,7 +724,7 @@ func (x *SyncRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
|
||||||
// Deprecated: Use SyncRequest.ProtoReflect.Descriptor instead.
|
// Deprecated: Use SyncRequest.ProtoReflect.Descriptor instead.
|
||||||
func (*SyncRequest) Descriptor() ([]byte, []int) {
|
func (*SyncRequest) Descriptor() ([]byte, []int) {
|
||||||
return file_databroker_proto_rawDescGZIP(), []int{9}
|
return file_databroker_proto_rawDescGZIP(), []int{11}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SyncRequest) GetServerVersion() string {
|
func (x *SyncRequest) GetServerVersion() string {
|
||||||
|
@ -634,7 +760,7 @@ type SyncResponse struct {
|
||||||
func (x *SyncResponse) Reset() {
|
func (x *SyncResponse) Reset() {
|
||||||
*x = SyncResponse{}
|
*x = SyncResponse{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_databroker_proto_msgTypes[10]
|
mi := &file_databroker_proto_msgTypes[12]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
|
@ -647,7 +773,7 @@ func (x *SyncResponse) String() string {
|
||||||
func (*SyncResponse) ProtoMessage() {}
|
func (*SyncResponse) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *SyncResponse) ProtoReflect() protoreflect.Message {
|
func (x *SyncResponse) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_databroker_proto_msgTypes[10]
|
mi := &file_databroker_proto_msgTypes[12]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
@ -660,7 +786,7 @@ func (x *SyncResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
|
||||||
// Deprecated: Use SyncResponse.ProtoReflect.Descriptor instead.
|
// Deprecated: Use SyncResponse.ProtoReflect.Descriptor instead.
|
||||||
func (*SyncResponse) Descriptor() ([]byte, []int) {
|
func (*SyncResponse) Descriptor() ([]byte, []int) {
|
||||||
return file_databroker_proto_rawDescGZIP(), []int{10}
|
return file_databroker_proto_rawDescGZIP(), []int{12}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SyncResponse) GetServerVersion() string {
|
func (x *SyncResponse) GetServerVersion() string {
|
||||||
|
@ -688,7 +814,7 @@ type GetTypesResponse struct {
|
||||||
func (x *GetTypesResponse) Reset() {
|
func (x *GetTypesResponse) Reset() {
|
||||||
*x = GetTypesResponse{}
|
*x = GetTypesResponse{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_databroker_proto_msgTypes[11]
|
mi := &file_databroker_proto_msgTypes[13]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
|
@ -701,7 +827,7 @@ func (x *GetTypesResponse) String() string {
|
||||||
func (*GetTypesResponse) ProtoMessage() {}
|
func (*GetTypesResponse) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *GetTypesResponse) ProtoReflect() protoreflect.Message {
|
func (x *GetTypesResponse) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_databroker_proto_msgTypes[11]
|
mi := &file_databroker_proto_msgTypes[13]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
@ -714,7 +840,7 @@ func (x *GetTypesResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
|
||||||
// Deprecated: Use GetTypesResponse.ProtoReflect.Descriptor instead.
|
// Deprecated: Use GetTypesResponse.ProtoReflect.Descriptor instead.
|
||||||
func (*GetTypesResponse) Descriptor() ([]byte, []int) {
|
func (*GetTypesResponse) Descriptor() ([]byte, []int) {
|
||||||
return file_databroker_proto_rawDescGZIP(), []int{11}
|
return file_databroker_proto_rawDescGZIP(), []int{13}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetTypesResponse) GetTypes() []string {
|
func (x *GetTypesResponse) GetTypes() []string {
|
||||||
|
@ -776,67 +902,84 @@ var file_databroker_proto_rawDesc = []byte{
|
||||||
0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
|
0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
|
||||||
0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x63, 0x6f, 0x72,
|
0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x63, 0x6f, 0x72,
|
||||||
0x64, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
|
0x64, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
0x0d, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x5a,
|
0x0d, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x66,
|
||||||
0x0a, 0x0a, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04,
|
0x0a, 0x0c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12,
|
||||||
0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65,
|
0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79,
|
||||||
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64,
|
0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||||
0x12, 0x28, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14,
|
0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73,
|
||||||
0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
|
0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74,
|
||||||
0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x60, 0x0a, 0x0b, 0x53, 0x65,
|
0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52,
|
||||||
0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x06, 0x72, 0x65, 0x63,
|
0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x5e, 0x0a, 0x0d, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52,
|
||||||
0x6f, 0x72, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x64, 0x61, 0x74, 0x61,
|
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72,
|
||||||
0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x06, 0x72,
|
0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62,
|
||||||
0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f,
|
0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x07, 0x72, 0x65,
|
||||||
0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73,
|
0x63, 0x6f, 0x72, 0x64, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x63,
|
||||||
0x65, 0x72, 0x76, 0x65, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x6f, 0x0a, 0x0b,
|
0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61,
|
||||||
0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x73,
|
0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x5a, 0x0a, 0x0a, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71,
|
||||||
0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20,
|
0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01,
|
||||||
0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69,
|
0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02,
|
||||||
0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x5f, 0x76, 0x65, 0x72,
|
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x28, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61,
|
||||||
0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x72, 0x65, 0x63, 0x6f,
|
0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
|
||||||
0x72, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70,
|
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x64, 0x61,
|
||||||
0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x63, 0x0a,
|
0x74, 0x61, 0x22, 0x60, 0x0a, 0x0b, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||||
0x0c, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x25, 0x0a,
|
0x65, 0x12, 0x2a, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||||
|
0x0b, 0x32, 0x12, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x52,
|
||||||
|
0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x25, 0x0a,
|
||||||
0x0e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18,
|
0x0e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18,
|
||||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x56, 0x65, 0x72,
|
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x56, 0x65, 0x72,
|
||||||
0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2c, 0x0a, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x18,
|
0x73, 0x69, 0x6f, 0x6e, 0x22, 0x6f, 0x0a, 0x0b, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x71, 0x75,
|
||||||
0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b,
|
0x65, 0x73, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x76, 0x65,
|
||||||
0x65, 0x72, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72,
|
0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x65, 0x72,
|
||||||
0x64, 0x73, 0x22, 0x28, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x52, 0x65,
|
0x76, 0x65, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65,
|
||||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, 0x18,
|
0x63, 0x6f, 0x72, 0x64, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01,
|
||||||
0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, 0x32, 0xc5, 0x03, 0x0a,
|
0x28, 0x09, 0x52, 0x0d, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f,
|
||||||
0x11, 0x44, 0x61, 0x74, 0x61, 0x42, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69,
|
0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
0x63, 0x65, 0x12, 0x3b, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x19, 0x2e, 0x64,
|
0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x63, 0x0a, 0x0c, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x73,
|
||||||
0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65,
|
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f,
|
||||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
|
0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73,
|
||||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12,
|
0x65, 0x72, 0x76, 0x65, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2c, 0x0a, 0x07,
|
||||||
0x36, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x16, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f,
|
0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e,
|
||||||
0x6b, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17,
|
0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x72,
|
||||||
|
0x64, 0x52, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, 0x28, 0x0a, 0x10, 0x47, 0x65,
|
||||||
|
0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14,
|
||||||
|
0x0a, 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x74,
|
||||||
|
0x79, 0x70, 0x65, 0x73, 0x32, 0x83, 0x04, 0x0a, 0x11, 0x44, 0x61, 0x74, 0x61, 0x42, 0x72, 0x6f,
|
||||||
|
0x6b, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3b, 0x0a, 0x06, 0x44, 0x65,
|
||||||
|
0x6c, 0x65, 0x74, 0x65, 0x12, 0x19, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65,
|
||||||
|
0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||||
|
0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
|
||||||
|
0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x36, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x16,
|
||||||
0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52,
|
0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52,
|
||||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x06, 0x47, 0x65, 0x74, 0x41, 0x6c,
|
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f,
|
||||||
0x6c, 0x12, 0x19, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x47,
|
0x6b, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
||||||
0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x64,
|
0x3f, 0x0a, 0x06, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x12, 0x19, 0x2e, 0x64, 0x61, 0x74, 0x61,
|
||||||
0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c,
|
0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x71,
|
||||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x03, 0x53, 0x65, 0x74, 0x12,
|
0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65,
|
||||||
0x16, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74,
|
0x72, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72,
|
0x12, 0x3c, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x18, 0x2e, 0x64, 0x61, 0x74, 0x61,
|
||||||
0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75,
|
||||||
0x12, 0x3b, 0x0a, 0x04, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x17, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62,
|
0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72,
|
||||||
0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36,
|
||||||
0x74, 0x1a, 0x18, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x53,
|
0x0a, 0x03, 0x53, 0x65, 0x74, 0x12, 0x16, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b,
|
||||||
0x79, 0x6e, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x40, 0x0a,
|
0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e,
|
||||||
0x08, 0x47, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
|
0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x52, 0x65,
|
||||||
0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74,
|
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x04, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x17,
|
||||||
0x79, 0x1a, 0x1c, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x47,
|
0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x53, 0x79, 0x6e, 0x63,
|
||||||
0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72,
|
||||||
0x43, 0x0a, 0x09, 0x53, 0x79, 0x6e, 0x63, 0x54, 0x79, 0x70, 0x65, 0x73, 0x12, 0x16, 0x2e, 0x67,
|
0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||||
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45,
|
0x65, 0x30, 0x01, 0x12, 0x40, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x12,
|
||||||
0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1c, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65,
|
0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
|
||||||
0x72, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1c, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72,
|
||||||
0x73, 0x65, 0x30, 0x01, 0x42, 0x32, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
|
0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x52, 0x65, 0x73,
|
||||||
0x6f, 0x6d, 0x2f, 0x70, 0x6f, 0x6d, 0x65, 0x72, 0x69, 0x75, 0x6d, 0x2f, 0x70, 0x6f, 0x6d, 0x65,
|
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x09, 0x53, 0x79, 0x6e, 0x63, 0x54, 0x79, 0x70,
|
||||||
0x72, 0x69, 0x75, 0x6d, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x64, 0x61,
|
0x65, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||||
0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1c, 0x2e, 0x64, 0x61, 0x74,
|
||||||
|
0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73,
|
||||||
|
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x42, 0x32, 0x5a, 0x30, 0x67, 0x69,
|
||||||
|
0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6f, 0x6d, 0x65, 0x72, 0x69, 0x75,
|
||||||
|
0x6d, 0x2f, 0x70, 0x6f, 0x6d, 0x65, 0x72, 0x69, 0x75, 0x6d, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x67,
|
||||||
|
0x72, 0x70, 0x63, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x62, 0x06,
|
||||||
|
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -851,7 +994,7 @@ func file_databroker_proto_rawDescGZIP() []byte {
|
||||||
return file_databroker_proto_rawDescData
|
return file_databroker_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_databroker_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
|
var file_databroker_proto_msgTypes = make([]protoimpl.MessageInfo, 14)
|
||||||
var file_databroker_proto_goTypes = []interface{}{
|
var file_databroker_proto_goTypes = []interface{}{
|
||||||
(*ServerVersion)(nil), // 0: databroker.ServerVersion
|
(*ServerVersion)(nil), // 0: databroker.ServerVersion
|
||||||
(*Record)(nil), // 1: databroker.Record
|
(*Record)(nil), // 1: databroker.Record
|
||||||
|
@ -860,44 +1003,49 @@ var file_databroker_proto_goTypes = []interface{}{
|
||||||
(*GetResponse)(nil), // 4: databroker.GetResponse
|
(*GetResponse)(nil), // 4: databroker.GetResponse
|
||||||
(*GetAllRequest)(nil), // 5: databroker.GetAllRequest
|
(*GetAllRequest)(nil), // 5: databroker.GetAllRequest
|
||||||
(*GetAllResponse)(nil), // 6: databroker.GetAllResponse
|
(*GetAllResponse)(nil), // 6: databroker.GetAllResponse
|
||||||
(*SetRequest)(nil), // 7: databroker.SetRequest
|
(*QueryRequest)(nil), // 7: databroker.QueryRequest
|
||||||
(*SetResponse)(nil), // 8: databroker.SetResponse
|
(*QueryResponse)(nil), // 8: databroker.QueryResponse
|
||||||
(*SyncRequest)(nil), // 9: databroker.SyncRequest
|
(*SetRequest)(nil), // 9: databroker.SetRequest
|
||||||
(*SyncResponse)(nil), // 10: databroker.SyncResponse
|
(*SetResponse)(nil), // 10: databroker.SetResponse
|
||||||
(*GetTypesResponse)(nil), // 11: databroker.GetTypesResponse
|
(*SyncRequest)(nil), // 11: databroker.SyncRequest
|
||||||
(*any.Any)(nil), // 12: google.protobuf.Any
|
(*SyncResponse)(nil), // 12: databroker.SyncResponse
|
||||||
(*timestamp.Timestamp)(nil), // 13: google.protobuf.Timestamp
|
(*GetTypesResponse)(nil), // 13: databroker.GetTypesResponse
|
||||||
(*empty.Empty)(nil), // 14: google.protobuf.Empty
|
(*any.Any)(nil), // 14: google.protobuf.Any
|
||||||
|
(*timestamp.Timestamp)(nil), // 15: google.protobuf.Timestamp
|
||||||
|
(*empty.Empty)(nil), // 16: google.protobuf.Empty
|
||||||
}
|
}
|
||||||
var file_databroker_proto_depIdxs = []int32{
|
var file_databroker_proto_depIdxs = []int32{
|
||||||
12, // 0: databroker.Record.data:type_name -> google.protobuf.Any
|
14, // 0: databroker.Record.data:type_name -> google.protobuf.Any
|
||||||
13, // 1: databroker.Record.created_at:type_name -> google.protobuf.Timestamp
|
15, // 1: databroker.Record.created_at:type_name -> google.protobuf.Timestamp
|
||||||
13, // 2: databroker.Record.modified_at:type_name -> google.protobuf.Timestamp
|
15, // 2: databroker.Record.modified_at:type_name -> google.protobuf.Timestamp
|
||||||
13, // 3: databroker.Record.deleted_at:type_name -> google.protobuf.Timestamp
|
15, // 3: databroker.Record.deleted_at:type_name -> google.protobuf.Timestamp
|
||||||
1, // 4: databroker.GetResponse.record:type_name -> databroker.Record
|
1, // 4: databroker.GetResponse.record:type_name -> databroker.Record
|
||||||
1, // 5: databroker.GetAllResponse.records:type_name -> databroker.Record
|
1, // 5: databroker.GetAllResponse.records:type_name -> databroker.Record
|
||||||
12, // 6: databroker.SetRequest.data:type_name -> google.protobuf.Any
|
1, // 6: databroker.QueryResponse.records:type_name -> databroker.Record
|
||||||
1, // 7: databroker.SetResponse.record:type_name -> databroker.Record
|
14, // 7: databroker.SetRequest.data:type_name -> google.protobuf.Any
|
||||||
1, // 8: databroker.SyncResponse.records:type_name -> databroker.Record
|
1, // 8: databroker.SetResponse.record:type_name -> databroker.Record
|
||||||
2, // 9: databroker.DataBrokerService.Delete:input_type -> databroker.DeleteRequest
|
1, // 9: databroker.SyncResponse.records:type_name -> databroker.Record
|
||||||
3, // 10: databroker.DataBrokerService.Get:input_type -> databroker.GetRequest
|
2, // 10: databroker.DataBrokerService.Delete:input_type -> databroker.DeleteRequest
|
||||||
5, // 11: databroker.DataBrokerService.GetAll:input_type -> databroker.GetAllRequest
|
3, // 11: databroker.DataBrokerService.Get:input_type -> databroker.GetRequest
|
||||||
7, // 12: databroker.DataBrokerService.Set:input_type -> databroker.SetRequest
|
5, // 12: databroker.DataBrokerService.GetAll:input_type -> databroker.GetAllRequest
|
||||||
9, // 13: databroker.DataBrokerService.Sync:input_type -> databroker.SyncRequest
|
7, // 13: databroker.DataBrokerService.Query:input_type -> databroker.QueryRequest
|
||||||
14, // 14: databroker.DataBrokerService.GetTypes:input_type -> google.protobuf.Empty
|
9, // 14: databroker.DataBrokerService.Set:input_type -> databroker.SetRequest
|
||||||
14, // 15: databroker.DataBrokerService.SyncTypes:input_type -> google.protobuf.Empty
|
11, // 15: databroker.DataBrokerService.Sync:input_type -> databroker.SyncRequest
|
||||||
14, // 16: databroker.DataBrokerService.Delete:output_type -> google.protobuf.Empty
|
16, // 16: databroker.DataBrokerService.GetTypes:input_type -> google.protobuf.Empty
|
||||||
4, // 17: databroker.DataBrokerService.Get:output_type -> databroker.GetResponse
|
16, // 17: databroker.DataBrokerService.SyncTypes:input_type -> google.protobuf.Empty
|
||||||
6, // 18: databroker.DataBrokerService.GetAll:output_type -> databroker.GetAllResponse
|
16, // 18: databroker.DataBrokerService.Delete:output_type -> google.protobuf.Empty
|
||||||
8, // 19: databroker.DataBrokerService.Set:output_type -> databroker.SetResponse
|
4, // 19: databroker.DataBrokerService.Get:output_type -> databroker.GetResponse
|
||||||
10, // 20: databroker.DataBrokerService.Sync:output_type -> databroker.SyncResponse
|
6, // 20: databroker.DataBrokerService.GetAll:output_type -> databroker.GetAllResponse
|
||||||
11, // 21: databroker.DataBrokerService.GetTypes:output_type -> databroker.GetTypesResponse
|
8, // 21: databroker.DataBrokerService.Query:output_type -> databroker.QueryResponse
|
||||||
11, // 22: databroker.DataBrokerService.SyncTypes:output_type -> databroker.GetTypesResponse
|
10, // 22: databroker.DataBrokerService.Set:output_type -> databroker.SetResponse
|
||||||
16, // [16:23] is the sub-list for method output_type
|
12, // 23: databroker.DataBrokerService.Sync:output_type -> databroker.SyncResponse
|
||||||
9, // [9:16] is the sub-list for method input_type
|
13, // 24: databroker.DataBrokerService.GetTypes:output_type -> databroker.GetTypesResponse
|
||||||
9, // [9:9] is the sub-list for extension type_name
|
13, // 25: databroker.DataBrokerService.SyncTypes:output_type -> databroker.GetTypesResponse
|
||||||
9, // [9:9] is the sub-list for extension extendee
|
18, // [18:26] is the sub-list for method output_type
|
||||||
0, // [0:9] is the sub-list for field type_name
|
10, // [10:18] is the sub-list for method input_type
|
||||||
|
10, // [10:10] is the sub-list for extension type_name
|
||||||
|
10, // [10:10] is the sub-list for extension extendee
|
||||||
|
0, // [0:10] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_databroker_proto_init() }
|
func init() { file_databroker_proto_init() }
|
||||||
|
@ -991,7 +1139,7 @@ func file_databroker_proto_init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_databroker_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
|
file_databroker_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*SetRequest); i {
|
switch v := v.(*QueryRequest); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -1003,7 +1151,7 @@ func file_databroker_proto_init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_databroker_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
|
file_databroker_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*SetResponse); i {
|
switch v := v.(*QueryResponse); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -1015,7 +1163,7 @@ func file_databroker_proto_init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_databroker_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
|
file_databroker_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*SyncRequest); i {
|
switch v := v.(*SetRequest); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -1027,7 +1175,7 @@ func file_databroker_proto_init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_databroker_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
|
file_databroker_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*SyncResponse); i {
|
switch v := v.(*SetResponse); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -1039,6 +1187,30 @@ func file_databroker_proto_init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_databroker_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
|
file_databroker_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*SyncRequest); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_databroker_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*SyncResponse); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_databroker_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*GetTypesResponse); i {
|
switch v := v.(*GetTypesResponse); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
|
@ -1057,7 +1229,7 @@ func file_databroker_proto_init() {
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_databroker_proto_rawDesc,
|
RawDescriptor: file_databroker_proto_rawDesc,
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 12,
|
NumMessages: 14,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 1,
|
NumServices: 1,
|
||||||
},
|
},
|
||||||
|
@ -1086,6 +1258,7 @@ type DataBrokerServiceClient interface {
|
||||||
Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*empty.Empty, error)
|
Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*empty.Empty, error)
|
||||||
Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error)
|
Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error)
|
||||||
GetAll(ctx context.Context, in *GetAllRequest, opts ...grpc.CallOption) (*GetAllResponse, error)
|
GetAll(ctx context.Context, in *GetAllRequest, opts ...grpc.CallOption) (*GetAllResponse, error)
|
||||||
|
Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error)
|
||||||
Set(ctx context.Context, in *SetRequest, opts ...grpc.CallOption) (*SetResponse, error)
|
Set(ctx context.Context, in *SetRequest, opts ...grpc.CallOption) (*SetResponse, error)
|
||||||
Sync(ctx context.Context, in *SyncRequest, opts ...grpc.CallOption) (DataBrokerService_SyncClient, error)
|
Sync(ctx context.Context, in *SyncRequest, opts ...grpc.CallOption) (DataBrokerService_SyncClient, error)
|
||||||
GetTypes(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*GetTypesResponse, error)
|
GetTypes(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*GetTypesResponse, error)
|
||||||
|
@ -1127,6 +1300,15 @@ func (c *dataBrokerServiceClient) GetAll(ctx context.Context, in *GetAllRequest,
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *dataBrokerServiceClient) Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error) {
|
||||||
|
out := new(QueryResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/databroker.DataBrokerService/Query", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (c *dataBrokerServiceClient) Set(ctx context.Context, in *SetRequest, opts ...grpc.CallOption) (*SetResponse, error) {
|
func (c *dataBrokerServiceClient) Set(ctx context.Context, in *SetRequest, opts ...grpc.CallOption) (*SetResponse, error) {
|
||||||
out := new(SetResponse)
|
out := new(SetResponse)
|
||||||
err := c.cc.Invoke(ctx, "/databroker.DataBrokerService/Set", in, out, opts...)
|
err := c.cc.Invoke(ctx, "/databroker.DataBrokerService/Set", in, out, opts...)
|
||||||
|
@ -1214,6 +1396,7 @@ type DataBrokerServiceServer interface {
|
||||||
Delete(context.Context, *DeleteRequest) (*empty.Empty, error)
|
Delete(context.Context, *DeleteRequest) (*empty.Empty, error)
|
||||||
Get(context.Context, *GetRequest) (*GetResponse, error)
|
Get(context.Context, *GetRequest) (*GetResponse, error)
|
||||||
GetAll(context.Context, *GetAllRequest) (*GetAllResponse, error)
|
GetAll(context.Context, *GetAllRequest) (*GetAllResponse, error)
|
||||||
|
Query(context.Context, *QueryRequest) (*QueryResponse, error)
|
||||||
Set(context.Context, *SetRequest) (*SetResponse, error)
|
Set(context.Context, *SetRequest) (*SetResponse, error)
|
||||||
Sync(*SyncRequest, DataBrokerService_SyncServer) error
|
Sync(*SyncRequest, DataBrokerService_SyncServer) error
|
||||||
GetTypes(context.Context, *empty.Empty) (*GetTypesResponse, error)
|
GetTypes(context.Context, *empty.Empty) (*GetTypesResponse, error)
|
||||||
|
@ -1233,6 +1416,9 @@ func (*UnimplementedDataBrokerServiceServer) Get(context.Context, *GetRequest) (
|
||||||
func (*UnimplementedDataBrokerServiceServer) GetAll(context.Context, *GetAllRequest) (*GetAllResponse, error) {
|
func (*UnimplementedDataBrokerServiceServer) GetAll(context.Context, *GetAllRequest) (*GetAllResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetAll not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method GetAll not implemented")
|
||||||
}
|
}
|
||||||
|
func (*UnimplementedDataBrokerServiceServer) Query(context.Context, *QueryRequest) (*QueryResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method Query not implemented")
|
||||||
|
}
|
||||||
func (*UnimplementedDataBrokerServiceServer) Set(context.Context, *SetRequest) (*SetResponse, error) {
|
func (*UnimplementedDataBrokerServiceServer) Set(context.Context, *SetRequest) (*SetResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method Set not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method Set not implemented")
|
||||||
}
|
}
|
||||||
|
@ -1304,6 +1490,24 @@ func _DataBrokerService_GetAll_Handler(srv interface{}, ctx context.Context, dec
|
||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _DataBrokerService_Query_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(QueryRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(DataBrokerServiceServer).Query(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/databroker.DataBrokerService/Query",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(DataBrokerServiceServer).Query(ctx, req.(*QueryRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
func _DataBrokerService_Set_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
func _DataBrokerService_Set_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(SetRequest)
|
in := new(SetRequest)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
|
@ -1398,6 +1602,10 @@ var _DataBrokerService_serviceDesc = grpc.ServiceDesc{
|
||||||
MethodName: "GetAll",
|
MethodName: "GetAll",
|
||||||
Handler: _DataBrokerService_GetAll_Handler,
|
Handler: _DataBrokerService_GetAll_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "Query",
|
||||||
|
Handler: _DataBrokerService_Query_Handler,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
MethodName: "Set",
|
MethodName: "Set",
|
||||||
Handler: _DataBrokerService_Set_Handler,
|
Handler: _DataBrokerService_Set_Handler,
|
||||||
|
|
|
@ -39,6 +39,17 @@ message GetAllResponse {
|
||||||
string record_version = 3;
|
string record_version = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message QueryRequest {
|
||||||
|
string type = 1;
|
||||||
|
string query = 2;
|
||||||
|
int64 offset = 3;
|
||||||
|
int64 limit = 4;
|
||||||
|
}
|
||||||
|
message QueryResponse {
|
||||||
|
repeated Record records = 1;
|
||||||
|
int64 total_count = 2;
|
||||||
|
}
|
||||||
|
|
||||||
message SetRequest {
|
message SetRequest {
|
||||||
string type = 1;
|
string type = 1;
|
||||||
string id = 2;
|
string id = 2;
|
||||||
|
@ -65,6 +76,7 @@ service DataBrokerService {
|
||||||
rpc Delete(DeleteRequest) returns (google.protobuf.Empty);
|
rpc Delete(DeleteRequest) returns (google.protobuf.Empty);
|
||||||
rpc Get(GetRequest) returns (GetResponse);
|
rpc Get(GetRequest) returns (GetResponse);
|
||||||
rpc GetAll(GetAllRequest) returns (GetAllResponse);
|
rpc GetAll(GetAllRequest) returns (GetAllResponse);
|
||||||
|
rpc Query(QueryRequest) returns (QueryResponse);
|
||||||
rpc Set(SetRequest) returns (SetResponse);
|
rpc Set(SetRequest) returns (SetResponse);
|
||||||
rpc Sync(SyncRequest) returns (stream SyncResponse);
|
rpc Sync(SyncRequest) returns (stream SyncResponse);
|
||||||
|
|
||||||
|
|
46
pkg/grpc/databroker/databroker_test.go
Normal file
46
pkg/grpc/databroker/databroker_test.go
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
package databroker
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestApplyOffsetAndLimit(t *testing.T) {
|
||||||
|
cases := []struct {
|
||||||
|
name string
|
||||||
|
records []*Record
|
||||||
|
offset, limit int
|
||||||
|
expect []*Record
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "empty",
|
||||||
|
records: nil,
|
||||||
|
offset: 10,
|
||||||
|
limit: 5,
|
||||||
|
expect: nil,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "less than limit",
|
||||||
|
records: []*Record{{Id: "A"}, {Id: "B"}, {Id: "C"}, {Id: "D"}},
|
||||||
|
offset: 1,
|
||||||
|
limit: 10,
|
||||||
|
expect: []*Record{{Id: "B"}, {Id: "C"}, {Id: "D"}},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "more than limit",
|
||||||
|
records: []*Record{{Id: "A"}, {Id: "B"}, {Id: "C"}, {Id: "D"}, {Id: "E"}, {Id: "F"}, {Id: "G"}, {Id: "H"}},
|
||||||
|
offset: 3,
|
||||||
|
limit: 2,
|
||||||
|
expect: []*Record{{Id: "D"}, {Id: "E"}},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tc := range cases {
|
||||||
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
|
actual, cnt := ApplyOffsetAndLimit(tc.records, tc.offset, tc.limit)
|
||||||
|
assert.Equal(t, len(tc.records), cnt)
|
||||||
|
assert.Equal(t, tc.expect, actual)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,6 +19,7 @@ import (
|
||||||
"google.golang.org/protobuf/types/known/anypb"
|
"google.golang.org/protobuf/types/known/anypb"
|
||||||
|
|
||||||
"github.com/pomerium/pomerium/pkg/cryptutil"
|
"github.com/pomerium/pomerium/pkg/cryptutil"
|
||||||
|
"github.com/pomerium/pomerium/pkg/grpc/directory"
|
||||||
)
|
)
|
||||||
|
|
||||||
var db *DB
|
var db *DB
|
||||||
|
@ -120,6 +121,11 @@ func testDB(t *testing.T) {
|
||||||
ctx, cancelFunc := context.WithCancel(context.Background())
|
ctx, cancelFunc := context.WithCancel(context.Background())
|
||||||
defer cancelFunc()
|
defer cancelFunc()
|
||||||
|
|
||||||
|
users := []*directory.User{
|
||||||
|
{Id: "u1", GroupIds: []string{"test", "admin"}},
|
||||||
|
{Id: "u2"},
|
||||||
|
{Id: "u3", GroupIds: []string{"test"}},
|
||||||
|
}
|
||||||
ids := []string{"a", "b", "c"}
|
ids := []string{"a", "b", "c"}
|
||||||
id := ids[0]
|
id := ids[0]
|
||||||
c := db.pool.Get()
|
c := db.pool.Get()
|
||||||
|
@ -133,13 +139,13 @@ func testDB(t *testing.T) {
|
||||||
assert.Nil(t, record)
|
assert.Nil(t, record)
|
||||||
})
|
})
|
||||||
t.Run("get record", func(t *testing.T) {
|
t.Run("get record", func(t *testing.T) {
|
||||||
data := new(anypb.Any)
|
data, _ := anypb.New(users[0])
|
||||||
assert.NoError(t, db.Put(ctx, id, data))
|
assert.NoError(t, db.Put(ctx, id, data))
|
||||||
record, err := db.Get(ctx, id)
|
record, err := db.Get(ctx, id)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
if assert.NotNil(t, record) {
|
if assert.NotNil(t, record) {
|
||||||
assert.NotNil(t, record.CreatedAt)
|
assert.NotNil(t, record.CreatedAt)
|
||||||
assert.Equal(t, data, record.Data)
|
assert.NotEmpty(t, record.Data)
|
||||||
assert.Nil(t, record.DeletedAt)
|
assert.Nil(t, record.DeletedAt)
|
||||||
assert.Equal(t, "a", record.Id)
|
assert.Equal(t, "a", record.Id)
|
||||||
assert.NotNil(t, record.ModifiedAt)
|
assert.NotNil(t, record.ModifiedAt)
|
||||||
|
@ -163,9 +169,9 @@ func testDB(t *testing.T) {
|
||||||
records, err := db.GetAll(ctx)
|
records, err := db.GetAll(ctx)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Len(t, records, 0)
|
assert.Len(t, records, 0)
|
||||||
data := new(anypb.Any)
|
|
||||||
|
|
||||||
for _, id := range ids {
|
for i, id := range ids {
|
||||||
|
data, _ := anypb.New(users[i])
|
||||||
assert.NoError(t, db.Put(ctx, id, data))
|
assert.NoError(t, db.Put(ctx, id, data))
|
||||||
}
|
}
|
||||||
records, err = db.GetAll(ctx)
|
records, err = db.GetAll(ctx)
|
||||||
|
|
|
@ -3,10 +3,13 @@ package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
"google.golang.org/protobuf/types/known/anypb"
|
"google.golang.org/protobuf/types/known/anypb"
|
||||||
|
|
||||||
|
"github.com/pomerium/pomerium/internal/log"
|
||||||
"github.com/pomerium/pomerium/pkg/grpc/databroker"
|
"github.com/pomerium/pomerium/pkg/grpc/databroker"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -38,3 +41,74 @@ type Backend interface {
|
||||||
// the channel.
|
// the channel.
|
||||||
Watch(ctx context.Context) <-chan struct{}
|
Watch(ctx context.Context) <-chan struct{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MatchAny searches any data with a query.
|
||||||
|
func MatchAny(any *anypb.Any, query string) bool {
|
||||||
|
if any == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
msg, err := any.UnmarshalNew()
|
||||||
|
if err != nil {
|
||||||
|
// ignore invalid any types
|
||||||
|
log.Error().Err(err).Msg("storage: invalid any type")
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// search by query
|
||||||
|
return matchProtoMessage(msg.ProtoReflect(), query)
|
||||||
|
}
|
||||||
|
|
||||||
|
func matchProtoMessage(msg protoreflect.Message, query string) bool {
|
||||||
|
md := msg.Descriptor()
|
||||||
|
fds := md.Fields()
|
||||||
|
for i := 0; i < fds.Len(); i++ {
|
||||||
|
fd := fds.Get(i)
|
||||||
|
if !msg.Has(fd) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if matchProtoValue(fd, msg.Get(fd), query) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func matchProtoValue(fd protoreflect.FieldDescriptor, v protoreflect.Value, query string) bool {
|
||||||
|
switch {
|
||||||
|
case fd.IsList():
|
||||||
|
return matchProtoListValue(fd, v.List(), query)
|
||||||
|
case fd.IsMap():
|
||||||
|
return matchProtoMapValue(fd, v.Map(), query)
|
||||||
|
default:
|
||||||
|
return matchProtoSingularValue(fd, v, query)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func matchProtoSingularValue(fd protoreflect.FieldDescriptor, v protoreflect.Value, query string) bool {
|
||||||
|
switch fd.Kind() {
|
||||||
|
case protoreflect.MessageKind:
|
||||||
|
return matchProtoMessage(v.Message(), query)
|
||||||
|
case protoreflect.StringKind:
|
||||||
|
return strings.Contains(strings.ToLower(v.String()), query)
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func matchProtoListValue(fd protoreflect.FieldDescriptor, l protoreflect.List, query string) bool {
|
||||||
|
for i := 0; i < l.Len(); i++ {
|
||||||
|
if matchProtoSingularValue(fd, l.Get(i), query) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func matchProtoMapValue(fd protoreflect.FieldDescriptor, m protoreflect.Map, query string) bool {
|
||||||
|
matches := false
|
||||||
|
m.Range(func(k protoreflect.MapKey, v protoreflect.Value) bool {
|
||||||
|
matches = matches || matchProtoSingularValue(fd, v, query)
|
||||||
|
return !matches
|
||||||
|
})
|
||||||
|
return matches
|
||||||
|
}
|
||||||
|
|
|
@ -2,11 +2,14 @@ package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
"google.golang.org/protobuf/types/known/anypb"
|
"google.golang.org/protobuf/types/known/anypb"
|
||||||
|
|
||||||
"github.com/pomerium/pomerium/pkg/grpc/databroker"
|
"github.com/pomerium/pomerium/pkg/grpc/databroker"
|
||||||
|
"github.com/pomerium/pomerium/pkg/grpc/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
type mockBackend struct {
|
type mockBackend struct {
|
||||||
|
@ -16,6 +19,7 @@ type mockBackend struct {
|
||||||
list func(ctx context.Context, sinceVersion string) ([]*databroker.Record, error)
|
list func(ctx context.Context, sinceVersion string) ([]*databroker.Record, error)
|
||||||
delete func(ctx context.Context, id string) error
|
delete func(ctx context.Context, id string) error
|
||||||
clearDeleted func(ctx context.Context, cutoff time.Time)
|
clearDeleted func(ctx context.Context, cutoff time.Time)
|
||||||
|
query func(ctx context.Context, query string, offset, limit int) ([]*databroker.Record, int, error)
|
||||||
watch func(ctx context.Context) <-chan struct{}
|
watch func(ctx context.Context) <-chan struct{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +51,20 @@ func (m *mockBackend) ClearDeleted(ctx context.Context, cutoff time.Time) {
|
||||||
m.clearDeleted(ctx, cutoff)
|
m.clearDeleted(ctx, cutoff)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *mockBackend) Query(ctx context.Context, query string, offset, limit int) ([]*databroker.Record, int, error) {
|
||||||
|
return m.query(ctx, query, offset, limit)
|
||||||
|
}
|
||||||
|
|
||||||
func (m *mockBackend) Watch(ctx context.Context) <-chan struct{} {
|
func (m *mockBackend) Watch(ctx context.Context) <-chan struct{} {
|
||||||
return m.watch(ctx)
|
return m.watch(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestMatchAny(t *testing.T) {
|
||||||
|
u := &user.User{Id: "id", Name: "name", Email: "email"}
|
||||||
|
data, _ := anypb.New(u)
|
||||||
|
assert.True(t, MatchAny(data, ""))
|
||||||
|
assert.True(t, MatchAny(data, "id"))
|
||||||
|
assert.True(t, MatchAny(data, "name"))
|
||||||
|
assert.True(t, MatchAny(data, "email"))
|
||||||
|
assert.False(t, MatchAny(data, "nope"))
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue