From 583497a46efd88c99ab55922c3824e489e91ffab Mon Sep 17 00:00:00 2001 From: Matteo Merli Date: Thu, 3 Oct 2024 08:26:32 -0700 Subject: [PATCH] Protobuf changes for secondary indexes (#541) --- proto/client.pb.go | 147 +++++++---- proto/client.proto | 6 + proto/client_vtproto.pb.go | 484 ++++++++++++++++++++++++++++++++++++ proto/storage.pb.go | 117 +++++---- proto/storage.proto | 2 + proto/storage_vtproto.pb.go | 308 +++++++++++++++++++++++ 6 files changed, 965 insertions(+), 99 deletions(-) diff --git a/proto/client.pb.go b/proto/client.pb.go index ba74247d..a76ab66d 100644 --- a/proto/client.pb.go +++ b/proto/client.pb.go @@ -857,7 +857,8 @@ type PutRequest struct { PartitionKey *string `protobuf:"bytes,6,opt,name=partition_key,json=partitionKey,proto3,oneof" json:"partition_key,omitempty"` // If one or more sequence key are specified. The key will get added suffixes // based on adding the delta to the current highest key with the same prefix - SequenceKeyDelta []uint64 `protobuf:"varint,7,rep,packed,name=sequence_key_delta,json=sequenceKeyDelta,proto3" json:"sequence_key_delta,omitempty"` + SequenceKeyDelta []uint64 `protobuf:"varint,7,rep,packed,name=sequence_key_delta,json=sequenceKeyDelta,proto3" json:"sequence_key_delta,omitempty"` + SecondaryIndexes map[string]string `protobuf:"bytes,8,rep,name=secondary_indexes,json=secondaryIndexes,proto3" json:"secondary_indexes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *PutRequest) Reset() { @@ -941,6 +942,13 @@ func (x *PutRequest) GetSequenceKeyDelta() []uint64 { return nil } +func (x *PutRequest) GetSecondaryIndexes() map[string]string { + if x != nil { + return x.SecondaryIndexes + } + return nil +} + // * // The response to a put request. type PutResponse struct { @@ -1389,7 +1397,8 @@ type ListRequest struct { // The start of the range, inclusive StartInclusive string `protobuf:"bytes,2,opt,name=start_inclusive,json=startInclusive,proto3" json:"start_inclusive,omitempty"` // The end of the range, exclusive - EndExclusive string `protobuf:"bytes,3,opt,name=end_exclusive,json=endExclusive,proto3" json:"end_exclusive,omitempty"` + EndExclusive string `protobuf:"bytes,3,opt,name=end_exclusive,json=endExclusive,proto3" json:"end_exclusive,omitempty"` + SecondaryIndexName *string `protobuf:"bytes,4,opt,name=secondary_index_name,json=secondaryIndexName,proto3,oneof" json:"secondary_index_name,omitempty"` } func (x *ListRequest) Reset() { @@ -1445,6 +1454,13 @@ func (x *ListRequest) GetEndExclusive() string { return "" } +func (x *ListRequest) GetSecondaryIndexName() string { + if x != nil && x.SecondaryIndexName != nil { + return *x.SecondaryIndexName + } + return "" +} + // * // The response to a list request. type ListResponse struct { @@ -1508,7 +1524,8 @@ type RangeScanRequest struct { // The start of the range, inclusive StartInclusive string `protobuf:"bytes,2,opt,name=start_inclusive,json=startInclusive,proto3" json:"start_inclusive,omitempty"` // The end of the range, exclusive - EndExclusive string `protobuf:"bytes,3,opt,name=end_exclusive,json=endExclusive,proto3" json:"end_exclusive,omitempty"` + EndExclusive string `protobuf:"bytes,3,opt,name=end_exclusive,json=endExclusive,proto3" json:"end_exclusive,omitempty"` + SecondaryIndexName *string `protobuf:"bytes,4,opt,name=secondary_index_name,json=secondaryIndexName,proto3,oneof" json:"secondary_index_name,omitempty"` } func (x *RangeScanRequest) Reset() { @@ -1564,6 +1581,13 @@ func (x *RangeScanRequest) GetEndExclusive() string { return "" } +func (x *RangeScanRequest) GetSecondaryIndexName() string { + if x != nil && x.SecondaryIndexName != nil { + return *x.SecondaryIndexName + } + return "" +} + // * // The response to a range-scan request. type RangeScanResponse struct { @@ -2291,7 +2315,7 @@ var file_client_proto_rawDesc = []byte{ 0x32, 0x27, 0x2e, 0x69, 0x6f, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x6f, 0x78, 0x69, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x04, 0x67, 0x65, 0x74, 0x73, 0x22, - 0xe0, 0x02, 0x0a, 0x0a, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, + 0x90, 0x04, 0x0a, 0x0a, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x33, 0x0a, 0x13, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, @@ -2308,7 +2332,18 @@ var file_client_proto_rawDesc = []byte{ 0x6e, 0x4b, 0x65, 0x79, 0x88, 0x01, 0x01, 0x12, 0x2c, 0x0a, 0x12, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x18, 0x07, 0x20, 0x03, 0x28, 0x04, 0x52, 0x10, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4b, 0x65, 0x79, - 0x44, 0x65, 0x6c, 0x74, 0x61, 0x42, 0x16, 0x0a, 0x14, 0x5f, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, + 0x44, 0x65, 0x6c, 0x74, 0x61, 0x12, 0x69, 0x0a, 0x11, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x61, + 0x72, 0x79, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x3c, 0x2e, 0x69, 0x6f, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x6e, 0x61, 0x74, 0x69, + 0x76, 0x65, 0x2e, 0x6f, 0x78, 0x69, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x75, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x61, + 0x72, 0x79, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x10, + 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x73, + 0x1a, 0x43, 0x0a, 0x15, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x49, 0x6e, 0x64, + 0x65, 0x78, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x16, 0x0a, 0x14, 0x5f, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, @@ -2369,7 +2404,7 @@ var file_client_proto_rawDesc = []byte{ 0x73, 0x65, 0x12, 0x3a, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x22, 0x2e, 0x69, 0x6f, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x6f, 0x78, 0x69, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x80, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xd0, 0x01, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x68, 0x61, 0x72, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x05, 0x73, 0x68, 0x61, 0x72, 0x64, 0x88, 0x01, 0x01, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x74, 0x61, @@ -2377,10 +2412,15 @@ var file_client_proto_rawDesc = []byte{ 0x28, 0x09, 0x52, 0x0e, 0x73, 0x74, 0x61, 0x72, 0x74, 0x49, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x6e, 0x64, 0x5f, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65, 0x6e, 0x64, 0x45, 0x78, - 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x68, 0x61, 0x72, - 0x64, 0x22, 0x22, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x12, 0x35, 0x0a, 0x14, 0x73, 0x65, 0x63, 0x6f, 0x6e, + 0x64, 0x61, 0x72, 0x79, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x12, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x61, + 0x72, 0x79, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x73, 0x68, 0x61, 0x72, 0x64, 0x42, 0x17, 0x0a, 0x15, 0x5f, 0x73, 0x65, 0x63, + 0x6f, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x22, 0x22, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x04, 0x6b, 0x65, 0x79, 0x73, 0x22, 0x85, 0x01, 0x0a, 0x10, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x53, + 0x04, 0x6b, 0x65, 0x79, 0x73, 0x22, 0xd5, 0x01, 0x0a, 0x10, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x63, 0x61, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x68, 0x61, 0x72, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x05, 0x73, 0x68, 0x61, 0x72, 0x64, 0x88, 0x01, 0x01, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x69, @@ -2388,7 +2428,12 @@ var file_client_proto_rawDesc = []byte{ 0x73, 0x74, 0x61, 0x72, 0x74, 0x49, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x6e, 0x64, 0x5f, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65, 0x6e, 0x64, 0x45, 0x78, 0x63, 0x6c, 0x75, 0x73, - 0x69, 0x76, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x68, 0x61, 0x72, 0x64, 0x22, 0x56, 0x0a, + 0x69, 0x76, 0x65, 0x12, 0x35, 0x0a, 0x14, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x61, 0x72, 0x79, + 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x01, 0x52, 0x12, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x49, 0x6e, + 0x64, 0x65, 0x78, 0x4e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, + 0x68, 0x61, 0x72, 0x64, 0x42, 0x17, 0x0a, 0x15, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x61, + 0x72, 0x79, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x56, 0x0a, 0x11, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x63, 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x69, 0x6f, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x6e, @@ -2583,7 +2628,7 @@ func file_client_proto_rawDescGZIP() []byte { } var file_client_proto_enumTypes = make([]protoimpl.EnumInfo, 4) -var file_client_proto_msgTypes = make([]protoimpl.MessageInfo, 33) +var file_client_proto_msgTypes = make([]protoimpl.MessageInfo, 34) var file_client_proto_goTypes = []interface{}{ (ShardKeyRouter)(0), // 0: io.streamnative.oxia.proto.ShardKeyRouter (KeyComparisonType)(0), // 1: io.streamnative.oxia.proto.KeyComparisonType @@ -2621,7 +2666,8 @@ var file_client_proto_goTypes = []interface{}{ (*NotificationBatch)(nil), // 33: io.streamnative.oxia.proto.NotificationBatch (*Notification)(nil), // 34: io.streamnative.oxia.proto.Notification nil, // 35: io.streamnative.oxia.proto.ShardAssignments.NamespacesEntry - nil, // 36: io.streamnative.oxia.proto.NotificationBatch.NotificationsEntry + nil, // 36: io.streamnative.oxia.proto.PutRequest.SecondaryIndexesEntry + nil, // 37: io.streamnative.oxia.proto.NotificationBatch.NotificationsEntry } var file_client_proto_depIdxs = []int32{ 35, // 0: io.streamnative.oxia.proto.ShardAssignments.namespaces:type_name -> io.streamnative.oxia.proto.ShardAssignments.NamespacesEntry @@ -2636,43 +2682,44 @@ var file_client_proto_depIdxs = []int32{ 20, // 9: io.streamnative.oxia.proto.WriteResponse.delete_ranges:type_name -> io.streamnative.oxia.proto.DeleteRangeResponse 17, // 10: io.streamnative.oxia.proto.ReadRequest.gets:type_name -> io.streamnative.oxia.proto.GetRequest 18, // 11: io.streamnative.oxia.proto.ReadResponse.gets:type_name -> io.streamnative.oxia.proto.GetResponse - 2, // 12: io.streamnative.oxia.proto.PutResponse.status:type_name -> io.streamnative.oxia.proto.Status - 25, // 13: io.streamnative.oxia.proto.PutResponse.version:type_name -> io.streamnative.oxia.proto.Version - 2, // 14: io.streamnative.oxia.proto.DeleteResponse.status:type_name -> io.streamnative.oxia.proto.Status - 1, // 15: io.streamnative.oxia.proto.GetRequest.comparison_type:type_name -> io.streamnative.oxia.proto.KeyComparisonType - 2, // 16: io.streamnative.oxia.proto.GetResponse.status:type_name -> io.streamnative.oxia.proto.Status - 25, // 17: io.streamnative.oxia.proto.GetResponse.version:type_name -> io.streamnative.oxia.proto.Version - 2, // 18: io.streamnative.oxia.proto.DeleteRangeResponse.status:type_name -> io.streamnative.oxia.proto.Status - 18, // 19: io.streamnative.oxia.proto.RangeScanResponse.records:type_name -> io.streamnative.oxia.proto.GetResponse - 36, // 20: io.streamnative.oxia.proto.NotificationBatch.notifications:type_name -> io.streamnative.oxia.proto.NotificationBatch.NotificationsEntry - 3, // 21: io.streamnative.oxia.proto.Notification.type:type_name -> io.streamnative.oxia.proto.NotificationType - 6, // 22: io.streamnative.oxia.proto.ShardAssignments.NamespacesEntry.value:type_name -> io.streamnative.oxia.proto.NamespaceShardsAssignment - 34, // 23: io.streamnative.oxia.proto.NotificationBatch.NotificationsEntry.value:type_name -> io.streamnative.oxia.proto.Notification - 4, // 24: io.streamnative.oxia.proto.OxiaClient.GetShardAssignments:input_type -> io.streamnative.oxia.proto.ShardAssignmentsRequest - 9, // 25: io.streamnative.oxia.proto.OxiaClient.Write:input_type -> io.streamnative.oxia.proto.WriteRequest - 9, // 26: io.streamnative.oxia.proto.OxiaClient.WriteStream:input_type -> io.streamnative.oxia.proto.WriteRequest - 11, // 27: io.streamnative.oxia.proto.OxiaClient.Read:input_type -> io.streamnative.oxia.proto.ReadRequest - 21, // 28: io.streamnative.oxia.proto.OxiaClient.List:input_type -> io.streamnative.oxia.proto.ListRequest - 23, // 29: io.streamnative.oxia.proto.OxiaClient.RangeScan:input_type -> io.streamnative.oxia.proto.RangeScanRequest - 32, // 30: io.streamnative.oxia.proto.OxiaClient.GetNotifications:input_type -> io.streamnative.oxia.proto.NotificationsRequest - 26, // 31: io.streamnative.oxia.proto.OxiaClient.CreateSession:input_type -> io.streamnative.oxia.proto.CreateSessionRequest - 28, // 32: io.streamnative.oxia.proto.OxiaClient.KeepAlive:input_type -> io.streamnative.oxia.proto.SessionHeartbeat - 30, // 33: io.streamnative.oxia.proto.OxiaClient.CloseSession:input_type -> io.streamnative.oxia.proto.CloseSessionRequest - 5, // 34: io.streamnative.oxia.proto.OxiaClient.GetShardAssignments:output_type -> io.streamnative.oxia.proto.ShardAssignments - 10, // 35: io.streamnative.oxia.proto.OxiaClient.Write:output_type -> io.streamnative.oxia.proto.WriteResponse - 10, // 36: io.streamnative.oxia.proto.OxiaClient.WriteStream:output_type -> io.streamnative.oxia.proto.WriteResponse - 12, // 37: io.streamnative.oxia.proto.OxiaClient.Read:output_type -> io.streamnative.oxia.proto.ReadResponse - 22, // 38: io.streamnative.oxia.proto.OxiaClient.List:output_type -> io.streamnative.oxia.proto.ListResponse - 24, // 39: io.streamnative.oxia.proto.OxiaClient.RangeScan:output_type -> io.streamnative.oxia.proto.RangeScanResponse - 33, // 40: io.streamnative.oxia.proto.OxiaClient.GetNotifications:output_type -> io.streamnative.oxia.proto.NotificationBatch - 27, // 41: io.streamnative.oxia.proto.OxiaClient.CreateSession:output_type -> io.streamnative.oxia.proto.CreateSessionResponse - 29, // 42: io.streamnative.oxia.proto.OxiaClient.KeepAlive:output_type -> io.streamnative.oxia.proto.KeepAliveResponse - 31, // 43: io.streamnative.oxia.proto.OxiaClient.CloseSession:output_type -> io.streamnative.oxia.proto.CloseSessionResponse - 34, // [34:44] is the sub-list for method output_type - 24, // [24:34] is the sub-list for method input_type - 24, // [24:24] is the sub-list for extension type_name - 24, // [24:24] is the sub-list for extension extendee - 0, // [0:24] is the sub-list for field type_name + 36, // 12: io.streamnative.oxia.proto.PutRequest.secondary_indexes:type_name -> io.streamnative.oxia.proto.PutRequest.SecondaryIndexesEntry + 2, // 13: io.streamnative.oxia.proto.PutResponse.status:type_name -> io.streamnative.oxia.proto.Status + 25, // 14: io.streamnative.oxia.proto.PutResponse.version:type_name -> io.streamnative.oxia.proto.Version + 2, // 15: io.streamnative.oxia.proto.DeleteResponse.status:type_name -> io.streamnative.oxia.proto.Status + 1, // 16: io.streamnative.oxia.proto.GetRequest.comparison_type:type_name -> io.streamnative.oxia.proto.KeyComparisonType + 2, // 17: io.streamnative.oxia.proto.GetResponse.status:type_name -> io.streamnative.oxia.proto.Status + 25, // 18: io.streamnative.oxia.proto.GetResponse.version:type_name -> io.streamnative.oxia.proto.Version + 2, // 19: io.streamnative.oxia.proto.DeleteRangeResponse.status:type_name -> io.streamnative.oxia.proto.Status + 18, // 20: io.streamnative.oxia.proto.RangeScanResponse.records:type_name -> io.streamnative.oxia.proto.GetResponse + 37, // 21: io.streamnative.oxia.proto.NotificationBatch.notifications:type_name -> io.streamnative.oxia.proto.NotificationBatch.NotificationsEntry + 3, // 22: io.streamnative.oxia.proto.Notification.type:type_name -> io.streamnative.oxia.proto.NotificationType + 6, // 23: io.streamnative.oxia.proto.ShardAssignments.NamespacesEntry.value:type_name -> io.streamnative.oxia.proto.NamespaceShardsAssignment + 34, // 24: io.streamnative.oxia.proto.NotificationBatch.NotificationsEntry.value:type_name -> io.streamnative.oxia.proto.Notification + 4, // 25: io.streamnative.oxia.proto.OxiaClient.GetShardAssignments:input_type -> io.streamnative.oxia.proto.ShardAssignmentsRequest + 9, // 26: io.streamnative.oxia.proto.OxiaClient.Write:input_type -> io.streamnative.oxia.proto.WriteRequest + 9, // 27: io.streamnative.oxia.proto.OxiaClient.WriteStream:input_type -> io.streamnative.oxia.proto.WriteRequest + 11, // 28: io.streamnative.oxia.proto.OxiaClient.Read:input_type -> io.streamnative.oxia.proto.ReadRequest + 21, // 29: io.streamnative.oxia.proto.OxiaClient.List:input_type -> io.streamnative.oxia.proto.ListRequest + 23, // 30: io.streamnative.oxia.proto.OxiaClient.RangeScan:input_type -> io.streamnative.oxia.proto.RangeScanRequest + 32, // 31: io.streamnative.oxia.proto.OxiaClient.GetNotifications:input_type -> io.streamnative.oxia.proto.NotificationsRequest + 26, // 32: io.streamnative.oxia.proto.OxiaClient.CreateSession:input_type -> io.streamnative.oxia.proto.CreateSessionRequest + 28, // 33: io.streamnative.oxia.proto.OxiaClient.KeepAlive:input_type -> io.streamnative.oxia.proto.SessionHeartbeat + 30, // 34: io.streamnative.oxia.proto.OxiaClient.CloseSession:input_type -> io.streamnative.oxia.proto.CloseSessionRequest + 5, // 35: io.streamnative.oxia.proto.OxiaClient.GetShardAssignments:output_type -> io.streamnative.oxia.proto.ShardAssignments + 10, // 36: io.streamnative.oxia.proto.OxiaClient.Write:output_type -> io.streamnative.oxia.proto.WriteResponse + 10, // 37: io.streamnative.oxia.proto.OxiaClient.WriteStream:output_type -> io.streamnative.oxia.proto.WriteResponse + 12, // 38: io.streamnative.oxia.proto.OxiaClient.Read:output_type -> io.streamnative.oxia.proto.ReadResponse + 22, // 39: io.streamnative.oxia.proto.OxiaClient.List:output_type -> io.streamnative.oxia.proto.ListResponse + 24, // 40: io.streamnative.oxia.proto.OxiaClient.RangeScan:output_type -> io.streamnative.oxia.proto.RangeScanResponse + 33, // 41: io.streamnative.oxia.proto.OxiaClient.GetNotifications:output_type -> io.streamnative.oxia.proto.NotificationBatch + 27, // 42: io.streamnative.oxia.proto.OxiaClient.CreateSession:output_type -> io.streamnative.oxia.proto.CreateSessionResponse + 29, // 43: io.streamnative.oxia.proto.OxiaClient.KeepAlive:output_type -> io.streamnative.oxia.proto.KeepAliveResponse + 31, // 44: io.streamnative.oxia.proto.OxiaClient.CloseSession:output_type -> io.streamnative.oxia.proto.CloseSessionResponse + 35, // [35:45] is the sub-list for method output_type + 25, // [25:35] is the sub-list for method input_type + 25, // [25:25] is the sub-list for extension type_name + 25, // [25:25] is the sub-list for extension extendee + 0, // [0:25] is the sub-list for field type_name } func init() { file_client_proto_init() } @@ -3074,7 +3121,7 @@ func file_client_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_client_proto_rawDesc, NumEnums: 4, - NumMessages: 33, + NumMessages: 34, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/client.proto b/proto/client.proto index 608e43e5..55f86e0a 100644 --- a/proto/client.proto +++ b/proto/client.proto @@ -252,6 +252,8 @@ message PutRequest { // If one or more sequence key are specified. The key will get added suffixes // based on adding the delta to the current highest key with the same prefix repeated uint64 sequence_key_delta = 7; + + map secondary_indexes = 8; } /** @@ -361,6 +363,8 @@ message ListRequest { string start_inclusive = 2; // The end of the range, exclusive string end_exclusive = 3; + + optional string secondary_index_name = 4; } /** @@ -382,6 +386,8 @@ message RangeScanRequest { string start_inclusive = 2; // The end of the range, exclusive string end_exclusive = 3; + + optional string secondary_index_name = 4; } /** diff --git a/proto/client_vtproto.pb.go b/proto/client_vtproto.pb.go index da6820dc..4bcb91b4 100644 --- a/proto/client_vtproto.pb.go +++ b/proto/client_vtproto.pb.go @@ -295,6 +295,13 @@ func (m *PutRequest) CloneVT() *PutRequest { copy(tmpContainer, rhs) r.SequenceKeyDelta = tmpContainer } + if rhs := m.SecondaryIndexes; rhs != nil { + tmpContainer := make(map[string]string, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v + } + r.SecondaryIndexes = tmpContainer + } if len(m.unknownFields) > 0 { r.unknownFields = make([]byte, len(m.unknownFields)) copy(r.unknownFields, m.unknownFields) @@ -458,6 +465,10 @@ func (m *ListRequest) CloneVT() *ListRequest { tmpVal := *rhs r.Shard = &tmpVal } + if rhs := m.SecondaryIndexName; rhs != nil { + tmpVal := *rhs + r.SecondaryIndexName = &tmpVal + } if len(m.unknownFields) > 0 { r.unknownFields = make([]byte, len(m.unknownFields)) copy(r.unknownFields, m.unknownFields) @@ -501,6 +512,10 @@ func (m *RangeScanRequest) CloneVT() *RangeScanRequest { tmpVal := *rhs r.Shard = &tmpVal } + if rhs := m.SecondaryIndexName; rhs != nil { + tmpVal := *rhs + r.SecondaryIndexName = &tmpVal + } if len(m.unknownFields) > 0 { r.unknownFields = make([]byte, len(m.unknownFields)) copy(r.unknownFields, m.unknownFields) @@ -1150,6 +1165,18 @@ func (this *PutRequest) EqualVT(that *PutRequest) bool { return false } } + if len(this.SecondaryIndexes) != len(that.SecondaryIndexes) { + return false + } + for i, vx := range this.SecondaryIndexes { + vy, ok := that.SecondaryIndexes[i] + if !ok { + return false + } + if vx != vy { + return false + } + } return string(this.unknownFields) == string(that.unknownFields) } @@ -1335,6 +1362,9 @@ func (this *ListRequest) EqualVT(that *ListRequest) bool { if this.EndExclusive != that.EndExclusive { return false } + if p, q := this.SecondaryIndexName, that.SecondaryIndexName; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } return string(this.unknownFields) == string(that.unknownFields) } @@ -1385,6 +1415,9 @@ func (this *RangeScanRequest) EqualVT(that *RangeScanRequest) bool { if this.EndExclusive != that.EndExclusive { return false } + if p, q := this.SecondaryIndexName, that.SecondaryIndexName; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } return string(this.unknownFields) == string(that.unknownFields) } @@ -2205,6 +2238,25 @@ func (m *PutRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } + if len(m.SecondaryIndexes) > 0 { + for k := range m.SecondaryIndexes { + v := m.SecondaryIndexes[k] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = protohelpers.EncodeVarint(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x42 + } + } if len(m.SequenceKeyDelta) > 0 { var pksize2 int for _, num := range m.SequenceKeyDelta { @@ -2636,6 +2688,13 @@ func (m *ListRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } + if m.SecondaryIndexName != nil { + i -= len(*m.SecondaryIndexName) + copy(dAtA[i:], *m.SecondaryIndexName) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(*m.SecondaryIndexName))) + i-- + dAtA[i] = 0x22 + } if len(m.EndExclusive) > 0 { i -= len(m.EndExclusive) copy(dAtA[i:], m.EndExclusive) @@ -2730,6 +2789,13 @@ func (m *RangeScanRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } + if m.SecondaryIndexName != nil { + i -= len(*m.SecondaryIndexName) + copy(dAtA[i:], *m.SecondaryIndexName) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(*m.SecondaryIndexName))) + i-- + dAtA[i] = 0x22 + } if len(m.EndExclusive) > 0 { i -= len(m.EndExclusive) copy(dAtA[i:], m.EndExclusive) @@ -3501,6 +3567,14 @@ func (m *PutRequest) SizeVT() (n int) { } n += 1 + protohelpers.SizeOfVarint(uint64(l)) + l } + if len(m.SecondaryIndexes) > 0 { + for k, v := range m.SecondaryIndexes { + _ = k + _ = v + mapEntrySize := 1 + len(k) + protohelpers.SizeOfVarint(uint64(len(k))) + 1 + len(v) + protohelpers.SizeOfVarint(uint64(len(v))) + n += mapEntrySize + 1 + protohelpers.SizeOfVarint(uint64(mapEntrySize)) + } + } n += len(m.unknownFields) return n } @@ -3649,6 +3723,10 @@ func (m *ListRequest) SizeVT() (n int) { if l > 0 { n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) } + if m.SecondaryIndexName != nil { + l = len(*m.SecondaryIndexName) + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } n += len(m.unknownFields) return n } @@ -3686,6 +3764,10 @@ func (m *RangeScanRequest) SizeVT() (n int) { if l > 0 { n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) } + if m.SecondaryIndexName != nil { + l = len(*m.SecondaryIndexName) + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } n += len(m.unknownFields) return n } @@ -5262,6 +5344,133 @@ func (m *PutRequest) UnmarshalVT(dAtA []byte) error { } else { return fmt.Errorf("proto: wrong wireType = %d for field SequenceKeyDelta", wireType) } + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SecondaryIndexes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SecondaryIndexes == nil { + m.SecondaryIndexes = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return protohelpers.ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return protohelpers.ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return protohelpers.ErrInvalidLength + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return protohelpers.ErrInvalidLength + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.SecondaryIndexes[mapkey] = mapvalue + iNdEx = postIndex default: iNdEx = preIndex skippy, err := protohelpers.Skip(dAtA[iNdEx:]) @@ -6189,6 +6398,39 @@ func (m *ListRequest) UnmarshalVT(dAtA []byte) error { } m.EndExclusive = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SecondaryIndexName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.SecondaryIndexName = &s + iNdEx = postIndex default: iNdEx = preIndex skippy, err := protohelpers.Skip(dAtA[iNdEx:]) @@ -6407,6 +6649,39 @@ func (m *RangeScanRequest) UnmarshalVT(dAtA []byte) error { } m.EndExclusive = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SecondaryIndexName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.SecondaryIndexName = &s + iNdEx = postIndex default: iNdEx = preIndex skippy, err := protohelpers.Skip(dAtA[iNdEx:]) @@ -8983,6 +9258,141 @@ func (m *PutRequest) UnmarshalVTUnsafe(dAtA []byte) error { } else { return fmt.Errorf("proto: wrong wireType = %d for field SequenceKeyDelta", wireType) } + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SecondaryIndexes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SecondaryIndexes == nil { + m.SecondaryIndexes = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return protohelpers.ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return protohelpers.ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + if intStringLenmapkey == 0 { + mapkey = "" + } else { + mapkey = unsafe.String(&dAtA[iNdEx], intStringLenmapkey) + } + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return protohelpers.ErrInvalidLength + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return protohelpers.ErrInvalidLength + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + if intStringLenmapvalue == 0 { + mapvalue = "" + } else { + mapvalue = unsafe.String(&dAtA[iNdEx], intStringLenmapvalue) + } + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.SecondaryIndexes[mapkey] = mapvalue + iNdEx = postIndex default: iNdEx = preIndex skippy, err := protohelpers.Skip(dAtA[iNdEx:]) @@ -9939,6 +10349,43 @@ func (m *ListRequest) UnmarshalVTUnsafe(dAtA []byte) error { } m.EndExclusive = stringValue iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SecondaryIndexName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var stringValue string + if intStringLen > 0 { + stringValue = unsafe.String(&dAtA[iNdEx], intStringLen) + } + s := stringValue + m.SecondaryIndexName = &s + iNdEx = postIndex default: iNdEx = preIndex skippy, err := protohelpers.Skip(dAtA[iNdEx:]) @@ -10169,6 +10616,43 @@ func (m *RangeScanRequest) UnmarshalVTUnsafe(dAtA []byte) error { } m.EndExclusive = stringValue iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SecondaryIndexName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var stringValue string + if intStringLen > 0 { + stringValue = unsafe.String(&dAtA[iNdEx], intStringLen) + } + s := stringValue + m.SecondaryIndexName = &s + iNdEx = postIndex default: iNdEx = preIndex skippy, err := protohelpers.Skip(dAtA[iNdEx:]) diff --git a/proto/storage.pb.go b/proto/storage.pb.go index 707e70bd..161060e4 100644 --- a/proto/storage.pb.go +++ b/proto/storage.pb.go @@ -40,14 +40,15 @@ type StorageEntry struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` - VersionId int64 `protobuf:"varint,2,opt,name=version_id,json=versionId,proto3" json:"version_id,omitempty"` - ModificationsCount int64 `protobuf:"varint,3,opt,name=modifications_count,json=modificationsCount,proto3" json:"modifications_count,omitempty"` - CreationTimestamp uint64 `protobuf:"fixed64,4,opt,name=creation_timestamp,json=creationTimestamp,proto3" json:"creation_timestamp,omitempty"` - ModificationTimestamp uint64 `protobuf:"fixed64,5,opt,name=modification_timestamp,json=modificationTimestamp,proto3" json:"modification_timestamp,omitempty"` - SessionId *int64 `protobuf:"varint,6,opt,name=session_id,json=sessionId,proto3,oneof" json:"session_id,omitempty"` - ClientIdentity *string `protobuf:"bytes,7,opt,name=client_identity,json=clientIdentity,proto3,oneof" json:"client_identity,omitempty"` - PartitionKey *string `protobuf:"bytes,8,opt,name=partition_key,json=partitionKey,proto3,oneof" json:"partition_key,omitempty"` + Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` + VersionId int64 `protobuf:"varint,2,opt,name=version_id,json=versionId,proto3" json:"version_id,omitempty"` + ModificationsCount int64 `protobuf:"varint,3,opt,name=modifications_count,json=modificationsCount,proto3" json:"modifications_count,omitempty"` + CreationTimestamp uint64 `protobuf:"fixed64,4,opt,name=creation_timestamp,json=creationTimestamp,proto3" json:"creation_timestamp,omitempty"` + ModificationTimestamp uint64 `protobuf:"fixed64,5,opt,name=modification_timestamp,json=modificationTimestamp,proto3" json:"modification_timestamp,omitempty"` + SessionId *int64 `protobuf:"varint,6,opt,name=session_id,json=sessionId,proto3,oneof" json:"session_id,omitempty"` + ClientIdentity *string `protobuf:"bytes,7,opt,name=client_identity,json=clientIdentity,proto3,oneof" json:"client_identity,omitempty"` + PartitionKey *string `protobuf:"bytes,8,opt,name=partition_key,json=partitionKey,proto3,oneof" json:"partition_key,omitempty"` + SecondaryIndexes map[string]string `protobuf:"bytes,9,rep,name=secondary_indexes,json=secondaryIndexes,proto3" json:"secondary_indexes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *StorageEntry) Reset() { @@ -138,6 +139,13 @@ func (x *StorageEntry) GetPartitionKey() string { return "" } +func (x *StorageEntry) GetSecondaryIndexes() map[string]string { + if x != nil { + return x.SecondaryIndexes + } + return nil +} + type SessionMetadata struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -331,7 +339,7 @@ var file_storage_proto_rawDesc = []byte{ 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0c, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x91, 0x03, 0x0a, 0x0c, 0x53, 0x74, 0x6f, 0x72, 0x61, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xae, 0x04, 0x0a, 0x0c, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, @@ -352,34 +360,43 @@ var file_storage_proto_rawDesc = []byte{ 0x48, 0x01, 0x52, 0x0e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x88, 0x01, 0x01, 0x12, 0x28, 0x0a, 0x0d, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x0c, - 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x88, 0x01, 0x01, 0x3a, - 0x04, 0xa8, 0xa6, 0x1f, 0x01, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x5f, 0x69, 0x64, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, - 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x42, 0x10, 0x0a, 0x0e, 0x5f, 0x70, 0x61, 0x72, - 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x22, 0x52, 0x0a, 0x0f, 0x53, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1d, 0x0a, - 0x0a, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x5f, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x4d, 0x73, 0x12, 0x1a, 0x0a, 0x08, - 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x3a, 0x04, 0xa8, 0xa6, 0x1f, 0x01, 0x22, 0x52, - 0x0a, 0x0d, 0x4c, 0x6f, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, - 0x32, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x73, 0x3a, 0x04, 0xa8, 0xa6, 0x1f, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x22, 0x51, 0x0a, 0x0d, 0x57, 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x73, 0x12, 0x40, 0x0a, 0x06, 0x77, 0x72, 0x69, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x69, 0x6f, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x6e, - 0x61, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x6f, 0x78, 0x69, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x06, 0x77, - 0x72, 0x69, 0x74, 0x65, 0x73, 0x3a, 0x3e, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, - 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x18, 0xe5, 0xf4, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x70, 0x6f, - 0x6f, 0x6c, 0x88, 0x01, 0x01, 0x42, 0x24, 0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, - 0x2f, 0x6f, 0x78, 0x69, 0x61, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x88, 0x01, 0x01, 0x12, + 0x56, 0x0a, 0x11, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x5f, 0x69, 0x6e, 0x64, + 0x65, 0x78, 0x65, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x2e, + 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x73, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x10, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x61, 0x72, 0x79, + 0x49, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x73, 0x1a, 0x43, 0x0a, 0x15, 0x53, 0x65, 0x63, 0x6f, 0x6e, + 0x64, 0x61, 0x72, 0x79, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x3a, 0x04, 0xa8, 0xa6, + 0x1f, 0x01, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, + 0x64, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x74, 0x79, 0x42, 0x10, 0x0a, 0x0e, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x22, 0x52, 0x0a, 0x0f, 0x53, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x69, + 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x5f, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, + 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x4d, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x69, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x74, 0x79, 0x3a, 0x04, 0xa8, 0xa6, 0x1f, 0x01, 0x22, 0x52, 0x0a, 0x0d, 0x4c, + 0x6f, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x32, 0x0a, 0x08, + 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x73, 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, + 0x3a, 0x04, 0xa8, 0xa6, 0x1f, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0x51, 0x0a, 0x0d, 0x57, 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, + 0x12, 0x40, 0x0a, 0x06, 0x77, 0x72, 0x69, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x28, 0x2e, 0x69, 0x6f, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x6e, 0x61, 0x74, 0x69, + 0x76, 0x65, 0x2e, 0x6f, 0x78, 0x69, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x57, 0x72, + 0x69, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x06, 0x77, 0x72, 0x69, 0x74, + 0x65, 0x73, 0x3a, 0x3e, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x12, 0x1f, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xe5, + 0xf4, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x88, + 0x01, 0x01, 0x42, 0x24, 0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2f, 0x6f, 0x78, + 0x69, 0x61, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -394,24 +411,26 @@ func file_storage_proto_rawDescGZIP() []byte { return file_storage_proto_rawDescData } -var file_storage_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_storage_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_storage_proto_goTypes = []interface{}{ (*StorageEntry)(nil), // 0: proto.StorageEntry (*SessionMetadata)(nil), // 1: proto.SessionMetadata (*LogEntryValue)(nil), // 2: proto.LogEntryValue (*WriteRequests)(nil), // 3: proto.WriteRequests - (*WriteRequest)(nil), // 4: io.streamnative.oxia.proto.WriteRequest - (*descriptorpb.MessageOptions)(nil), // 5: google.protobuf.MessageOptions + nil, // 4: proto.StorageEntry.SecondaryIndexesEntry + (*WriteRequest)(nil), // 5: io.streamnative.oxia.proto.WriteRequest + (*descriptorpb.MessageOptions)(nil), // 6: google.protobuf.MessageOptions } var file_storage_proto_depIdxs = []int32{ - 3, // 0: proto.LogEntryValue.requests:type_name -> proto.WriteRequests - 4, // 1: proto.WriteRequests.writes:type_name -> io.streamnative.oxia.proto.WriteRequest - 5, // 2: proto.mempool:extendee -> google.protobuf.MessageOptions - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 2, // [2:3] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 4, // 0: proto.StorageEntry.secondary_indexes:type_name -> proto.StorageEntry.SecondaryIndexesEntry + 3, // 1: proto.LogEntryValue.requests:type_name -> proto.WriteRequests + 5, // 2: proto.WriteRequests.writes:type_name -> io.streamnative.oxia.proto.WriteRequest + 6, // 3: proto.mempool:extendee -> google.protobuf.MessageOptions + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 3, // [3:4] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_storage_proto_init() } @@ -480,7 +499,7 @@ func file_storage_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_storage_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 5, NumExtensions: 1, NumServices: 0, }, diff --git a/proto/storage.proto b/proto/storage.proto index 488abc81..af97658e 100644 --- a/proto/storage.proto +++ b/proto/storage.proto @@ -38,6 +38,8 @@ message StorageEntry { optional string client_identity = 7; optional string partition_key = 8; + + map secondary_indexes = 9; } message SessionMetadata { diff --git a/proto/storage_vtproto.pb.go b/proto/storage_vtproto.pb.go index c034c404..17e696d9 100644 --- a/proto/storage_vtproto.pb.go +++ b/proto/storage_vtproto.pb.go @@ -48,6 +48,13 @@ func (m *StorageEntry) CloneVT() *StorageEntry { tmpVal := *rhs r.PartitionKey = &tmpVal } + if rhs := m.SecondaryIndexes; rhs != nil { + tmpContainer := make(map[string]string, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v + } + r.SecondaryIndexes = tmpContainer + } if len(m.unknownFields) > 0 { r.unknownFields = make([]byte, len(m.unknownFields)) copy(r.unknownFields, m.unknownFields) @@ -158,6 +165,18 @@ func (this *StorageEntry) EqualVT(that *StorageEntry) bool { if p, q := this.PartitionKey, that.PartitionKey; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { return false } + if len(this.SecondaryIndexes) != len(that.SecondaryIndexes) { + return false + } + for i, vx := range this.SecondaryIndexes { + vy, ok := that.SecondaryIndexes[i] + if !ok { + return false + } + if vx != vy { + return false + } + } return string(this.unknownFields) == string(that.unknownFields) } @@ -306,6 +325,25 @@ func (m *StorageEntry) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } + if len(m.SecondaryIndexes) > 0 { + for k := range m.SecondaryIndexes { + v := m.SecondaryIndexes[k] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = protohelpers.EncodeVarint(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x4a + } + } if m.PartitionKey != nil { i -= len(*m.PartitionKey) copy(dAtA[i:], *m.PartitionKey) @@ -605,6 +643,14 @@ func (m *StorageEntry) SizeVT() (n int) { l = len(*m.PartitionKey) n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) } + if len(m.SecondaryIndexes) > 0 { + for k, v := range m.SecondaryIndexes { + _ = k + _ = v + mapEntrySize := 1 + len(k) + protohelpers.SizeOfVarint(uint64(len(k))) + 1 + len(v) + protohelpers.SizeOfVarint(uint64(len(v))) + n += mapEntrySize + 1 + protohelpers.SizeOfVarint(uint64(mapEntrySize)) + } + } n += len(m.unknownFields) return n } @@ -874,6 +920,133 @@ func (m *StorageEntry) UnmarshalVT(dAtA []byte) error { s := string(dAtA[iNdEx:postIndex]) m.PartitionKey = &s iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SecondaryIndexes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SecondaryIndexes == nil { + m.SecondaryIndexes = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return protohelpers.ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return protohelpers.ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return protohelpers.ErrInvalidLength + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return protohelpers.ErrInvalidLength + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.SecondaryIndexes[mapkey] = mapvalue + iNdEx = postIndex default: iNdEx = preIndex skippy, err := protohelpers.Skip(dAtA[iNdEx:]) @@ -1387,6 +1560,141 @@ func (m *StorageEntry) UnmarshalVTUnsafe(dAtA []byte) error { s := stringValue m.PartitionKey = &s iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SecondaryIndexes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SecondaryIndexes == nil { + m.SecondaryIndexes = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return protohelpers.ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return protohelpers.ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + if intStringLenmapkey == 0 { + mapkey = "" + } else { + mapkey = unsafe.String(&dAtA[iNdEx], intStringLenmapkey) + } + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return protohelpers.ErrInvalidLength + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return protohelpers.ErrInvalidLength + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + if intStringLenmapvalue == 0 { + mapvalue = "" + } else { + mapvalue = unsafe.String(&dAtA[iNdEx], intStringLenmapvalue) + } + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.SecondaryIndexes[mapkey] = mapvalue + iNdEx = postIndex default: iNdEx = preIndex skippy, err := protohelpers.Skip(dAtA[iNdEx:])