From 2eb24fd42a0b32df92f3592de3c2394fe3cc036e Mon Sep 17 00:00:00 2001 From: Caleb Doxsey Date: Fri, 3 Feb 2023 12:08:04 -0700 Subject: [PATCH] databroker: add list types method --- databroker/databroker.go | 7 + internal/databroker/server.go | 16 + pkg/grpc/databroker/databroker.pb.go | 557 +++++++++++------- pkg/grpc/databroker/databroker.proto | 6 + .../mock_databroker/databroker.pb.go | 35 ++ pkg/storage/encrypted.go | 4 + pkg/storage/inmemory/backend.go | 12 + pkg/storage/postgres/backend.go | 13 + pkg/storage/postgres/backend_test.go | 6 + pkg/storage/postgres/postgres.go | 31 + pkg/storage/redis/redis.go | 32 +- pkg/storage/redis/redis_test.go | 5 + pkg/storage/storage.go | 2 + 13 files changed, 494 insertions(+), 232 deletions(-) diff --git a/databroker/databroker.go b/databroker/databroker.go index 7cab0e276..6a2e4ae82 100644 --- a/databroker/databroker.go +++ b/databroker/databroker.go @@ -72,6 +72,13 @@ func (srv *dataBrokerServer) Get(ctx context.Context, req *databrokerpb.GetReque return srv.server.Get(ctx, req) } +func (srv *dataBrokerServer) ListTypes(ctx context.Context, req *emptypb.Empty) (*databrokerpb.ListTypesResponse, error) { + if err := grpcutil.RequireSignedJWT(ctx, srv.sharedKey.Load()); err != nil { + return nil, err + } + return srv.server.ListTypes(ctx) +} + func (srv *dataBrokerServer) Query(ctx context.Context, req *databrokerpb.QueryRequest) (*databrokerpb.QueryResponse, error) { if err := grpcutil.RequireSignedJWT(ctx, srv.sharedKey.Load()); err != nil { return nil, err diff --git a/internal/databroker/server.go b/internal/databroker/server.go index 04256b9d0..cf573b816 100644 --- a/internal/databroker/server.go +++ b/internal/databroker/server.go @@ -128,6 +128,22 @@ func (srv *Server) Get(ctx context.Context, req *databroker.GetRequest) (*databr }, nil } +func (srv *Server) ListTypes(ctx context.Context) (*databroker.ListTypesResponse, error) { + ctx, span := trace.StartSpan(ctx, "databroker.grpc.ListTypes") + defer span.End() + log.Info(ctx).Msg("list types") + + db, err := srv.getBackend() + if err != nil { + return nil, err + } + types, err := db.ListTypes(ctx) + if err != nil { + return nil, err + } + return &databroker.ListTypesResponse{Types: types}, nil +} + // Query queries for records. func (srv *Server) Query(ctx context.Context, req *databroker.QueryRequest) (*databroker.QueryResponse, error) { ctx, span := trace.StartSpan(ctx, "databroker.grpc.Query") diff --git a/pkg/grpc/databroker/databroker.pb.go b/pkg/grpc/databroker/databroker.pb.go index 076f84b13..f05f85db4 100644 --- a/pkg/grpc/databroker/databroker.pb.go +++ b/pkg/grpc/databroker/databroker.pb.go @@ -324,6 +324,53 @@ func (x *GetResponse) GetRecord() *Record { return nil } +type ListTypesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Types []string `protobuf:"bytes,1,rep,name=types,proto3" json:"types,omitempty"` +} + +func (x *ListTypesResponse) Reset() { + *x = ListTypesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_databroker_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListTypesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListTypesResponse) ProtoMessage() {} + +func (x *ListTypesResponse) ProtoReflect() protoreflect.Message { + mi := &file_databroker_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 ListTypesResponse.ProtoReflect.Descriptor instead. +func (*ListTypesResponse) Descriptor() ([]byte, []int) { + return file_databroker_proto_rawDescGZIP(), []int{5} +} + +func (x *ListTypesResponse) GetTypes() []string { + if x != nil { + return x.Types + } + return nil +} + type QueryRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -339,7 +386,7 @@ type QueryRequest struct { func (x *QueryRequest) Reset() { *x = QueryRequest{} if protoimpl.UnsafeEnabled { - mi := &file_databroker_proto_msgTypes[5] + mi := &file_databroker_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -352,7 +399,7 @@ func (x *QueryRequest) String() string { func (*QueryRequest) ProtoMessage() {} func (x *QueryRequest) ProtoReflect() protoreflect.Message { - mi := &file_databroker_proto_msgTypes[5] + mi := &file_databroker_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -365,7 +412,7 @@ func (x *QueryRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use QueryRequest.ProtoReflect.Descriptor instead. func (*QueryRequest) Descriptor() ([]byte, []int) { - return file_databroker_proto_rawDescGZIP(), []int{5} + return file_databroker_proto_rawDescGZIP(), []int{6} } func (x *QueryRequest) GetType() string { @@ -417,7 +464,7 @@ type QueryResponse struct { func (x *QueryResponse) Reset() { *x = QueryResponse{} if protoimpl.UnsafeEnabled { - mi := &file_databroker_proto_msgTypes[6] + mi := &file_databroker_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -430,7 +477,7 @@ func (x *QueryResponse) String() string { func (*QueryResponse) ProtoMessage() {} func (x *QueryResponse) ProtoReflect() protoreflect.Message { - mi := &file_databroker_proto_msgTypes[6] + mi := &file_databroker_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -443,7 +490,7 @@ func (x *QueryResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use QueryResponse.ProtoReflect.Descriptor instead. func (*QueryResponse) Descriptor() ([]byte, []int) { - return file_databroker_proto_rawDescGZIP(), []int{6} + return file_databroker_proto_rawDescGZIP(), []int{7} } func (x *QueryResponse) GetRecords() []*Record { @@ -485,7 +532,7 @@ type PutRequest struct { func (x *PutRequest) Reset() { *x = PutRequest{} if protoimpl.UnsafeEnabled { - mi := &file_databroker_proto_msgTypes[7] + mi := &file_databroker_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -498,7 +545,7 @@ func (x *PutRequest) String() string { func (*PutRequest) ProtoMessage() {} func (x *PutRequest) ProtoReflect() protoreflect.Message { - mi := &file_databroker_proto_msgTypes[7] + mi := &file_databroker_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -511,7 +558,7 @@ func (x *PutRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use PutRequest.ProtoReflect.Descriptor instead. func (*PutRequest) Descriptor() ([]byte, []int) { - return file_databroker_proto_rawDescGZIP(), []int{7} + return file_databroker_proto_rawDescGZIP(), []int{8} } func (x *PutRequest) GetRecords() []*Record { @@ -533,7 +580,7 @@ type PutResponse struct { func (x *PutResponse) Reset() { *x = PutResponse{} if protoimpl.UnsafeEnabled { - mi := &file_databroker_proto_msgTypes[8] + mi := &file_databroker_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -546,7 +593,7 @@ func (x *PutResponse) String() string { func (*PutResponse) ProtoMessage() {} func (x *PutResponse) ProtoReflect() protoreflect.Message { - mi := &file_databroker_proto_msgTypes[8] + mi := &file_databroker_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -559,7 +606,7 @@ func (x *PutResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use PutResponse.ProtoReflect.Descriptor instead. func (*PutResponse) Descriptor() ([]byte, []int) { - return file_databroker_proto_rawDescGZIP(), []int{8} + return file_databroker_proto_rawDescGZIP(), []int{9} } func (x *PutResponse) GetServerVersion() uint64 { @@ -588,7 +635,7 @@ type SetOptionsRequest struct { func (x *SetOptionsRequest) Reset() { *x = SetOptionsRequest{} if protoimpl.UnsafeEnabled { - mi := &file_databroker_proto_msgTypes[9] + mi := &file_databroker_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -601,7 +648,7 @@ func (x *SetOptionsRequest) String() string { func (*SetOptionsRequest) ProtoMessage() {} func (x *SetOptionsRequest) ProtoReflect() protoreflect.Message { - mi := &file_databroker_proto_msgTypes[9] + mi := &file_databroker_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -614,7 +661,7 @@ func (x *SetOptionsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SetOptionsRequest.ProtoReflect.Descriptor instead. func (*SetOptionsRequest) Descriptor() ([]byte, []int) { - return file_databroker_proto_rawDescGZIP(), []int{9} + return file_databroker_proto_rawDescGZIP(), []int{10} } func (x *SetOptionsRequest) GetType() string { @@ -642,7 +689,7 @@ type SetOptionsResponse struct { func (x *SetOptionsResponse) Reset() { *x = SetOptionsResponse{} if protoimpl.UnsafeEnabled { - mi := &file_databroker_proto_msgTypes[10] + mi := &file_databroker_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -655,7 +702,7 @@ func (x *SetOptionsResponse) String() string { func (*SetOptionsResponse) ProtoMessage() {} func (x *SetOptionsResponse) ProtoReflect() protoreflect.Message { - mi := &file_databroker_proto_msgTypes[10] + mi := &file_databroker_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -668,7 +715,7 @@ func (x *SetOptionsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SetOptionsResponse.ProtoReflect.Descriptor instead. func (*SetOptionsResponse) Descriptor() ([]byte, []int) { - return file_databroker_proto_rawDescGZIP(), []int{10} + return file_databroker_proto_rawDescGZIP(), []int{11} } func (x *SetOptionsResponse) GetOptions() *Options { @@ -691,7 +738,7 @@ type SyncRequest struct { func (x *SyncRequest) Reset() { *x = SyncRequest{} if protoimpl.UnsafeEnabled { - mi := &file_databroker_proto_msgTypes[11] + mi := &file_databroker_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -704,7 +751,7 @@ func (x *SyncRequest) String() string { func (*SyncRequest) ProtoMessage() {} func (x *SyncRequest) ProtoReflect() protoreflect.Message { - mi := &file_databroker_proto_msgTypes[11] + mi := &file_databroker_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -717,7 +764,7 @@ func (x *SyncRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncRequest.ProtoReflect.Descriptor instead. func (*SyncRequest) Descriptor() ([]byte, []int) { - return file_databroker_proto_rawDescGZIP(), []int{11} + return file_databroker_proto_rawDescGZIP(), []int{12} } func (x *SyncRequest) GetServerVersion() uint64 { @@ -752,7 +799,7 @@ type SyncResponse struct { func (x *SyncResponse) Reset() { *x = SyncResponse{} if protoimpl.UnsafeEnabled { - mi := &file_databroker_proto_msgTypes[12] + mi := &file_databroker_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -765,7 +812,7 @@ func (x *SyncResponse) String() string { func (*SyncResponse) ProtoMessage() {} func (x *SyncResponse) ProtoReflect() protoreflect.Message { - mi := &file_databroker_proto_msgTypes[12] + mi := &file_databroker_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -778,7 +825,7 @@ func (x *SyncResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncResponse.ProtoReflect.Descriptor instead. func (*SyncResponse) Descriptor() ([]byte, []int) { - return file_databroker_proto_rawDescGZIP(), []int{12} + return file_databroker_proto_rawDescGZIP(), []int{13} } func (x *SyncResponse) GetRecord() *Record { @@ -799,7 +846,7 @@ type SyncLatestRequest struct { func (x *SyncLatestRequest) Reset() { *x = SyncLatestRequest{} if protoimpl.UnsafeEnabled { - mi := &file_databroker_proto_msgTypes[13] + mi := &file_databroker_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -812,7 +859,7 @@ func (x *SyncLatestRequest) String() string { func (*SyncLatestRequest) ProtoMessage() {} func (x *SyncLatestRequest) ProtoReflect() protoreflect.Message { - mi := &file_databroker_proto_msgTypes[13] + mi := &file_databroker_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -825,7 +872,7 @@ func (x *SyncLatestRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncLatestRequest.ProtoReflect.Descriptor instead. func (*SyncLatestRequest) Descriptor() ([]byte, []int) { - return file_databroker_proto_rawDescGZIP(), []int{13} + return file_databroker_proto_rawDescGZIP(), []int{14} } func (x *SyncLatestRequest) GetType() string { @@ -850,7 +897,7 @@ type SyncLatestResponse struct { func (x *SyncLatestResponse) Reset() { *x = SyncLatestResponse{} if protoimpl.UnsafeEnabled { - mi := &file_databroker_proto_msgTypes[14] + mi := &file_databroker_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -863,7 +910,7 @@ func (x *SyncLatestResponse) String() string { func (*SyncLatestResponse) ProtoMessage() {} func (x *SyncLatestResponse) ProtoReflect() protoreflect.Message { - mi := &file_databroker_proto_msgTypes[14] + mi := &file_databroker_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -876,7 +923,7 @@ func (x *SyncLatestResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncLatestResponse.ProtoReflect.Descriptor instead. func (*SyncLatestResponse) Descriptor() ([]byte, []int) { - return file_databroker_proto_rawDescGZIP(), []int{14} + return file_databroker_proto_rawDescGZIP(), []int{15} } func (m *SyncLatestResponse) GetResponse() isSyncLatestResponse_Response { @@ -932,7 +979,7 @@ type AcquireLeaseRequest struct { func (x *AcquireLeaseRequest) Reset() { *x = AcquireLeaseRequest{} if protoimpl.UnsafeEnabled { - mi := &file_databroker_proto_msgTypes[15] + mi := &file_databroker_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -945,7 +992,7 @@ func (x *AcquireLeaseRequest) String() string { func (*AcquireLeaseRequest) ProtoMessage() {} func (x *AcquireLeaseRequest) ProtoReflect() protoreflect.Message { - mi := &file_databroker_proto_msgTypes[15] + mi := &file_databroker_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -958,7 +1005,7 @@ func (x *AcquireLeaseRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AcquireLeaseRequest.ProtoReflect.Descriptor instead. func (*AcquireLeaseRequest) Descriptor() ([]byte, []int) { - return file_databroker_proto_rawDescGZIP(), []int{15} + return file_databroker_proto_rawDescGZIP(), []int{16} } func (x *AcquireLeaseRequest) GetName() string { @@ -988,7 +1035,7 @@ type AcquireLeaseResponse struct { func (x *AcquireLeaseResponse) Reset() { *x = AcquireLeaseResponse{} if protoimpl.UnsafeEnabled { - mi := &file_databroker_proto_msgTypes[16] + mi := &file_databroker_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1001,7 +1048,7 @@ func (x *AcquireLeaseResponse) String() string { func (*AcquireLeaseResponse) ProtoMessage() {} func (x *AcquireLeaseResponse) ProtoReflect() protoreflect.Message { - mi := &file_databroker_proto_msgTypes[16] + mi := &file_databroker_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1014,7 +1061,7 @@ func (x *AcquireLeaseResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use AcquireLeaseResponse.ProtoReflect.Descriptor instead. func (*AcquireLeaseResponse) Descriptor() ([]byte, []int) { - return file_databroker_proto_rawDescGZIP(), []int{16} + return file_databroker_proto_rawDescGZIP(), []int{17} } func (x *AcquireLeaseResponse) GetId() string { @@ -1036,7 +1083,7 @@ type ReleaseLeaseRequest struct { func (x *ReleaseLeaseRequest) Reset() { *x = ReleaseLeaseRequest{} if protoimpl.UnsafeEnabled { - mi := &file_databroker_proto_msgTypes[17] + mi := &file_databroker_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1049,7 +1096,7 @@ func (x *ReleaseLeaseRequest) String() string { func (*ReleaseLeaseRequest) ProtoMessage() {} func (x *ReleaseLeaseRequest) ProtoReflect() protoreflect.Message { - mi := &file_databroker_proto_msgTypes[17] + mi := &file_databroker_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1062,7 +1109,7 @@ func (x *ReleaseLeaseRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ReleaseLeaseRequest.ProtoReflect.Descriptor instead. func (*ReleaseLeaseRequest) Descriptor() ([]byte, []int) { - return file_databroker_proto_rawDescGZIP(), []int{17} + return file_databroker_proto_rawDescGZIP(), []int{18} } func (x *ReleaseLeaseRequest) GetName() string { @@ -1092,7 +1139,7 @@ type RenewLeaseRequest struct { func (x *RenewLeaseRequest) Reset() { *x = RenewLeaseRequest{} if protoimpl.UnsafeEnabled { - mi := &file_databroker_proto_msgTypes[18] + mi := &file_databroker_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1105,7 +1152,7 @@ func (x *RenewLeaseRequest) String() string { func (*RenewLeaseRequest) ProtoMessage() {} func (x *RenewLeaseRequest) ProtoReflect() protoreflect.Message { - mi := &file_databroker_proto_msgTypes[18] + mi := &file_databroker_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1118,7 +1165,7 @@ func (x *RenewLeaseRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use RenewLeaseRequest.ProtoReflect.Descriptor instead. func (*RenewLeaseRequest) Descriptor() ([]byte, []int) { - return file_databroker_proto_rawDescGZIP(), []int{18} + return file_databroker_proto_rawDescGZIP(), []int{19} } func (x *RenewLeaseRequest) GetName() string { @@ -1187,132 +1234,139 @@ var file_databroker_proto_rawDesc = []byte{ 0x69, 0x64, 0x22, 0x39, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 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, 0x22, 0x97, 0x01, - 0x0a, 0x0c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, - 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, - 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, - 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x2f, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, - 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x22, 0xac, 0x01, 0x0a, 0x0d, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x07, 0x72, 0x65, 0x63, - 0x6f, 0x72, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 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, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, - 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x74, 0x6f, - 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x65, 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, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x56, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x0a, 0x0a, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x18, + 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x22, 0x29, 0x0a, + 0x11, 0x4c, 0x69, 0x73, 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, 0x22, 0x97, 0x01, 0x0a, 0x0c, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, + 0x65, 0x72, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, + 0x69, 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, + 0x74, 0x12, 0x2f, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, + 0x65, 0x72, 0x22, 0xac, 0x01, 0x0a, 0x0d, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 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, 0x62, 0x0a, 0x0b, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 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, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 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, 0x56, 0x0a, 0x11, 0x53, 0x65, 0x74, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, - 0x2d, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x13, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x43, - 0x0a, 0x12, 0x53, 0x65, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, - 0x65, 0x72, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x22, 0x6f, 0x0a, 0x0b, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x73, 0x65, 0x72, 0x76, - 0x65, 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, 0x02, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x0d, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x0a, 0x0c, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 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, - 0x22, 0x27, 0x0a, 0x11, 0x53, 0x79, 0x6e, 0x63, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x82, 0x01, 0x0a, 0x12, 0x53, 0x79, - 0x6e, 0x63, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x2c, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x64, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x73, 0x65, 0x72, + 0x76, 0x65, 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, 0x04, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x0d, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x22, 0x3a, 0x0a, 0x0a, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x2c, 0x0a, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x52, 0x65, - 0x63, 0x6f, 0x72, 0x64, 0x48, 0x00, 0x52, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x32, - 0x0a, 0x08, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x14, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x56, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x48, 0x00, 0x52, 0x08, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x73, 0x42, 0x0a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x60, - 0x0a, 0x13, 0x41, 0x63, 0x71, 0x75, 0x69, 0x72, 0x65, 0x4c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x08, 0x64, 0x75, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x22, 0x26, 0x0a, 0x14, 0x41, 0x63, 0x71, 0x75, 0x69, 0x72, 0x65, 0x4c, 0x65, 0x61, 0x73, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x39, 0x0a, 0x13, 0x52, 0x65, 0x6c, 0x65, - 0x61, 0x73, 0x65, 0x4c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x02, 0x69, 0x64, 0x22, 0x6e, 0x0a, 0x11, 0x52, 0x65, 0x6e, 0x65, 0x77, 0x4c, 0x65, 0x61, 0x73, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, - 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x35, 0x0a, 0x08, - 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x32, 0xfb, 0x04, 0x0a, 0x11, 0x44, 0x61, 0x74, 0x61, 0x42, 0x72, 0x6f, 0x6b, - 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x51, 0x0a, 0x0c, 0x41, 0x63, 0x71, - 0x75, 0x69, 0x72, 0x65, 0x4c, 0x65, 0x61, 0x73, 0x65, 0x12, 0x1f, 0x2e, 0x64, 0x61, 0x74, 0x61, - 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x41, 0x63, 0x71, 0x75, 0x69, 0x72, 0x65, 0x4c, 0x65, - 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x64, 0x61, 0x74, - 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x41, 0x63, 0x71, 0x75, 0x69, 0x72, 0x65, 0x4c, - 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 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, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x64, 0x61, - 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x03, 0x50, 0x75, 0x74, 0x12, 0x16, 0x2e, 0x64, 0x61, - 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, - 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x05, - 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x18, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, - 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x19, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0c, 0x52, 0x65, - 0x6c, 0x65, 0x61, 0x73, 0x65, 0x4c, 0x65, 0x61, 0x73, 0x65, 0x12, 0x1f, 0x2e, 0x64, 0x61, 0x74, - 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x4c, - 0x65, 0x61, 0x73, 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, 0x43, 0x0a, 0x0a, 0x52, 0x65, 0x6e, 0x65, 0x77, 0x4c, 0x65, 0x61, 0x73, - 0x65, 0x12, 0x1d, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x52, - 0x65, 0x6e, 0x65, 0x77, 0x4c, 0x65, 0x61, 0x73, 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, 0x4b, 0x0a, 0x0a, 0x53, 0x65, 0x74, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1d, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, - 0x6b, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, - 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x04, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x17, 0x2e, - 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, - 0x6b, 0x65, 0x72, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x30, 0x01, 0x12, 0x4d, 0x0a, 0x0a, 0x53, 0x79, 0x6e, 0x63, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, - 0x12, 0x1d, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x53, 0x79, - 0x6e, 0x63, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x1e, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x53, 0x79, 0x6e, - 0x63, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 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, + 0x63, 0x6f, 0x72, 0x64, 0x52, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, 0x62, 0x0a, + 0x0b, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x25, 0x0a, 0x0e, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x04, 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, 0x02, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 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, 0x56, 0x0a, 0x11, 0x53, 0x65, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2d, 0x0a, 0x07, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x64, 0x61, + 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x43, 0x0a, 0x12, 0x53, 0x65, 0x74, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x2d, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x13, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x6f, + 0x0a, 0x0b, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x25, 0x0a, + 0x0e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x65, 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, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x72, 0x65, + 0x63, 0x6f, 0x72, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, + 0x3a, 0x0a, 0x0c, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 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, 0x22, 0x27, 0x0a, 0x11, 0x53, + 0x79, 0x6e, 0x63, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x74, 0x79, 0x70, 0x65, 0x22, 0x82, 0x01, 0x0a, 0x12, 0x53, 0x79, 0x6e, 0x63, 0x4c, 0x61, 0x74, + 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 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, 0x48, + 0x00, 0x52, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x32, 0x0a, 0x08, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x64, 0x61, + 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x73, 0x48, 0x00, 0x52, 0x08, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x0a, 0x0a, + 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x60, 0x0a, 0x13, 0x41, 0x63, 0x71, + 0x75, 0x69, 0x72, 0x65, 0x4c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x26, 0x0a, 0x14, 0x41, + 0x63, 0x71, 0x75, 0x69, 0x72, 0x65, 0x4c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x02, 0x69, 0x64, 0x22, 0x39, 0x0a, 0x13, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x4c, 0x65, + 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x6e, + 0x0a, 0x11, 0x52, 0x65, 0x6e, 0x65, 0x77, 0x4c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x35, 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0xbf, + 0x05, 0x0a, 0x11, 0x44, 0x61, 0x74, 0x61, 0x42, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x51, 0x0a, 0x0c, 0x41, 0x63, 0x71, 0x75, 0x69, 0x72, 0x65, 0x4c, + 0x65, 0x61, 0x73, 0x65, 0x12, 0x1f, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, + 0x72, 0x2e, 0x41, 0x63, 0x71, 0x75, 0x69, 0x72, 0x65, 0x4c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, + 0x65, 0x72, 0x2e, 0x41, 0x63, 0x71, 0x75, 0x69, 0x72, 0x65, 0x4c, 0x65, 0x61, 0x73, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 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, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, + 0x6b, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x42, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x12, 0x16, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, + 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1d, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, + 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x03, 0x50, 0x75, 0x74, 0x12, 0x16, 0x2e, 0x64, 0x61, 0x74, + 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, + 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x05, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x12, 0x18, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, + 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, + 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0c, 0x52, 0x65, 0x6c, + 0x65, 0x61, 0x73, 0x65, 0x4c, 0x65, 0x61, 0x73, 0x65, 0x12, 0x1f, 0x2e, 0x64, 0x61, 0x74, 0x61, + 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x4c, 0x65, + 0x61, 0x73, 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, 0x43, 0x0a, 0x0a, 0x52, 0x65, 0x6e, 0x65, 0x77, 0x4c, 0x65, 0x61, 0x73, 0x65, + 0x12, 0x1d, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x52, 0x65, + 0x6e, 0x65, 0x77, 0x4c, 0x65, 0x61, 0x73, 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, 0x4b, 0x0a, 0x0a, 0x53, 0x65, 0x74, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1d, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, + 0x65, 0x72, 0x2e, 0x53, 0x65, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, + 0x72, 0x2e, 0x53, 0x65, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x04, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x17, 0x2e, 0x64, + 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, + 0x65, 0x72, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, + 0x01, 0x12, 0x4d, 0x0a, 0x0a, 0x53, 0x79, 0x6e, 0x63, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x12, + 0x1d, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x53, 0x79, 0x6e, + 0x63, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, + 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x2e, 0x53, 0x79, 0x6e, 0x63, + 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 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 ( @@ -1327,39 +1381,40 @@ func file_databroker_proto_rawDescGZIP() []byte { return file_databroker_proto_rawDescData } -var file_databroker_proto_msgTypes = make([]protoimpl.MessageInfo, 19) +var file_databroker_proto_msgTypes = make([]protoimpl.MessageInfo, 20) var file_databroker_proto_goTypes = []interface{}{ (*Record)(nil), // 0: databroker.Record (*Versions)(nil), // 1: databroker.Versions (*Options)(nil), // 2: databroker.Options (*GetRequest)(nil), // 3: databroker.GetRequest (*GetResponse)(nil), // 4: databroker.GetResponse - (*QueryRequest)(nil), // 5: databroker.QueryRequest - (*QueryResponse)(nil), // 6: databroker.QueryResponse - (*PutRequest)(nil), // 7: databroker.PutRequest - (*PutResponse)(nil), // 8: databroker.PutResponse - (*SetOptionsRequest)(nil), // 9: databroker.SetOptionsRequest - (*SetOptionsResponse)(nil), // 10: databroker.SetOptionsResponse - (*SyncRequest)(nil), // 11: databroker.SyncRequest - (*SyncResponse)(nil), // 12: databroker.SyncResponse - (*SyncLatestRequest)(nil), // 13: databroker.SyncLatestRequest - (*SyncLatestResponse)(nil), // 14: databroker.SyncLatestResponse - (*AcquireLeaseRequest)(nil), // 15: databroker.AcquireLeaseRequest - (*AcquireLeaseResponse)(nil), // 16: databroker.AcquireLeaseResponse - (*ReleaseLeaseRequest)(nil), // 17: databroker.ReleaseLeaseRequest - (*RenewLeaseRequest)(nil), // 18: databroker.RenewLeaseRequest - (*anypb.Any)(nil), // 19: google.protobuf.Any - (*timestamppb.Timestamp)(nil), // 20: google.protobuf.Timestamp - (*structpb.Struct)(nil), // 21: google.protobuf.Struct - (*durationpb.Duration)(nil), // 22: google.protobuf.Duration - (*emptypb.Empty)(nil), // 23: google.protobuf.Empty + (*ListTypesResponse)(nil), // 5: databroker.ListTypesResponse + (*QueryRequest)(nil), // 6: databroker.QueryRequest + (*QueryResponse)(nil), // 7: databroker.QueryResponse + (*PutRequest)(nil), // 8: databroker.PutRequest + (*PutResponse)(nil), // 9: databroker.PutResponse + (*SetOptionsRequest)(nil), // 10: databroker.SetOptionsRequest + (*SetOptionsResponse)(nil), // 11: databroker.SetOptionsResponse + (*SyncRequest)(nil), // 12: databroker.SyncRequest + (*SyncResponse)(nil), // 13: databroker.SyncResponse + (*SyncLatestRequest)(nil), // 14: databroker.SyncLatestRequest + (*SyncLatestResponse)(nil), // 15: databroker.SyncLatestResponse + (*AcquireLeaseRequest)(nil), // 16: databroker.AcquireLeaseRequest + (*AcquireLeaseResponse)(nil), // 17: databroker.AcquireLeaseResponse + (*ReleaseLeaseRequest)(nil), // 18: databroker.ReleaseLeaseRequest + (*RenewLeaseRequest)(nil), // 19: databroker.RenewLeaseRequest + (*anypb.Any)(nil), // 20: google.protobuf.Any + (*timestamppb.Timestamp)(nil), // 21: google.protobuf.Timestamp + (*structpb.Struct)(nil), // 22: google.protobuf.Struct + (*durationpb.Duration)(nil), // 23: google.protobuf.Duration + (*emptypb.Empty)(nil), // 24: google.protobuf.Empty } var file_databroker_proto_depIdxs = []int32{ - 19, // 0: databroker.Record.data:type_name -> google.protobuf.Any - 20, // 1: databroker.Record.modified_at:type_name -> google.protobuf.Timestamp - 20, // 2: databroker.Record.deleted_at:type_name -> google.protobuf.Timestamp + 20, // 0: databroker.Record.data:type_name -> google.protobuf.Any + 21, // 1: databroker.Record.modified_at:type_name -> google.protobuf.Timestamp + 21, // 2: databroker.Record.deleted_at:type_name -> google.protobuf.Timestamp 0, // 3: databroker.GetResponse.record:type_name -> databroker.Record - 21, // 4: databroker.QueryRequest.filter:type_name -> google.protobuf.Struct + 22, // 4: databroker.QueryRequest.filter:type_name -> google.protobuf.Struct 0, // 5: databroker.QueryResponse.records:type_name -> databroker.Record 0, // 6: databroker.PutRequest.records:type_name -> databroker.Record 0, // 7: databroker.PutResponse.records:type_name -> databroker.Record @@ -1368,28 +1423,30 @@ var file_databroker_proto_depIdxs = []int32{ 0, // 10: databroker.SyncResponse.record:type_name -> databroker.Record 0, // 11: databroker.SyncLatestResponse.record:type_name -> databroker.Record 1, // 12: databroker.SyncLatestResponse.versions:type_name -> databroker.Versions - 22, // 13: databroker.AcquireLeaseRequest.duration:type_name -> google.protobuf.Duration - 22, // 14: databroker.RenewLeaseRequest.duration:type_name -> google.protobuf.Duration - 15, // 15: databroker.DataBrokerService.AcquireLease:input_type -> databroker.AcquireLeaseRequest + 23, // 13: databroker.AcquireLeaseRequest.duration:type_name -> google.protobuf.Duration + 23, // 14: databroker.RenewLeaseRequest.duration:type_name -> google.protobuf.Duration + 16, // 15: databroker.DataBrokerService.AcquireLease:input_type -> databroker.AcquireLeaseRequest 3, // 16: databroker.DataBrokerService.Get:input_type -> databroker.GetRequest - 7, // 17: databroker.DataBrokerService.Put:input_type -> databroker.PutRequest - 5, // 18: databroker.DataBrokerService.Query:input_type -> databroker.QueryRequest - 17, // 19: databroker.DataBrokerService.ReleaseLease:input_type -> databroker.ReleaseLeaseRequest - 18, // 20: databroker.DataBrokerService.RenewLease:input_type -> databroker.RenewLeaseRequest - 9, // 21: databroker.DataBrokerService.SetOptions:input_type -> databroker.SetOptionsRequest - 11, // 22: databroker.DataBrokerService.Sync:input_type -> databroker.SyncRequest - 13, // 23: databroker.DataBrokerService.SyncLatest:input_type -> databroker.SyncLatestRequest - 16, // 24: databroker.DataBrokerService.AcquireLease:output_type -> databroker.AcquireLeaseResponse - 4, // 25: databroker.DataBrokerService.Get:output_type -> databroker.GetResponse - 8, // 26: databroker.DataBrokerService.Put:output_type -> databroker.PutResponse - 6, // 27: databroker.DataBrokerService.Query:output_type -> databroker.QueryResponse - 23, // 28: databroker.DataBrokerService.ReleaseLease:output_type -> google.protobuf.Empty - 23, // 29: databroker.DataBrokerService.RenewLease:output_type -> google.protobuf.Empty - 10, // 30: databroker.DataBrokerService.SetOptions:output_type -> databroker.SetOptionsResponse - 12, // 31: databroker.DataBrokerService.Sync:output_type -> databroker.SyncResponse - 14, // 32: databroker.DataBrokerService.SyncLatest:output_type -> databroker.SyncLatestResponse - 24, // [24:33] is the sub-list for method output_type - 15, // [15:24] is the sub-list for method input_type + 24, // 17: databroker.DataBrokerService.ListTypes:input_type -> google.protobuf.Empty + 8, // 18: databroker.DataBrokerService.Put:input_type -> databroker.PutRequest + 6, // 19: databroker.DataBrokerService.Query:input_type -> databroker.QueryRequest + 18, // 20: databroker.DataBrokerService.ReleaseLease:input_type -> databroker.ReleaseLeaseRequest + 19, // 21: databroker.DataBrokerService.RenewLease:input_type -> databroker.RenewLeaseRequest + 10, // 22: databroker.DataBrokerService.SetOptions:input_type -> databroker.SetOptionsRequest + 12, // 23: databroker.DataBrokerService.Sync:input_type -> databroker.SyncRequest + 14, // 24: databroker.DataBrokerService.SyncLatest:input_type -> databroker.SyncLatestRequest + 17, // 25: databroker.DataBrokerService.AcquireLease:output_type -> databroker.AcquireLeaseResponse + 4, // 26: databroker.DataBrokerService.Get:output_type -> databroker.GetResponse + 5, // 27: databroker.DataBrokerService.ListTypes:output_type -> databroker.ListTypesResponse + 9, // 28: databroker.DataBrokerService.Put:output_type -> databroker.PutResponse + 7, // 29: databroker.DataBrokerService.Query:output_type -> databroker.QueryResponse + 24, // 30: databroker.DataBrokerService.ReleaseLease:output_type -> google.protobuf.Empty + 24, // 31: databroker.DataBrokerService.RenewLease:output_type -> google.protobuf.Empty + 11, // 32: databroker.DataBrokerService.SetOptions:output_type -> databroker.SetOptionsResponse + 13, // 33: databroker.DataBrokerService.Sync:output_type -> databroker.SyncResponse + 15, // 34: databroker.DataBrokerService.SyncLatest:output_type -> databroker.SyncLatestResponse + 25, // [25:35] is the sub-list for method output_type + 15, // [15:25] is the sub-list for method input_type 15, // [15:15] is the sub-list for extension type_name 15, // [15:15] is the sub-list for extension extendee 0, // [0:15] is the sub-list for field type_name @@ -1462,7 +1519,7 @@ func file_databroker_proto_init() { } } file_databroker_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryRequest); i { + switch v := v.(*ListTypesResponse); i { case 0: return &v.state case 1: @@ -1474,7 +1531,7 @@ func file_databroker_proto_init() { } } file_databroker_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryResponse); i { + switch v := v.(*QueryRequest); i { case 0: return &v.state case 1: @@ -1486,7 +1543,7 @@ func file_databroker_proto_init() { } } file_databroker_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutRequest); i { + switch v := v.(*QueryResponse); i { case 0: return &v.state case 1: @@ -1498,7 +1555,7 @@ func file_databroker_proto_init() { } } file_databroker_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutResponse); i { + switch v := v.(*PutRequest); i { case 0: return &v.state case 1: @@ -1510,7 +1567,7 @@ func file_databroker_proto_init() { } } file_databroker_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SetOptionsRequest); i { + switch v := v.(*PutResponse); i { case 0: return &v.state case 1: @@ -1522,7 +1579,7 @@ func file_databroker_proto_init() { } } file_databroker_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SetOptionsResponse); i { + switch v := v.(*SetOptionsRequest); i { case 0: return &v.state case 1: @@ -1534,7 +1591,7 @@ func file_databroker_proto_init() { } } file_databroker_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncRequest); i { + switch v := v.(*SetOptionsResponse); i { case 0: return &v.state case 1: @@ -1546,7 +1603,7 @@ func file_databroker_proto_init() { } } file_databroker_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncResponse); i { + switch v := v.(*SyncRequest); i { case 0: return &v.state case 1: @@ -1558,7 +1615,7 @@ func file_databroker_proto_init() { } } file_databroker_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncLatestRequest); i { + switch v := v.(*SyncResponse); i { case 0: return &v.state case 1: @@ -1570,7 +1627,7 @@ func file_databroker_proto_init() { } } file_databroker_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncLatestResponse); i { + switch v := v.(*SyncLatestRequest); i { case 0: return &v.state case 1: @@ -1582,7 +1639,7 @@ func file_databroker_proto_init() { } } file_databroker_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AcquireLeaseRequest); i { + switch v := v.(*SyncLatestResponse); i { case 0: return &v.state case 1: @@ -1594,7 +1651,7 @@ func file_databroker_proto_init() { } } file_databroker_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AcquireLeaseResponse); i { + switch v := v.(*AcquireLeaseRequest); i { case 0: return &v.state case 1: @@ -1606,7 +1663,7 @@ func file_databroker_proto_init() { } } file_databroker_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReleaseLeaseRequest); i { + switch v := v.(*AcquireLeaseResponse); i { case 0: return &v.state case 1: @@ -1618,6 +1675,18 @@ func file_databroker_proto_init() { } } file_databroker_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReleaseLeaseRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_databroker_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RenewLeaseRequest); i { case 0: return &v.state @@ -1631,7 +1700,7 @@ func file_databroker_proto_init() { } } file_databroker_proto_msgTypes[2].OneofWrappers = []interface{}{} - file_databroker_proto_msgTypes[14].OneofWrappers = []interface{}{ + file_databroker_proto_msgTypes[15].OneofWrappers = []interface{}{ (*SyncLatestResponse_Record)(nil), (*SyncLatestResponse_Versions)(nil), } @@ -1641,7 +1710,7 @@ func file_databroker_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_databroker_proto_rawDesc, NumEnums: 0, - NumMessages: 19, + NumMessages: 20, NumExtensions: 0, NumServices: 1, }, @@ -1671,6 +1740,8 @@ type DataBrokerServiceClient interface { AcquireLease(ctx context.Context, in *AcquireLeaseRequest, opts ...grpc.CallOption) (*AcquireLeaseResponse, error) // Get gets a record. Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) + // ListTypes lists all the known record types. + ListTypes(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ListTypesResponse, error) // Put saves a record. Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) // Query queries for records. @@ -1713,6 +1784,15 @@ func (c *dataBrokerServiceClient) Get(ctx context.Context, in *GetRequest, opts return out, nil } +func (c *dataBrokerServiceClient) ListTypes(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ListTypesResponse, error) { + out := new(ListTypesResponse) + err := c.cc.Invoke(ctx, "/databroker.DataBrokerService/ListTypes", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *dataBrokerServiceClient) Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) { out := new(PutResponse) err := c.cc.Invoke(ctx, "/databroker.DataBrokerService/Put", in, out, opts...) @@ -1828,6 +1908,8 @@ type DataBrokerServiceServer interface { AcquireLease(context.Context, *AcquireLeaseRequest) (*AcquireLeaseResponse, error) // Get gets a record. Get(context.Context, *GetRequest) (*GetResponse, error) + // ListTypes lists all the known record types. + ListTypes(context.Context, *emptypb.Empty) (*ListTypesResponse, error) // Put saves a record. Put(context.Context, *PutRequest) (*PutResponse, error) // Query queries for records. @@ -1854,6 +1936,9 @@ func (*UnimplementedDataBrokerServiceServer) AcquireLease(context.Context, *Acqu func (*UnimplementedDataBrokerServiceServer) Get(context.Context, *GetRequest) (*GetResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Get not implemented") } +func (*UnimplementedDataBrokerServiceServer) ListTypes(context.Context, *emptypb.Empty) (*ListTypesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListTypes not implemented") +} func (*UnimplementedDataBrokerServiceServer) Put(context.Context, *PutRequest) (*PutResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Put not implemented") } @@ -1916,6 +2001,24 @@ func _DataBrokerService_Get_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } +func _DataBrokerService_ListTypes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(emptypb.Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DataBrokerServiceServer).ListTypes(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/databroker.DataBrokerService/ListTypes", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DataBrokerServiceServer).ListTypes(ctx, req.(*emptypb.Empty)) + } + return interceptor(ctx, in, info, handler) +} + func _DataBrokerService_Put_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(PutRequest) if err := dec(in); err != nil { @@ -2060,6 +2163,10 @@ var _DataBrokerService_serviceDesc = grpc.ServiceDesc{ MethodName: "Get", Handler: _DataBrokerService_Get_Handler, }, + { + MethodName: "ListTypes", + Handler: _DataBrokerService_ListTypes_Handler, + }, { MethodName: "Put", Handler: _DataBrokerService_Put_Handler, diff --git a/pkg/grpc/databroker/databroker.proto b/pkg/grpc/databroker/databroker.proto index 1fde8a15f..bae04b7fc 100644 --- a/pkg/grpc/databroker/databroker.proto +++ b/pkg/grpc/databroker/databroker.proto @@ -36,6 +36,10 @@ message GetRequest { } message GetResponse { Record record = 1; } +message ListTypesResponse { + repeated string types = 1; +} + message QueryRequest { string type = 1; string query = 2; @@ -106,6 +110,8 @@ service DataBrokerService { rpc AcquireLease(AcquireLeaseRequest) returns (AcquireLeaseResponse); // Get gets a record. rpc Get(GetRequest) returns (GetResponse); + // ListTypes lists all the known record types. + rpc ListTypes(google.protobuf.Empty) returns (ListTypesResponse); // Put saves a record. rpc Put(PutRequest) returns (PutResponse); // Query queries for records. diff --git a/pkg/grpc/databroker/mock_databroker/databroker.pb.go b/pkg/grpc/databroker/mock_databroker/databroker.pb.go index 0d4d5bb21..1b23bcab8 100644 --- a/pkg/grpc/databroker/mock_databroker/databroker.pb.go +++ b/pkg/grpc/databroker/mock_databroker/databroker.pb.go @@ -113,6 +113,26 @@ func (mr *MockDataBrokerServiceClientMockRecorder) Get(ctx, in interface{}, opts return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockDataBrokerServiceClient)(nil).Get), varargs...) } +// ListTypes mocks base method. +func (m *MockDataBrokerServiceClient) ListTypes(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*databroker.ListTypesResponse, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListTypes", varargs...) + ret0, _ := ret[0].(*databroker.ListTypesResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListTypes indicates an expected call of ListTypes. +func (mr *MockDataBrokerServiceClientMockRecorder) ListTypes(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTypes", reflect.TypeOf((*MockDataBrokerServiceClient)(nil).ListTypes), varargs...) +} + // Put mocks base method. func (m *MockDataBrokerServiceClient) Put(ctx context.Context, in *databroker.PutRequest, opts ...grpc.CallOption) (*databroker.PutResponse, error) { m.ctrl.T.Helper() @@ -552,6 +572,21 @@ func (mr *MockDataBrokerServiceServerMockRecorder) Get(arg0, arg1 interface{}) * return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockDataBrokerServiceServer)(nil).Get), arg0, arg1) } +// ListTypes mocks base method. +func (m *MockDataBrokerServiceServer) ListTypes(arg0 context.Context, arg1 *emptypb.Empty) (*databroker.ListTypesResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListTypes", arg0, arg1) + ret0, _ := ret[0].(*databroker.ListTypesResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListTypes indicates an expected call of ListTypes. +func (mr *MockDataBrokerServiceServerMockRecorder) ListTypes(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTypes", reflect.TypeOf((*MockDataBrokerServiceServer)(nil).ListTypes), arg0, arg1) +} + // Put mocks base method. func (m *MockDataBrokerServiceServer) Put(arg0 context.Context, arg1 *databroker.PutRequest) (*databroker.PutResponse, error) { m.ctrl.T.Helper() diff --git a/pkg/storage/encrypted.go b/pkg/storage/encrypted.go index cd77fcb1b..6ab9e8235 100644 --- a/pkg/storage/encrypted.go +++ b/pkg/storage/encrypted.go @@ -89,6 +89,10 @@ func (e *encryptedBackend) Lease(ctx context.Context, leaseName, leaseID string, return e.underlying.Lease(ctx, leaseName, leaseID, ttl) } +func (e *encryptedBackend) ListTypes(ctx context.Context) ([]string, error) { + return e.underlying.ListTypes(ctx) +} + func (e *encryptedBackend) Put(ctx context.Context, records []*databroker.Record) (uint64, error) { encryptedRecords := make([]*databroker.Record, len(records)) for i, record := range records { diff --git a/pkg/storage/inmemory/backend.go b/pkg/storage/inmemory/backend.go index 3d681c35c..5a4fd7a7f 100644 --- a/pkg/storage/inmemory/backend.go +++ b/pkg/storage/inmemory/backend.go @@ -4,12 +4,14 @@ package inmemory import ( "context" "fmt" + "sort" "sync" "sync/atomic" "time" "github.com/google/btree" "github.com/rs/zerolog" + "golang.org/x/exp/maps" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/timestamppb" @@ -186,6 +188,16 @@ func (backend *Backend) Lease(_ context.Context, leaseName, leaseID string, ttl return true, nil } +// ListTypes lists the record types. +func (backend *Backend) ListTypes(ctx context.Context) ([]string, error) { + backend.mu.Lock() + keys := maps.Keys(backend.lookup) + backend.mu.Unlock() + + sort.Strings(keys) + return keys, nil +} + // Put puts a record into the in-memory store. func (backend *Backend) Put(ctx context.Context, records []*databroker.Record) (serverVersion uint64, err error) { backend.mu.Lock() diff --git a/pkg/storage/postgres/backend.go b/pkg/storage/postgres/backend.go index dc25afb99..306142460 100644 --- a/pkg/storage/postgres/backend.go +++ b/pkg/storage/postgres/backend.go @@ -181,6 +181,19 @@ func (backend *Backend) Lease( return leaseHolderID == leaseID, nil } +// ListTypes lists the record types. +func (backend *Backend) ListTypes(ctx context.Context) ([]string, error) { + ctx, cancel := contextutil.Merge(ctx, backend.closeCtx) + defer cancel() + + _, conn, err := backend.init(ctx) + if err != nil { + return nil, err + } + + return listTypes(ctx, conn) +} + // Put puts a record into Postgres. func (backend *Backend) Put( ctx context.Context, diff --git a/pkg/storage/postgres/backend_test.go b/pkg/storage/postgres/backend_test.go index 16c6dace3..6d82b4bbc 100644 --- a/pkg/storage/postgres/backend_test.go +++ b/pkg/storage/postgres/backend_test.go @@ -182,6 +182,12 @@ func TestBackend(t *testing.T) { } }) + t.Run("list types", func(t *testing.T) { + types, err := backend.ListTypes(ctx) + assert.NoError(t, err) + assert.Equal(t, []string{"capacity-test", "latest-test", "sync-test", "test-1", "unknown"}, types) + }) + return nil })) } diff --git a/pkg/storage/postgres/postgres.go b/pkg/storage/postgres/postgres.go index ed561fcc6..6dcfdb868 100644 --- a/pkg/storage/postgres/postgres.go +++ b/pkg/storage/postgres/postgres.go @@ -5,6 +5,7 @@ import ( "context" "errors" "fmt" + "sort" "strings" "time" @@ -284,6 +285,36 @@ func listServices(ctx context.Context, q querier) ([]*registry.Service, error) { return services, nil } +func listTypes(ctx context.Context, q querier) ([]string, error) { + query := ` + SELECT DISTINCT type + FROM ` + schemaName + `.` + recordsTableName + ` + ` + rows, err := q.Query(ctx, query) + if err != nil { + return nil, fmt.Errorf("postgres: failed to execute query: %w", err) + } + defer rows.Close() + + var types []string + for rows.Next() { + var recordType string + err = rows.Scan(&recordType) + if err != nil { + return nil, fmt.Errorf("postgres: failed to scan row: %w", err) + } + + types = append(types, recordType) + } + err = rows.Err() + if err != nil { + return nil, fmt.Errorf("postgres: error iterating over rows: %w", err) + } + + sort.Strings(types) + return types, nil +} + func maybeAcquireLease(ctx context.Context, q querier, leaseName, leaseID string, ttl time.Duration) (leaseHolderID string, err error) { tbl := schemaName + "." + leasesTableName expiresAt := timestamptzFromTimestamppb(timestamppb.New(time.Now().Add(ttl))) diff --git a/pkg/storage/redis/redis.go b/pkg/storage/redis/redis.go index cbf46a082..c91bbf6dd 100644 --- a/pkg/storage/redis/redis.go +++ b/pkg/storage/redis/redis.go @@ -5,6 +5,7 @@ import ( "context" "errors" "fmt" + "sort" "sync" "time" @@ -29,15 +30,16 @@ const ( // we rely on transactions in redis, so all redis-cluster keys need to be // on the same node. Using a `hash tag` gives us this capability. - serverVersionKey = redisutil.KeyPrefix + "server_version" - lastVersionKey = redisutil.KeyPrefix + "last_version" - lastVersionChKey = redisutil.KeyPrefix + "last_version_ch" - recordHashKey = redisutil.KeyPrefix + "records" - changesSetKey = redisutil.KeyPrefix + "changes" - optionsKey = redisutil.KeyPrefix + "options" + serverVersionKey = redisutil.KeyPrefix + "server_version" + lastVersionKey = redisutil.KeyPrefix + "last_version" + lastVersionChKey = redisutil.KeyPrefix + "last_version_ch" + recordHashKey = redisutil.KeyPrefix + "records" + recordTypesSetKey = redisutil.KeyPrefix + "record_types" + changesSetKey = redisutil.KeyPrefix + "changes" + optionsKey = redisutil.KeyPrefix + "options" recordTypeChangesKeyTpl = redisutil.KeyPrefix + "changes.%s" - leaseKeyTpl = "{pomerium_v3}.lease.%s" + leaseKeyTpl = redisutil.KeyPrefix + "lease.%s" ) // custom errors @@ -192,6 +194,21 @@ func (backend *Backend) Lease(ctx context.Context, leaseName, leaseID string, tt return acquired, err } +// ListTypes lists all the known record types. +func (backend *Backend) ListTypes(ctx context.Context) (types []string, err error) { + ctx, span := trace.StartSpan(ctx, "databroker.redis.ListTypes") + defer span.End() + defer func(start time.Time) { recordOperation(ctx, start, "listTypes", err) }(time.Now()) + + cmd := backend.client.SMembers(ctx, recordTypesSetKey) + types, err = cmd.Result() + if err != nil { + return nil, err + } + sort.Strings(types) + return types, err +} + // Put puts a record into redis. func (backend *Backend) Put(ctx context.Context, records []*databroker.Record) (serverVersion uint64, err error) { ctx, span := trace.StartSpan(ctx, "databroker.redis.Put") @@ -310,6 +327,7 @@ func (backend *Backend) put(ctx context.Context, records []*databroker.Record) e Score: float64(version) + float64(i), Member: bs, }) + p.SAdd(ctx, recordTypesSetKey, record.GetType()) } return nil }) diff --git a/pkg/storage/redis/redis_test.go b/pkg/storage/redis/redis_test.go index d6ea506be..fb7ca2d36 100644 --- a/pkg/storage/redis/redis_test.go +++ b/pkg/storage/redis/redis_test.go @@ -75,6 +75,11 @@ func TestBackend(t *testing.T) { assert.Error(t, err) assert.Nil(t, record) }) + t.Run("list types", func(t *testing.T) { + types, err := backend.ListTypes(ctx) + assert.NoError(t, err) + assert.Equal(t, []string{"TYPE"}, types) + }) return nil } diff --git a/pkg/storage/storage.go b/pkg/storage/storage.go index 634d79982..170c43fa7 100644 --- a/pkg/storage/storage.go +++ b/pkg/storage/storage.go @@ -33,6 +33,8 @@ type Backend interface { GetOptions(ctx context.Context, recordType string) (*databroker.Options, error) // Lease acquires a lease, or renews an existing one. If the lease is acquired true is returned. Lease(ctx context.Context, leaseName, leaseID string, ttl time.Duration) (bool, error) + // ListTypes lists all the known record types. + ListTypes(ctx context.Context) ([]string, error) // Put is used to insert or update records. Put(ctx context.Context, records []*databroker.Record) (serverVersion uint64, err error) // SetOptions sets the options for a type.