From 344c1365861126b7e8caad8b54ee1c75970f570f Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Thu, 4 Nov 2021 19:16:31 +0800 Subject: [PATCH 01/12] feat(yaml): add hashx yaml --- storage/temp/tem.yaml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/storage/temp/tem.yaml b/storage/temp/tem.yaml index 6b26d6d..c6634da 100644 --- a/storage/temp/tem.yaml +++ b/storage/temp/tem.yaml @@ -25,4 +25,15 @@ LIST_X: - r_pop - l_trim # 对列表进行切片 - r_push - - r_push_x # 对已经存在的列表尾插 \ No newline at end of file + - r_push_x # 对已经存在的列表尾插 + +HASH_X: + - h_del + - h_exists + - h_get + - h_get_all + - h_incr_by + - h_keys + - h_len + - h_set + - h_set_x \ No newline at end of file From 88774daede7fbcc0e39fa4d1de328c627feee9df Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Thu, 4 Nov 2021 19:20:10 +0800 Subject: [PATCH 02/12] chore(proto): update proto --- pkg/proto/hashx.pb.go | 1279 +++++++++++++++++++++++++++++++++++++ pkg/proto/storage.pb.go | 594 ++++++++++++++--- protobuf/hashx.proto | 78 +++ protobuf/storage.proto | 10 + shell/proto.py | 1 + storage/temp/const.gen.go | 30 + 6 files changed, 1887 insertions(+), 105 deletions(-) create mode 100644 pkg/proto/hashx.pb.go create mode 100644 protobuf/hashx.proto diff --git a/pkg/proto/hashx.pb.go b/pkg/proto/hashx.pb.go new file mode 100644 index 0000000..61a161e --- /dev/null +++ b/pkg/proto/hashx.pb.go @@ -0,0 +1,1279 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.17.3 +// source: hashx.proto + +package proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type HDelRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + HKeys []string `protobuf:"bytes,2,rep,name=h_keys,json=hKeys,proto3" json:"h_keys,omitempty"` +} + +func (x *HDelRequest) Reset() { + *x = HDelRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_hashx_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HDelRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HDelRequest) ProtoMessage() {} + +func (x *HDelRequest) ProtoReflect() protoreflect.Message { + mi := &file_hashx_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HDelRequest.ProtoReflect.Descriptor instead. +func (*HDelRequest) Descriptor() ([]byte, []int) { + return file_hashx_proto_rawDescGZIP(), []int{0} +} + +func (x *HDelRequest) GetKey() *BaseKey { + if x != nil { + return x.Key + } + return nil +} + +func (x *HDelRequest) GetHKeys() []string { + if x != nil { + return x.HKeys + } + return nil +} + +type HDelResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *HDelResponse) Reset() { + *x = HDelResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_hashx_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HDelResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HDelResponse) ProtoMessage() {} + +func (x *HDelResponse) ProtoReflect() protoreflect.Message { + mi := &file_hashx_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HDelResponse.ProtoReflect.Descriptor instead. +func (*HDelResponse) Descriptor() ([]byte, []int) { + return file_hashx_proto_rawDescGZIP(), []int{1} +} + +type HExistsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + HKey string `protobuf:"bytes,2,opt,name=h_key,json=hKey,proto3" json:"h_key,omitempty"` +} + +func (x *HExistsRequest) Reset() { + *x = HExistsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_hashx_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HExistsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HExistsRequest) ProtoMessage() {} + +func (x *HExistsRequest) ProtoReflect() protoreflect.Message { + mi := &file_hashx_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HExistsRequest.ProtoReflect.Descriptor instead. +func (*HExistsRequest) Descriptor() ([]byte, []int) { + return file_hashx_proto_rawDescGZIP(), []int{2} +} + +func (x *HExistsRequest) GetKey() *BaseKey { + if x != nil { + return x.Key + } + return nil +} + +func (x *HExistsRequest) GetHKey() string { + if x != nil { + return x.HKey + } + return "" +} + +type HExistsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *HExistsResponse) Reset() { + *x = HExistsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_hashx_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HExistsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HExistsResponse) ProtoMessage() {} + +func (x *HExistsResponse) ProtoReflect() protoreflect.Message { + mi := &file_hashx_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HExistsResponse.ProtoReflect.Descriptor instead. +func (*HExistsResponse) Descriptor() ([]byte, []int) { + return file_hashx_proto_rawDescGZIP(), []int{3} +} + +type HGetRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + HKeys []string `protobuf:"bytes,2,rep,name=h_keys,json=hKeys,proto3" json:"h_keys,omitempty"` +} + +func (x *HGetRequest) Reset() { + *x = HGetRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_hashx_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HGetRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HGetRequest) ProtoMessage() {} + +func (x *HGetRequest) ProtoReflect() protoreflect.Message { + mi := &file_hashx_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HGetRequest.ProtoReflect.Descriptor instead. +func (*HGetRequest) Descriptor() ([]byte, []int) { + return file_hashx_proto_rawDescGZIP(), []int{4} +} + +func (x *HGetRequest) GetKey() *BaseKey { + if x != nil { + return x.Key + } + return nil +} + +func (x *HGetRequest) GetHKeys() []string { + if x != nil { + return x.HKeys + } + return nil +} + +type HGetResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Items map[string]string `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *HGetResponse) Reset() { + *x = HGetResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_hashx_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HGetResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HGetResponse) ProtoMessage() {} + +func (x *HGetResponse) ProtoReflect() protoreflect.Message { + mi := &file_hashx_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 HGetResponse.ProtoReflect.Descriptor instead. +func (*HGetResponse) Descriptor() ([]byte, []int) { + return file_hashx_proto_rawDescGZIP(), []int{5} +} + +func (x *HGetResponse) GetItems() map[string]string { + if x != nil { + return x.Items + } + return nil +} + +type HGetAllRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` +} + +func (x *HGetAllRequest) Reset() { + *x = HGetAllRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_hashx_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HGetAllRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HGetAllRequest) ProtoMessage() {} + +func (x *HGetAllRequest) ProtoReflect() protoreflect.Message { + mi := &file_hashx_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HGetAllRequest.ProtoReflect.Descriptor instead. +func (*HGetAllRequest) Descriptor() ([]byte, []int) { + return file_hashx_proto_rawDescGZIP(), []int{6} +} + +func (x *HGetAllRequest) GetKey() *BaseKey { + if x != nil { + return x.Key + } + return nil +} + +type HGetAllResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Items map[string]string `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *HGetAllResponse) Reset() { + *x = HGetAllResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_hashx_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HGetAllResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HGetAllResponse) ProtoMessage() {} + +func (x *HGetAllResponse) ProtoReflect() protoreflect.Message { + mi := &file_hashx_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HGetAllResponse.ProtoReflect.Descriptor instead. +func (*HGetAllResponse) Descriptor() ([]byte, []int) { + return file_hashx_proto_rawDescGZIP(), []int{7} +} + +func (x *HGetAllResponse) GetItems() map[string]string { + if x != nil { + return x.Items + } + return nil +} + +type HIncrByRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + HKeys []string `protobuf:"bytes,2,rep,name=h_keys,json=hKeys,proto3" json:"h_keys,omitempty"` +} + +func (x *HIncrByRequest) Reset() { + *x = HIncrByRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_hashx_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HIncrByRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HIncrByRequest) ProtoMessage() {} + +func (x *HIncrByRequest) ProtoReflect() protoreflect.Message { + mi := &file_hashx_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HIncrByRequest.ProtoReflect.Descriptor instead. +func (*HIncrByRequest) Descriptor() ([]byte, []int) { + return file_hashx_proto_rawDescGZIP(), []int{8} +} + +func (x *HIncrByRequest) GetKey() *BaseKey { + if x != nil { + return x.Key + } + return nil +} + +func (x *HIncrByRequest) GetHKeys() []string { + if x != nil { + return x.HKeys + } + return nil +} + +type HIncrByResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Items map[string]string `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *HIncrByResponse) Reset() { + *x = HIncrByResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_hashx_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HIncrByResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HIncrByResponse) ProtoMessage() {} + +func (x *HIncrByResponse) ProtoReflect() protoreflect.Message { + mi := &file_hashx_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HIncrByResponse.ProtoReflect.Descriptor instead. +func (*HIncrByResponse) Descriptor() ([]byte, []int) { + return file_hashx_proto_rawDescGZIP(), []int{9} +} + +func (x *HIncrByResponse) GetItems() map[string]string { + if x != nil { + return x.Items + } + return nil +} + +type HKeysRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` +} + +func (x *HKeysRequest) Reset() { + *x = HKeysRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_hashx_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HKeysRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HKeysRequest) ProtoMessage() {} + +func (x *HKeysRequest) ProtoReflect() protoreflect.Message { + mi := &file_hashx_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HKeysRequest.ProtoReflect.Descriptor instead. +func (*HKeysRequest) Descriptor() ([]byte, []int) { + return file_hashx_proto_rawDescGZIP(), []int{10} +} + +func (x *HKeysRequest) GetKey() *BaseKey { + if x != nil { + return x.Key + } + return nil +} + +type HKeysResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Keys []string `protobuf:"bytes,1,rep,name=keys,proto3" json:"keys,omitempty"` +} + +func (x *HKeysResponse) Reset() { + *x = HKeysResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_hashx_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HKeysResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HKeysResponse) ProtoMessage() {} + +func (x *HKeysResponse) ProtoReflect() protoreflect.Message { + mi := &file_hashx_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HKeysResponse.ProtoReflect.Descriptor instead. +func (*HKeysResponse) Descriptor() ([]byte, []int) { + return file_hashx_proto_rawDescGZIP(), []int{11} +} + +func (x *HKeysResponse) GetKeys() []string { + if x != nil { + return x.Keys + } + return nil +} + +type HLenRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` +} + +func (x *HLenRequest) Reset() { + *x = HLenRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_hashx_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HLenRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HLenRequest) ProtoMessage() {} + +func (x *HLenRequest) ProtoReflect() protoreflect.Message { + mi := &file_hashx_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HLenRequest.ProtoReflect.Descriptor instead. +func (*HLenRequest) Descriptor() ([]byte, []int) { + return file_hashx_proto_rawDescGZIP(), []int{12} +} + +func (x *HLenRequest) GetKey() *BaseKey { + if x != nil { + return x.Key + } + return nil +} + +type HLenResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Length int32 `protobuf:"varint,1,opt,name=length,proto3" json:"length,omitempty"` +} + +func (x *HLenResponse) Reset() { + *x = HLenResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_hashx_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HLenResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HLenResponse) ProtoMessage() {} + +func (x *HLenResponse) ProtoReflect() protoreflect.Message { + mi := &file_hashx_proto_msgTypes[13] + 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 HLenResponse.ProtoReflect.Descriptor instead. +func (*HLenResponse) Descriptor() ([]byte, []int) { + return file_hashx_proto_rawDescGZIP(), []int{13} +} + +func (x *HLenResponse) GetLength() int32 { + if x != nil { + return x.Length + } + return 0 +} + +type HSetRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Items map[string]string `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *HSetRequest) Reset() { + *x = HSetRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_hashx_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HSetRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HSetRequest) ProtoMessage() {} + +func (x *HSetRequest) ProtoReflect() protoreflect.Message { + mi := &file_hashx_proto_msgTypes[14] + 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 HSetRequest.ProtoReflect.Descriptor instead. +func (*HSetRequest) Descriptor() ([]byte, []int) { + return file_hashx_proto_rawDescGZIP(), []int{14} +} + +func (x *HSetRequest) GetKey() *BaseKey { + if x != nil { + return x.Key + } + return nil +} + +func (x *HSetRequest) GetItems() map[string]string { + if x != nil { + return x.Items + } + return nil +} + +type HSetResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *HSetResponse) Reset() { + *x = HSetResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_hashx_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HSetResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HSetResponse) ProtoMessage() {} + +func (x *HSetResponse) ProtoReflect() protoreflect.Message { + mi := &file_hashx_proto_msgTypes[15] + 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 HSetResponse.ProtoReflect.Descriptor instead. +func (*HSetResponse) Descriptor() ([]byte, []int) { + return file_hashx_proto_rawDescGZIP(), []int{15} +} + +type HSetXRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Items map[string]string `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *HSetXRequest) Reset() { + *x = HSetXRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_hashx_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HSetXRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HSetXRequest) ProtoMessage() {} + +func (x *HSetXRequest) ProtoReflect() protoreflect.Message { + mi := &file_hashx_proto_msgTypes[16] + 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 HSetXRequest.ProtoReflect.Descriptor instead. +func (*HSetXRequest) Descriptor() ([]byte, []int) { + return file_hashx_proto_rawDescGZIP(), []int{16} +} + +func (x *HSetXRequest) GetKey() *BaseKey { + if x != nil { + return x.Key + } + return nil +} + +func (x *HSetXRequest) GetItems() map[string]string { + if x != nil { + return x.Items + } + return nil +} + +type HSetXResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Count int32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` +} + +func (x *HSetXResponse) Reset() { + *x = HSetXResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_hashx_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HSetXResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HSetXResponse) ProtoMessage() {} + +func (x *HSetXResponse) ProtoReflect() protoreflect.Message { + mi := &file_hashx_proto_msgTypes[17] + 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 HSetXResponse.ProtoReflect.Descriptor instead. +func (*HSetXResponse) Descriptor() ([]byte, []int) { + return file_hashx_proto_rawDescGZIP(), []int{17} +} + +func (x *HSetXResponse) GetCount() int32 { + if x != nil { + return x.Count + } + return 0 +} + +var File_hashx_proto protoreflect.FileDescriptor + +var file_hashx_proto_rawDesc = []byte{ + 0x0a, 0x0b, 0x68, 0x61, 0x73, 0x68, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x62, + 0x61, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x40, 0x0a, 0x0b, 0x48, 0x44, 0x65, + 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x52, + 0x03, 0x6b, 0x65, 0x79, 0x12, 0x15, 0x0a, 0x06, 0x68, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x68, 0x4b, 0x65, 0x79, 0x73, 0x22, 0x0e, 0x0a, 0x0c, 0x48, + 0x44, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x41, 0x0a, 0x0e, 0x48, + 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x42, 0x61, 0x73, + 0x65, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x13, 0x0a, 0x05, 0x68, 0x5f, 0x6b, + 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x4b, 0x65, 0x79, 0x22, 0x11, + 0x0a, 0x0f, 0x48, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x40, 0x0a, 0x0b, 0x48, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x1a, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, + 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x15, 0x0a, 0x06, + 0x68, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x68, 0x4b, + 0x65, 0x79, 0x73, 0x22, 0x78, 0x0a, 0x0c, 0x48, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x48, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x69, 0x74, + 0x65, 0x6d, 0x73, 0x1a, 0x38, 0x0a, 0x0a, 0x49, 0x74, 0x65, 0x6d, 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, 0x22, 0x2c, 0x0a, + 0x0e, 0x48, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x1a, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x42, + 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x7e, 0x0a, 0x0f, 0x48, + 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x31, + 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, + 0x48, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, + 0x49, 0x74, 0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, + 0x73, 0x1a, 0x38, 0x0a, 0x0a, 0x49, 0x74, 0x65, 0x6d, 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, 0x22, 0x43, 0x0a, 0x0e, 0x48, + 0x49, 0x6e, 0x63, 0x72, 0x42, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x42, 0x61, 0x73, + 0x65, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x15, 0x0a, 0x06, 0x68, 0x5f, 0x6b, + 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x68, 0x4b, 0x65, 0x79, 0x73, + 0x22, 0x7e, 0x0a, 0x0f, 0x48, 0x49, 0x6e, 0x63, 0x72, 0x42, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x48, 0x49, 0x6e, 0x63, 0x72, 0x42, 0x79, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x1a, 0x38, 0x0a, 0x0a, 0x49, 0x74, 0x65, 0x6d, 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, + 0x22, 0x2a, 0x0a, 0x0c, 0x48, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x1a, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, + 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x23, 0x0a, 0x0d, + 0x48, 0x4b, 0x65, 0x79, 0x73, 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, 0x29, 0x0a, 0x0b, 0x48, 0x4c, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x1a, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, + 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x26, 0x0a, 0x0c, + 0x48, 0x4c, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, + 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6c, 0x65, + 0x6e, 0x67, 0x74, 0x68, 0x22, 0x92, 0x01, 0x0a, 0x0b, 0x48, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x08, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x12, 0x2d, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x17, 0x2e, 0x48, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x49, 0x74, + 0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x1a, + 0x38, 0x0a, 0x0a, 0x49, 0x74, 0x65, 0x6d, 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, 0x22, 0x0e, 0x0a, 0x0c, 0x48, 0x53, 0x65, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x94, 0x01, 0x0a, 0x0c, 0x48, 0x53, + 0x65, 0x74, 0x58, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, + 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2e, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x48, 0x53, 0x65, 0x74, 0x58, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x1a, 0x38, 0x0a, 0x0a, 0x49, 0x74, 0x65, 0x6d, 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, + 0x22, 0x25, 0x0a, 0x0d, 0x48, 0x53, 0x65, 0x74, 0x58, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x0b, 0x5a, 0x09, 0x70, 0x6b, 0x67, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_hashx_proto_rawDescOnce sync.Once + file_hashx_proto_rawDescData = file_hashx_proto_rawDesc +) + +func file_hashx_proto_rawDescGZIP() []byte { + file_hashx_proto_rawDescOnce.Do(func() { + file_hashx_proto_rawDescData = protoimpl.X.CompressGZIP(file_hashx_proto_rawDescData) + }) + return file_hashx_proto_rawDescData +} + +var file_hashx_proto_msgTypes = make([]protoimpl.MessageInfo, 23) +var file_hashx_proto_goTypes = []interface{}{ + (*HDelRequest)(nil), // 0: HDelRequest + (*HDelResponse)(nil), // 1: HDelResponse + (*HExistsRequest)(nil), // 2: HExistsRequest + (*HExistsResponse)(nil), // 3: HExistsResponse + (*HGetRequest)(nil), // 4: HGetRequest + (*HGetResponse)(nil), // 5: HGetResponse + (*HGetAllRequest)(nil), // 6: HGetAllRequest + (*HGetAllResponse)(nil), // 7: HGetAllResponse + (*HIncrByRequest)(nil), // 8: HIncrByRequest + (*HIncrByResponse)(nil), // 9: HIncrByResponse + (*HKeysRequest)(nil), // 10: HKeysRequest + (*HKeysResponse)(nil), // 11: HKeysResponse + (*HLenRequest)(nil), // 12: HLenRequest + (*HLenResponse)(nil), // 13: HLenResponse + (*HSetRequest)(nil), // 14: HSetRequest + (*HSetResponse)(nil), // 15: HSetResponse + (*HSetXRequest)(nil), // 16: HSetXRequest + (*HSetXResponse)(nil), // 17: HSetXResponse + nil, // 18: HGetResponse.ItemsEntry + nil, // 19: HGetAllResponse.ItemsEntry + nil, // 20: HIncrByResponse.ItemsEntry + nil, // 21: HSetRequest.ItemsEntry + nil, // 22: HSetXRequest.ItemsEntry + (*BaseKey)(nil), // 23: BaseKey +} +var file_hashx_proto_depIdxs = []int32{ + 23, // 0: HDelRequest.key:type_name -> BaseKey + 23, // 1: HExistsRequest.key:type_name -> BaseKey + 23, // 2: HGetRequest.key:type_name -> BaseKey + 18, // 3: HGetResponse.items:type_name -> HGetResponse.ItemsEntry + 23, // 4: HGetAllRequest.key:type_name -> BaseKey + 19, // 5: HGetAllResponse.items:type_name -> HGetAllResponse.ItemsEntry + 23, // 6: HIncrByRequest.key:type_name -> BaseKey + 20, // 7: HIncrByResponse.items:type_name -> HIncrByResponse.ItemsEntry + 23, // 8: HKeysRequest.key:type_name -> BaseKey + 23, // 9: HLenRequest.key:type_name -> BaseKey + 23, // 10: HSetRequest.key:type_name -> BaseKey + 21, // 11: HSetRequest.items:type_name -> HSetRequest.ItemsEntry + 23, // 12: HSetXRequest.key:type_name -> BaseKey + 22, // 13: HSetXRequest.items:type_name -> HSetXRequest.ItemsEntry + 14, // [14:14] is the sub-list for method output_type + 14, // [14:14] is the sub-list for method input_type + 14, // [14:14] is the sub-list for extension type_name + 14, // [14:14] is the sub-list for extension extendee + 0, // [0:14] is the sub-list for field type_name +} + +func init() { file_hashx_proto_init() } +func file_hashx_proto_init() { + if File_hashx_proto != nil { + return + } + file_base_proto_init() + if !protoimpl.UnsafeEnabled { + file_hashx_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HDelRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hashx_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HDelResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hashx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HExistsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hashx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HExistsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hashx_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HGetRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hashx_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HGetResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hashx_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HGetAllRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hashx_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HGetAllResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hashx_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HIncrByRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hashx_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HIncrByResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hashx_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HKeysRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hashx_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HKeysResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hashx_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HLenRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hashx_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HLenResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hashx_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HSetRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hashx_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HSetResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hashx_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HSetXRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hashx_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HSetXResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_hashx_proto_rawDesc, + NumEnums: 0, + NumMessages: 23, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_hashx_proto_goTypes, + DependencyIndexes: file_hashx_proto_depIdxs, + MessageInfos: file_hashx_proto_msgTypes, + }.Build() + File_hashx_proto = out.File + file_hashx_proto_rawDesc = nil + file_hashx_proto_goTypes = nil + file_hashx_proto_depIdxs = nil +} diff --git a/pkg/proto/storage.pb.go b/pkg/proto/storage.pb.go index 339dc92..cace64b 100644 --- a/pkg/proto/storage.pb.go +++ b/pkg/proto/storage.pb.go @@ -31,65 +31,88 @@ var File_storage_proto protoreflect.FileDescriptor var file_storage_proto_rawDesc = []byte{ 0x0a, 0x0d, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0d, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0b, - 0x6c, 0x69, 0x73, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xff, 0x06, 0x0a, 0x0a, - 0x43, 0x6f, 0x6d, 0x6d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x03, 0x53, 0x65, - 0x74, 0x12, 0x0b, 0x2e, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, - 0x2e, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x03, - 0x47, 0x65, 0x74, 0x12, 0x0b, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x0c, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, - 0x0a, 0x03, 0x41, 0x64, 0x64, 0x12, 0x0b, 0x2e, 0x41, 0x64, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x41, 0x64, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x29, 0x0a, 0x06, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, 0x12, 0x0e, 0x2e, 0x52, 0x65, 0x64, - 0x75, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x52, 0x65, 0x64, - 0x75, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x53, - 0x65, 0x74, 0x42, 0x69, 0x74, 0x12, 0x0e, 0x2e, 0x53, 0x65, 0x74, 0x42, 0x69, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x53, 0x65, 0x74, 0x42, 0x69, 0x74, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x47, 0x65, 0x74, 0x42, 0x69, 0x74, - 0x12, 0x0e, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x0f, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x2f, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x10, 0x2e, - 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x11, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x47, 0x65, 0x74, 0x53, 0x65, 0x74, 0x12, 0x0e, 0x2e, 0x47, - 0x65, 0x74, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x47, - 0x65, 0x74, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, - 0x06, 0x53, 0x74, 0x72, 0x4c, 0x65, 0x6e, 0x12, 0x0e, 0x2e, 0x53, 0x74, 0x72, 0x4c, 0x65, 0x6e, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x53, 0x74, 0x72, 0x4c, 0x65, 0x6e, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x05, 0x53, 0x65, 0x74, 0x6e, - 0x78, 0x12, 0x0d, 0x2e, 0x53, 0x65, 0x74, 0x6e, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x0e, 0x2e, 0x53, 0x65, 0x74, 0x6e, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x29, 0x0a, 0x06, 0x4c, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x0e, 0x2e, 0x4c, 0x49, 0x6e, - 0x64, 0x65, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x4c, 0x49, 0x6e, - 0x64, 0x65, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x4c, - 0x4c, 0x65, 0x6e, 0x12, 0x0c, 0x2e, 0x4c, 0x4c, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x0d, 0x2e, 0x4c, 0x4c, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x23, 0x0a, 0x04, 0x4c, 0x50, 0x6f, 0x70, 0x12, 0x0c, 0x2e, 0x4c, 0x50, 0x6f, 0x70, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x4c, 0x50, 0x6f, 0x70, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x05, 0x4c, 0x50, 0x75, 0x73, 0x68, 0x12, 0x0d, - 0x2e, 0x4c, 0x50, 0x75, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, - 0x4c, 0x50, 0x75, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, - 0x06, 0x4c, 0x50, 0x75, 0x73, 0x68, 0x58, 0x12, 0x0e, 0x2e, 0x4c, 0x50, 0x75, 0x73, 0x68, 0x58, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x4c, 0x50, 0x75, 0x73, 0x68, 0x58, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x4c, 0x52, 0x61, 0x6e, - 0x67, 0x65, 0x12, 0x0e, 0x2e, 0x4c, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x4c, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x4c, 0x52, 0x65, 0x6d, 0x12, 0x0c, 0x2e, 0x4c, 0x52, - 0x65, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x4c, 0x52, 0x65, 0x6d, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x4c, 0x53, 0x65, 0x74, - 0x12, 0x0c, 0x2e, 0x4c, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, - 0x2e, 0x4c, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, - 0x04, 0x52, 0x50, 0x6f, 0x70, 0x12, 0x0c, 0x2e, 0x52, 0x50, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x52, 0x50, 0x6f, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x26, 0x0a, 0x05, 0x4c, 0x54, 0x72, 0x69, 0x6d, 0x12, 0x0d, 0x2e, 0x4c, 0x54, - 0x72, 0x69, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x4c, 0x54, 0x72, - 0x69, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x05, 0x52, 0x50, - 0x75, 0x73, 0x68, 0x12, 0x0d, 0x2e, 0x52, 0x50, 0x75, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x52, 0x50, 0x75, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x52, 0x50, 0x75, 0x73, 0x68, 0x58, 0x12, 0x0e, 0x2e, 0x52, - 0x50, 0x75, 0x73, 0x68, 0x58, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x52, - 0x50, 0x75, 0x73, 0x68, 0x58, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x0b, 0x5a, - 0x09, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x6c, 0x69, 0x73, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0b, 0x68, 0x61, 0x73, + 0x68, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xed, 0x09, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, + 0x6d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x03, 0x53, 0x65, 0x74, 0x12, 0x0b, + 0x2e, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x53, 0x65, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x03, 0x47, 0x65, 0x74, + 0x12, 0x0b, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, + 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x03, 0x41, + 0x64, 0x64, 0x12, 0x0b, 0x2e, 0x41, 0x64, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x0c, 0x2e, 0x41, 0x64, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, + 0x06, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, 0x12, 0x0e, 0x2e, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x53, 0x65, 0x74, 0x42, + 0x69, 0x74, 0x12, 0x0e, 0x2e, 0x53, 0x65, 0x74, 0x42, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x53, 0x65, 0x74, 0x42, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x47, 0x65, 0x74, 0x42, 0x69, 0x74, 0x12, 0x0e, 0x2e, + 0x47, 0x65, 0x74, 0x42, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, + 0x47, 0x65, 0x74, 0x42, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, + 0x0a, 0x08, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x10, 0x2e, 0x47, 0x65, 0x74, + 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x47, + 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x29, 0x0a, 0x06, 0x47, 0x65, 0x74, 0x53, 0x65, 0x74, 0x12, 0x0e, 0x2e, 0x47, 0x65, 0x74, 0x53, + 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x47, 0x65, 0x74, 0x53, + 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x53, 0x74, + 0x72, 0x4c, 0x65, 0x6e, 0x12, 0x0e, 0x2e, 0x53, 0x74, 0x72, 0x4c, 0x65, 0x6e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x53, 0x74, 0x72, 0x4c, 0x65, 0x6e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x05, 0x53, 0x65, 0x74, 0x6e, 0x78, 0x12, 0x0d, + 0x2e, 0x53, 0x65, 0x74, 0x6e, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, + 0x53, 0x65, 0x74, 0x6e, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, + 0x06, 0x4c, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x0e, 0x2e, 0x4c, 0x49, 0x6e, 0x64, 0x65, 0x78, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x4c, 0x49, 0x6e, 0x64, 0x65, 0x78, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x4c, 0x4c, 0x65, 0x6e, + 0x12, 0x0c, 0x2e, 0x4c, 0x4c, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, + 0x2e, 0x4c, 0x4c, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, + 0x04, 0x4c, 0x50, 0x6f, 0x70, 0x12, 0x0c, 0x2e, 0x4c, 0x50, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x4c, 0x50, 0x6f, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x26, 0x0a, 0x05, 0x4c, 0x50, 0x75, 0x73, 0x68, 0x12, 0x0d, 0x2e, 0x4c, 0x50, + 0x75, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x4c, 0x50, 0x75, + 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x4c, 0x50, + 0x75, 0x73, 0x68, 0x58, 0x12, 0x0e, 0x2e, 0x4c, 0x50, 0x75, 0x73, 0x68, 0x58, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x4c, 0x50, 0x75, 0x73, 0x68, 0x58, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x4c, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, + 0x0e, 0x2e, 0x4c, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x0f, 0x2e, 0x4c, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x23, 0x0a, 0x04, 0x4c, 0x52, 0x65, 0x6d, 0x12, 0x0c, 0x2e, 0x4c, 0x52, 0x65, 0x6d, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x4c, 0x52, 0x65, 0x6d, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x4c, 0x53, 0x65, 0x74, 0x12, 0x0c, 0x2e, + 0x4c, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x4c, 0x53, + 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x52, 0x50, + 0x6f, 0x70, 0x12, 0x0c, 0x2e, 0x52, 0x50, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x0d, 0x2e, 0x52, 0x50, 0x6f, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x26, 0x0a, 0x05, 0x4c, 0x54, 0x72, 0x69, 0x6d, 0x12, 0x0d, 0x2e, 0x4c, 0x54, 0x72, 0x69, 0x6d, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x4c, 0x54, 0x72, 0x69, 0x6d, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x05, 0x52, 0x50, 0x75, 0x73, 0x68, + 0x12, 0x0d, 0x2e, 0x52, 0x50, 0x75, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x0e, 0x2e, 0x52, 0x50, 0x75, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x29, 0x0a, 0x06, 0x52, 0x50, 0x75, 0x73, 0x68, 0x58, 0x12, 0x0e, 0x2e, 0x52, 0x50, 0x75, 0x73, + 0x68, 0x58, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x52, 0x50, 0x75, 0x73, + 0x68, 0x58, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x48, 0x44, + 0x65, 0x6c, 0x12, 0x0c, 0x2e, 0x48, 0x44, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x0d, 0x2e, 0x48, 0x44, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x2c, 0x0a, 0x07, 0x48, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x12, 0x0f, 0x2e, 0x48, 0x45, 0x78, + 0x69, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x48, 0x45, + 0x78, 0x69, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, + 0x04, 0x48, 0x47, 0x65, 0x74, 0x12, 0x0c, 0x2e, 0x48, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x48, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x07, 0x48, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x12, 0x0f, 0x2e, + 0x48, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, + 0x2e, 0x48, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x2c, 0x0a, 0x07, 0x48, 0x49, 0x6e, 0x63, 0x72, 0x42, 0x79, 0x12, 0x0f, 0x2e, 0x48, 0x49, + 0x6e, 0x63, 0x72, 0x42, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x48, + 0x49, 0x6e, 0x63, 0x72, 0x42, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, + 0x0a, 0x05, 0x48, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x0d, 0x2e, 0x48, 0x4b, 0x65, 0x79, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x48, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x48, 0x4c, 0x65, 0x6e, 0x12, 0x0c, + 0x2e, 0x48, 0x4c, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x48, + 0x4c, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x48, + 0x53, 0x65, 0x74, 0x12, 0x0c, 0x2e, 0x48, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x0d, 0x2e, 0x48, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x26, 0x0a, 0x05, 0x48, 0x53, 0x65, 0x74, 0x58, 0x12, 0x0d, 0x2e, 0x48, 0x53, 0x65, 0x74, + 0x58, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x48, 0x53, 0x65, 0x74, 0x58, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x0b, 0x5a, 0x09, 0x70, 0x6b, 0x67, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var file_storage_proto_goTypes = []interface{}{ @@ -115,28 +138,46 @@ var file_storage_proto_goTypes = []interface{}{ (*LTrimRequest)(nil), // 19: LTrimRequest (*RPushRequest)(nil), // 20: RPushRequest (*RPushXRequest)(nil), // 21: RPushXRequest - (*SetResponse)(nil), // 22: SetResponse - (*GetResponse)(nil), // 23: GetResponse - (*AddResponse)(nil), // 24: AddResponse - (*ReduceResponse)(nil), // 25: ReduceResponse - (*SetBitResponse)(nil), // 26: SetBitResponse - (*GetBitResponse)(nil), // 27: GetBitResponse - (*GetRangeResponse)(nil), // 28: GetRangeResponse - (*GetSetResponse)(nil), // 29: GetSetResponse - (*StrLenResponse)(nil), // 30: StrLenResponse - (*SetnxResponse)(nil), // 31: SetnxResponse - (*LIndexResponse)(nil), // 32: LIndexResponse - (*LLenResponse)(nil), // 33: LLenResponse - (*LPopResponse)(nil), // 34: LPopResponse - (*LPushResponse)(nil), // 35: LPushResponse - (*LPushXResponse)(nil), // 36: LPushXResponse - (*LRangeResponse)(nil), // 37: LRangeResponse - (*LRemResponse)(nil), // 38: LRemResponse - (*LSetResponse)(nil), // 39: LSetResponse - (*RPopResponse)(nil), // 40: RPopResponse - (*LTrimResponse)(nil), // 41: LTrimResponse - (*RPushResponse)(nil), // 42: RPushResponse - (*RPushXResponse)(nil), // 43: RPushXResponse + (*HDelRequest)(nil), // 22: HDelRequest + (*HExistsRequest)(nil), // 23: HExistsRequest + (*HGetRequest)(nil), // 24: HGetRequest + (*HGetAllRequest)(nil), // 25: HGetAllRequest + (*HIncrByRequest)(nil), // 26: HIncrByRequest + (*HKeysRequest)(nil), // 27: HKeysRequest + (*HLenRequest)(nil), // 28: HLenRequest + (*HSetRequest)(nil), // 29: HSetRequest + (*HSetXRequest)(nil), // 30: HSetXRequest + (*SetResponse)(nil), // 31: SetResponse + (*GetResponse)(nil), // 32: GetResponse + (*AddResponse)(nil), // 33: AddResponse + (*ReduceResponse)(nil), // 34: ReduceResponse + (*SetBitResponse)(nil), // 35: SetBitResponse + (*GetBitResponse)(nil), // 36: GetBitResponse + (*GetRangeResponse)(nil), // 37: GetRangeResponse + (*GetSetResponse)(nil), // 38: GetSetResponse + (*StrLenResponse)(nil), // 39: StrLenResponse + (*SetnxResponse)(nil), // 40: SetnxResponse + (*LIndexResponse)(nil), // 41: LIndexResponse + (*LLenResponse)(nil), // 42: LLenResponse + (*LPopResponse)(nil), // 43: LPopResponse + (*LPushResponse)(nil), // 44: LPushResponse + (*LPushXResponse)(nil), // 45: LPushXResponse + (*LRangeResponse)(nil), // 46: LRangeResponse + (*LRemResponse)(nil), // 47: LRemResponse + (*LSetResponse)(nil), // 48: LSetResponse + (*RPopResponse)(nil), // 49: RPopResponse + (*LTrimResponse)(nil), // 50: LTrimResponse + (*RPushResponse)(nil), // 51: RPushResponse + (*RPushXResponse)(nil), // 52: RPushXResponse + (*HDelResponse)(nil), // 53: HDelResponse + (*HExistsResponse)(nil), // 54: HExistsResponse + (*HGetResponse)(nil), // 55: HGetResponse + (*HGetAllResponse)(nil), // 56: HGetAllResponse + (*HIncrByResponse)(nil), // 57: HIncrByResponse + (*HKeysResponse)(nil), // 58: HKeysResponse + (*HLenResponse)(nil), // 59: HLenResponse + (*HSetResponse)(nil), // 60: HSetResponse + (*HSetXResponse)(nil), // 61: HSetXResponse } var file_storage_proto_depIdxs = []int32{ 0, // 0: CommServer.Set:input_type -> SetRequest @@ -161,30 +202,48 @@ var file_storage_proto_depIdxs = []int32{ 19, // 19: CommServer.LTrim:input_type -> LTrimRequest 20, // 20: CommServer.RPush:input_type -> RPushRequest 21, // 21: CommServer.RPushX:input_type -> RPushXRequest - 22, // 22: CommServer.Set:output_type -> SetResponse - 23, // 23: CommServer.Get:output_type -> GetResponse - 24, // 24: CommServer.Add:output_type -> AddResponse - 25, // 25: CommServer.Reduce:output_type -> ReduceResponse - 26, // 26: CommServer.SetBit:output_type -> SetBitResponse - 27, // 27: CommServer.GetBit:output_type -> GetBitResponse - 28, // 28: CommServer.GetRange:output_type -> GetRangeResponse - 29, // 29: CommServer.GetSet:output_type -> GetSetResponse - 30, // 30: CommServer.StrLen:output_type -> StrLenResponse - 31, // 31: CommServer.Setnx:output_type -> SetnxResponse - 32, // 32: CommServer.LIndex:output_type -> LIndexResponse - 33, // 33: CommServer.LLen:output_type -> LLenResponse - 34, // 34: CommServer.LPop:output_type -> LPopResponse - 35, // 35: CommServer.LPush:output_type -> LPushResponse - 36, // 36: CommServer.LPushX:output_type -> LPushXResponse - 37, // 37: CommServer.LRange:output_type -> LRangeResponse - 38, // 38: CommServer.LRem:output_type -> LRemResponse - 39, // 39: CommServer.LSet:output_type -> LSetResponse - 40, // 40: CommServer.RPop:output_type -> RPopResponse - 41, // 41: CommServer.LTrim:output_type -> LTrimResponse - 42, // 42: CommServer.RPush:output_type -> RPushResponse - 43, // 43: CommServer.RPushX:output_type -> RPushXResponse - 22, // [22:44] is the sub-list for method output_type - 0, // [0:22] is the sub-list for method input_type + 22, // 22: CommServer.HDel:input_type -> HDelRequest + 23, // 23: CommServer.HExists:input_type -> HExistsRequest + 24, // 24: CommServer.HGet:input_type -> HGetRequest + 25, // 25: CommServer.HGetAll:input_type -> HGetAllRequest + 26, // 26: CommServer.HIncrBy:input_type -> HIncrByRequest + 27, // 27: CommServer.HKeys:input_type -> HKeysRequest + 28, // 28: CommServer.HLen:input_type -> HLenRequest + 29, // 29: CommServer.HSet:input_type -> HSetRequest + 30, // 30: CommServer.HSetX:input_type -> HSetXRequest + 31, // 31: CommServer.Set:output_type -> SetResponse + 32, // 32: CommServer.Get:output_type -> GetResponse + 33, // 33: CommServer.Add:output_type -> AddResponse + 34, // 34: CommServer.Reduce:output_type -> ReduceResponse + 35, // 35: CommServer.SetBit:output_type -> SetBitResponse + 36, // 36: CommServer.GetBit:output_type -> GetBitResponse + 37, // 37: CommServer.GetRange:output_type -> GetRangeResponse + 38, // 38: CommServer.GetSet:output_type -> GetSetResponse + 39, // 39: CommServer.StrLen:output_type -> StrLenResponse + 40, // 40: CommServer.Setnx:output_type -> SetnxResponse + 41, // 41: CommServer.LIndex:output_type -> LIndexResponse + 42, // 42: CommServer.LLen:output_type -> LLenResponse + 43, // 43: CommServer.LPop:output_type -> LPopResponse + 44, // 44: CommServer.LPush:output_type -> LPushResponse + 45, // 45: CommServer.LPushX:output_type -> LPushXResponse + 46, // 46: CommServer.LRange:output_type -> LRangeResponse + 47, // 47: CommServer.LRem:output_type -> LRemResponse + 48, // 48: CommServer.LSet:output_type -> LSetResponse + 49, // 49: CommServer.RPop:output_type -> RPopResponse + 50, // 50: CommServer.LTrim:output_type -> LTrimResponse + 51, // 51: CommServer.RPush:output_type -> RPushResponse + 52, // 52: CommServer.RPushX:output_type -> RPushXResponse + 53, // 53: CommServer.HDel:output_type -> HDelResponse + 54, // 54: CommServer.HExists:output_type -> HExistsResponse + 55, // 55: CommServer.HGet:output_type -> HGetResponse + 56, // 56: CommServer.HGetAll:output_type -> HGetAllResponse + 57, // 57: CommServer.HIncrBy:output_type -> HIncrByResponse + 58, // 58: CommServer.HKeys:output_type -> HKeysResponse + 59, // 59: CommServer.HLen:output_type -> HLenResponse + 60, // 60: CommServer.HSet:output_type -> HSetResponse + 61, // 61: CommServer.HSetX:output_type -> HSetXResponse + 31, // [31:62] is the sub-list for method output_type + 0, // [0:31] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name @@ -197,6 +256,7 @@ func file_storage_proto_init() { } file_stringx_proto_init() file_listx_proto_init() + file_hashx_proto_init() type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ @@ -250,6 +310,15 @@ type CommServerClient interface { LTrim(ctx context.Context, in *LTrimRequest, opts ...grpc.CallOption) (*LTrimResponse, error) RPush(ctx context.Context, in *RPushRequest, opts ...grpc.CallOption) (*RPushResponse, error) RPushX(ctx context.Context, in *RPushXRequest, opts ...grpc.CallOption) (*RPushXResponse, error) + HDel(ctx context.Context, in *HDelRequest, opts ...grpc.CallOption) (*HDelResponse, error) + HExists(ctx context.Context, in *HExistsRequest, opts ...grpc.CallOption) (*HExistsResponse, error) + HGet(ctx context.Context, in *HGetRequest, opts ...grpc.CallOption) (*HGetResponse, error) + HGetAll(ctx context.Context, in *HGetAllRequest, opts ...grpc.CallOption) (*HGetAllResponse, error) + HIncrBy(ctx context.Context, in *HIncrByRequest, opts ...grpc.CallOption) (*HIncrByResponse, error) + HKeys(ctx context.Context, in *HKeysRequest, opts ...grpc.CallOption) (*HKeysResponse, error) + HLen(ctx context.Context, in *HLenRequest, opts ...grpc.CallOption) (*HLenResponse, error) + HSet(ctx context.Context, in *HSetRequest, opts ...grpc.CallOption) (*HSetResponse, error) + HSetX(ctx context.Context, in *HSetXRequest, opts ...grpc.CallOption) (*HSetXResponse, error) } type commServerClient struct { @@ -458,6 +527,87 @@ func (c *commServerClient) RPushX(ctx context.Context, in *RPushXRequest, opts . return out, nil } +func (c *commServerClient) HDel(ctx context.Context, in *HDelRequest, opts ...grpc.CallOption) (*HDelResponse, error) { + out := new(HDelResponse) + err := c.cc.Invoke(ctx, "/CommServer/HDel", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *commServerClient) HExists(ctx context.Context, in *HExistsRequest, opts ...grpc.CallOption) (*HExistsResponse, error) { + out := new(HExistsResponse) + err := c.cc.Invoke(ctx, "/CommServer/HExists", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *commServerClient) HGet(ctx context.Context, in *HGetRequest, opts ...grpc.CallOption) (*HGetResponse, error) { + out := new(HGetResponse) + err := c.cc.Invoke(ctx, "/CommServer/HGet", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *commServerClient) HGetAll(ctx context.Context, in *HGetAllRequest, opts ...grpc.CallOption) (*HGetAllResponse, error) { + out := new(HGetAllResponse) + err := c.cc.Invoke(ctx, "/CommServer/HGetAll", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *commServerClient) HIncrBy(ctx context.Context, in *HIncrByRequest, opts ...grpc.CallOption) (*HIncrByResponse, error) { + out := new(HIncrByResponse) + err := c.cc.Invoke(ctx, "/CommServer/HIncrBy", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *commServerClient) HKeys(ctx context.Context, in *HKeysRequest, opts ...grpc.CallOption) (*HKeysResponse, error) { + out := new(HKeysResponse) + err := c.cc.Invoke(ctx, "/CommServer/HKeys", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *commServerClient) HLen(ctx context.Context, in *HLenRequest, opts ...grpc.CallOption) (*HLenResponse, error) { + out := new(HLenResponse) + err := c.cc.Invoke(ctx, "/CommServer/HLen", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *commServerClient) HSet(ctx context.Context, in *HSetRequest, opts ...grpc.CallOption) (*HSetResponse, error) { + out := new(HSetResponse) + err := c.cc.Invoke(ctx, "/CommServer/HSet", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *commServerClient) HSetX(ctx context.Context, in *HSetXRequest, opts ...grpc.CallOption) (*HSetXResponse, error) { + out := new(HSetXResponse) + err := c.cc.Invoke(ctx, "/CommServer/HSetX", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // CommServerServer is the server API for CommServer service. type CommServerServer interface { Set(context.Context, *SetRequest) (*SetResponse, error) @@ -482,6 +632,15 @@ type CommServerServer interface { LTrim(context.Context, *LTrimRequest) (*LTrimResponse, error) RPush(context.Context, *RPushRequest) (*RPushResponse, error) RPushX(context.Context, *RPushXRequest) (*RPushXResponse, error) + HDel(context.Context, *HDelRequest) (*HDelResponse, error) + HExists(context.Context, *HExistsRequest) (*HExistsResponse, error) + HGet(context.Context, *HGetRequest) (*HGetResponse, error) + HGetAll(context.Context, *HGetAllRequest) (*HGetAllResponse, error) + HIncrBy(context.Context, *HIncrByRequest) (*HIncrByResponse, error) + HKeys(context.Context, *HKeysRequest) (*HKeysResponse, error) + HLen(context.Context, *HLenRequest) (*HLenResponse, error) + HSet(context.Context, *HSetRequest) (*HSetResponse, error) + HSetX(context.Context, *HSetXRequest) (*HSetXResponse, error) } // UnimplementedCommServerServer can be embedded to have forward compatible implementations. @@ -554,6 +713,33 @@ func (*UnimplementedCommServerServer) RPush(context.Context, *RPushRequest) (*RP func (*UnimplementedCommServerServer) RPushX(context.Context, *RPushXRequest) (*RPushXResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RPushX not implemented") } +func (*UnimplementedCommServerServer) HDel(context.Context, *HDelRequest) (*HDelResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HDel not implemented") +} +func (*UnimplementedCommServerServer) HExists(context.Context, *HExistsRequest) (*HExistsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HExists not implemented") +} +func (*UnimplementedCommServerServer) HGet(context.Context, *HGetRequest) (*HGetResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HGet not implemented") +} +func (*UnimplementedCommServerServer) HGetAll(context.Context, *HGetAllRequest) (*HGetAllResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HGetAll not implemented") +} +func (*UnimplementedCommServerServer) HIncrBy(context.Context, *HIncrByRequest) (*HIncrByResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HIncrBy not implemented") +} +func (*UnimplementedCommServerServer) HKeys(context.Context, *HKeysRequest) (*HKeysResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HKeys not implemented") +} +func (*UnimplementedCommServerServer) HLen(context.Context, *HLenRequest) (*HLenResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HLen not implemented") +} +func (*UnimplementedCommServerServer) HSet(context.Context, *HSetRequest) (*HSetResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HSet not implemented") +} +func (*UnimplementedCommServerServer) HSetX(context.Context, *HSetXRequest) (*HSetXResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HSetX not implemented") +} func RegisterCommServerServer(s *grpc.Server, srv CommServerServer) { s.RegisterService(&_CommServer_serviceDesc, srv) @@ -955,6 +1141,168 @@ func _CommServer_RPushX_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +func _CommServer_HDel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HDelRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CommServerServer).HDel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/CommServer/HDel", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CommServerServer).HDel(ctx, req.(*HDelRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CommServer_HExists_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HExistsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CommServerServer).HExists(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/CommServer/HExists", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CommServerServer).HExists(ctx, req.(*HExistsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CommServer_HGet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HGetRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CommServerServer).HGet(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/CommServer/HGet", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CommServerServer).HGet(ctx, req.(*HGetRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CommServer_HGetAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HGetAllRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CommServerServer).HGetAll(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/CommServer/HGetAll", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CommServerServer).HGetAll(ctx, req.(*HGetAllRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CommServer_HIncrBy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HIncrByRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CommServerServer).HIncrBy(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/CommServer/HIncrBy", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CommServerServer).HIncrBy(ctx, req.(*HIncrByRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CommServer_HKeys_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HKeysRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CommServerServer).HKeys(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/CommServer/HKeys", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CommServerServer).HKeys(ctx, req.(*HKeysRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CommServer_HLen_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HLenRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CommServerServer).HLen(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/CommServer/HLen", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CommServerServer).HLen(ctx, req.(*HLenRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CommServer_HSet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HSetRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CommServerServer).HSet(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/CommServer/HSet", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CommServerServer).HSet(ctx, req.(*HSetRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CommServer_HSetX_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HSetXRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CommServerServer).HSetX(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/CommServer/HSetX", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CommServerServer).HSetX(ctx, req.(*HSetXRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _CommServer_serviceDesc = grpc.ServiceDesc{ ServiceName: "CommServer", HandlerType: (*CommServerServer)(nil), @@ -1047,6 +1395,42 @@ var _CommServer_serviceDesc = grpc.ServiceDesc{ MethodName: "RPushX", Handler: _CommServer_RPushX_Handler, }, + { + MethodName: "HDel", + Handler: _CommServer_HDel_Handler, + }, + { + MethodName: "HExists", + Handler: _CommServer_HExists_Handler, + }, + { + MethodName: "HGet", + Handler: _CommServer_HGet_Handler, + }, + { + MethodName: "HGetAll", + Handler: _CommServer_HGetAll_Handler, + }, + { + MethodName: "HIncrBy", + Handler: _CommServer_HIncrBy_Handler, + }, + { + MethodName: "HKeys", + Handler: _CommServer_HKeys_Handler, + }, + { + MethodName: "HLen", + Handler: _CommServer_HLen_Handler, + }, + { + MethodName: "HSet", + Handler: _CommServer_HSet_Handler, + }, + { + MethodName: "HSetX", + Handler: _CommServer_HSetX_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "storage.proto", diff --git a/protobuf/hashx.proto b/protobuf/hashx.proto new file mode 100644 index 0000000..850dce6 --- /dev/null +++ b/protobuf/hashx.proto @@ -0,0 +1,78 @@ +syntax = "proto3"; +import "base.proto"; +option go_package = "pkg/proto"; + +message HDelRequest { + BaseKey key = 1; + repeated string h_keys = 2; +} + +message HDelResponse { +} + +message HExistsRequest { + BaseKey key = 1; + string h_key = 2; +} + +message HExistsResponse { +} + +message HGetRequest { + BaseKey key = 1; + repeated string h_keys = 2; +} + +message HGetResponse { + map items = 1; +} + +message HGetAllRequest { + BaseKey key = 1; +} + +message HGetAllResponse { + map items = 1; +} + +message HIncrByRequest { + BaseKey key = 1; + repeated string h_keys = 2; +} + +message HIncrByResponse { + map items = 1; +} + +message HKeysRequest { + BaseKey key = 1; +} + +message HKeysResponse { + repeated string keys = 1; +} + +message HLenRequest { + BaseKey key = 1; +} + +message HLenResponse { + int32 length = 1; +} + +message HSetRequest { + BaseKey key = 1; + map items = 2; +} + +message HSetResponse { +} + +message HSetXRequest { + BaseKey key = 1; + map items = 2; +} + +message HSetXResponse { + int32 count = 1; +} diff --git a/protobuf/storage.proto b/protobuf/storage.proto index 281f436..ab0737c 100644 --- a/protobuf/storage.proto +++ b/protobuf/storage.proto @@ -7,6 +7,7 @@ option go_package = "pkg/proto"; import "stringx.proto"; import "listx.proto"; +import "hashx.proto"; service CommServer { @@ -32,4 +33,13 @@ service CommServer { rpc LTrim (LTrimRequest) returns (LTrimResponse); rpc RPush (RPushRequest) returns (RPushResponse); rpc RPushX (RPushXRequest) returns (RPushXResponse); + rpc HDel (HDelRequest) returns (HDelResponse); + rpc HExists (HExistsRequest) returns (HExistsResponse); + rpc HGet (HGetRequest) returns (HGetResponse); + rpc HGetAll (HGetAllRequest) returns (HGetAllResponse); + rpc HIncrBy (HIncrByRequest) returns (HIncrByResponse); + rpc HKeys (HKeysRequest) returns (HKeysResponse); + rpc HLen (HLenRequest) returns (HLenResponse); + rpc HSet (HSetRequest) returns (HSetResponse); + rpc HSetX (HSetXRequest) returns (HSetXResponse); } \ No newline at end of file diff --git a/shell/proto.py b/shell/proto.py index 9c2b57f..df99313 100644 --- a/shell/proto.py +++ b/shell/proto.py @@ -17,6 +17,7 @@ def out_proto(): if err: print(f, "-> out put err") + return os._exit(-1) else: print(f, "-> success") diff --git a/storage/temp/const.gen.go b/storage/temp/const.gen.go index 6658c68..d861166 100644 --- a/storage/temp/const.gen.go +++ b/storage/temp/const.gen.go @@ -8,6 +8,7 @@ const ( STRING_X LIST_X + HASH_X ) const ( @@ -34,6 +35,15 @@ const ( LTrim RPush RPushX + HDel + HExists + HGet + HGetAll + HIncrBy + HKeys + HLen + HSet + HSetX ) var CommKeyString = map[string]int{ @@ -60,6 +70,16 @@ var CommKeyString = map[string]int{ "LTrim": LIST_X, "RPush": LIST_X, "RPushX": LIST_X, + + "HDel": HASH_X, + "HExists": HASH_X, + "HGet": HASH_X, + "HGetAll": HASH_X, + "HIncrBy": HASH_X, + "HKeys": HASH_X, + "HLen": HASH_X, + "HSet": HASH_X, + "HSetX": HASH_X, } var CommKey = map[int]int{ @@ -86,4 +106,14 @@ var CommKey = map[int]int{ LTrim: LIST_X, RPush: LIST_X, RPushX: LIST_X, + + HDel: HASH_X, + HExists: HASH_X, + HGet: HASH_X, + HGetAll: HASH_X, + HIncrBy: HASH_X, + HKeys: HASH_X, + HLen: HASH_X, + HSet: HASH_X, + HSetX: HASH_X, } From dcada2f2fee7f97130f39bafe412dfadbc1b8ccf Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Thu, 4 Nov 2021 20:17:24 +0800 Subject: [PATCH 03/12] feat(shell): add parse proto map --- shell/make_service.py | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/shell/make_service.py b/shell/make_service.py index 218ea0e..83ffbba 100644 --- a/shell/make_service.py +++ b/shell/make_service.py @@ -32,6 +32,9 @@ class ProtoOption(object): def dist_to_ProOpt(req, resp) -> List[ProtoOption]: + def to_camel(val: str) -> str: + return "".join([k.capitalize() for k in val.split('_')]) + def parse_type(l: str) -> List[str]: l = l.strip() if l == "": @@ -48,14 +51,19 @@ def dist_to_ProOpt(req, resp) -> List[ProtoOption]: val = l_list[0] if val == "BaseKey": val = "*proto.BaseKey" - result.append([l_list[1].capitalize(), val]) + result.append([to_camel(l_list[1]), val]) elif val == "repeated": val = f"[]{l_list[1]}" - result.append([l_list[2].capitalize(), val]) - + result.append([to_camel(l_list[2]), val]) + elif "map" in val: + resMap = re.findall( + r"^map\s*<(.*?)\s*,\s*(.*?)\s*>.*?(\w+).*?", l_opt) + if len(resMap[0]) == 3: + mapKey, mapVal, var = resMap[0] + result.append([to_camel(var), f"map[{mapKey}]{mapVal}"]) else: - result.append([l_list[1].capitalize(), val]) + result.append([to_camel(l_list[1]), val]) return result lists = [] @@ -104,6 +112,7 @@ def load_protobuf() -> List[ProtoOption]: li.extend(parse_protobuf_to_Opt(name)) return li + def go_fmt(path: str): os.system(f"go fmt {path}") @@ -112,6 +121,7 @@ def load_template(name: str) -> str: with open(f"{tempPath}/{name}", "r", encoding="utf-8") as fp: return fp.read() + def gen_dao_interface(proto): tem_text = load_template("dao.template") @@ -134,6 +144,7 @@ def gen_single_service(proto): with open(temp_path, 'w', encoding='utf-8') as f: f.write(text) + def gen_aof(proto): tem_text = load_template("aof.template") template = Template(tem_text) @@ -143,7 +154,7 @@ def gen_aof(proto): temp_path = f"{aofPath}/codec.gen.go" with open(temp_path, 'w', encoding='utf-8') as f: f.write(text) - + # 生成 AOF 恢复机制 tem_text = load_template("dao_aof.template") template = Template(tem_text) @@ -154,12 +165,14 @@ def gen_aof(proto): with open(temp_path, 'w', encoding='utf-8') as f: f.write(text) + def format_code_go(): go_fmt(f"{daoPath}/interface.gen.go") go_fmt(f"{servicePath}/single_service.gen.go") go_fmt(f"{aofPath}/codec.gen.go") go_fmt(f"{daoPath}/dao.gen.go") + def main(): # 加载 protobuf protobuf = load_protobuf() @@ -174,5 +187,6 @@ def main(): gen_aof(protobuf) format_code_go() + if __name__ == "__main__": main() From 047c91027870a9c5af0b1f36b6c31ba14f9d224d Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Thu, 4 Nov 2021 20:36:42 +0800 Subject: [PATCH 04/12] chore(service): update service --- storage/dao/dao.gen.go | 27 +++ storage/dao/hashx.go | 39 ++++ storage/dao/interface.gen.go | 9 + storage/persisted/codec.gen.go | 99 ++++++++++ storage/service/single_service.gen.go | 252 ++++++++++++++++++++++++++ 5 files changed, 426 insertions(+) create mode 100644 storage/dao/hashx.go diff --git a/storage/dao/dao.gen.go b/storage/dao/dao.gen.go index 25d1c59..2c10fce 100644 --- a/storage/dao/dao.gen.go +++ b/storage/dao/dao.gen.go @@ -59,6 +59,33 @@ func (d *Dao) ExecMessage(message protobuf.Message) error { case *proto.RPushXRequest: _, err := d.RPushX(req.Key, req.Values) return err + case *proto.HDelRequest: + _, err := d.HDel(req.Key, req.HKeys) + return err + case *proto.HExistsRequest: + _, err := d.HExists(req.Key, req.HKey) + return err + case *proto.HGetRequest: + _, err := d.HGet(req.Key, req.HKeys) + return err + case *proto.HGetAllRequest: + _, err := d.HGetAll(req.Key) + return err + case *proto.HIncrByRequest: + _, err := d.HIncrBy(req.Key, req.HKeys) + return err + case *proto.HKeysRequest: + _, err := d.HKeys(req.Key) + return err + case *proto.HLenRequest: + _, err := d.HLen(req.Key) + return err + case *proto.HSetRequest: + _, err := d.HSet(req.Key, req.Items) + return err + case *proto.HSetXRequest: + _, err := d.HSetX(req.Key, req.Items) + return err case *proto.SetRequest: _, err := d.Set(req.Key, req.Val) return err diff --git a/storage/dao/hashx.go b/storage/dao/hashx.go new file mode 100644 index 0000000..6edcab9 --- /dev/null +++ b/storage/dao/hashx.go @@ -0,0 +1,39 @@ +package dao + +import "gitee.com/wheat-os/wheatCache/pkg/proto" + +func (d *Dao) HDel(key *proto.BaseKey, hKeys []string) (*proto.HDelResponse, error) { + panic("not implemented") // TODO: Implement +} + +func (d *Dao) HExists(_ *proto.BaseKey, _ string) (*proto.HExistsResponse, error) { + panic("not implemented") // TODO: Implement +} + +func (d *Dao) HGet(_ *proto.BaseKey, _ []string) (*proto.HGetResponse, error) { + panic("not implemented") // TODO: Implement +} + +func (d *Dao) HGetAll(_ *proto.BaseKey) (*proto.HGetAllResponse, error) { + panic("not implemented") // TODO: Implement +} + +func (d *Dao) HIncrBy(_ *proto.BaseKey, _ []string) (*proto.HIncrByResponse, error) { + panic("not implemented") // TODO: Implement +} + +func (d *Dao) HKeys(_ *proto.BaseKey) (*proto.HKeysResponse, error) { + panic("not implemented") // TODO: Implement +} + +func (d *Dao) HLen(_ *proto.BaseKey) (*proto.HLenResponse, error) { + panic("not implemented") // TODO: Implement +} + +func (d *Dao) HSet(_ *proto.BaseKey, _ map[string]string) (*proto.HSetResponse, error) { + panic("not implemented") // TODO: Implement +} + +func (d *Dao) HSetX(_ *proto.BaseKey, _ map[string]string) (*proto.HSetXResponse, error) { + panic("not implemented") // TODO: Implement +} diff --git a/storage/dao/interface.gen.go b/storage/dao/interface.gen.go index 8d5a878..582c6a9 100644 --- a/storage/dao/interface.gen.go +++ b/storage/dao/interface.gen.go @@ -21,6 +21,15 @@ type Interface interface { LTrim(*proto.BaseKey, int32, int32) (*proto.LTrimResponse, error) RPush(*proto.BaseKey, []string) (*proto.RPushResponse, error) RPushX(*proto.BaseKey, []string) (*proto.RPushXResponse, error) + HDel(*proto.BaseKey, []string) (*proto.HDelResponse, error) + HExists(*proto.BaseKey, string) (*proto.HExistsResponse, error) + HGet(*proto.BaseKey, []string) (*proto.HGetResponse, error) + HGetAll(*proto.BaseKey) (*proto.HGetAllResponse, error) + HIncrBy(*proto.BaseKey, []string) (*proto.HIncrByResponse, error) + HKeys(*proto.BaseKey) (*proto.HKeysResponse, error) + HLen(*proto.BaseKey) (*proto.HLenResponse, error) + HSet(*proto.BaseKey, map[string]string) (*proto.HSetResponse, error) + HSetX(*proto.BaseKey, map[string]string) (*proto.HSetXResponse, error) Set(*proto.BaseKey, string) (*proto.SetResponse, error) Get(*proto.BaseKey) (*proto.GetResponse, error) Add(*proto.BaseKey, int32) (*proto.AddResponse, error) diff --git a/storage/persisted/codec.gen.go b/storage/persisted/codec.gen.go index faf168b..ec7fd3b 100644 --- a/storage/persisted/codec.gen.go +++ b/storage/persisted/codec.gen.go @@ -72,6 +72,24 @@ func decode(method string, buf []byte) (protobuf.Message, error) { return decodeRPush(buf) case "RPushX": return decodeRPushX(buf) + case "HDel": + return decodeHDel(buf) + case "HExists": + return decodeHExists(buf) + case "HGet": + return decodeHGet(buf) + case "HGetAll": + return decodeHGetAll(buf) + case "HIncrBy": + return decodeHIncrBy(buf) + case "HKeys": + return decodeHKeys(buf) + case "HLen": + return decodeHLen(buf) + case "HSet": + return decodeHSet(buf) + case "HSetX": + return decodeHSetX(buf) case "Set": return decodeSet(buf) case "Get": @@ -206,6 +224,87 @@ func decodeRPushX(buf []byte) (*proto.RPushXRequest, error) { return req, nil } +func decodeHDel(buf []byte) (*proto.HDelRequest, error) { + req := &proto.HDelRequest{} + err := protobuf.Unmarshal(buf, req) + if err != nil { + return nil, err + } + return req, nil +} + +func decodeHExists(buf []byte) (*proto.HExistsRequest, error) { + req := &proto.HExistsRequest{} + err := protobuf.Unmarshal(buf, req) + if err != nil { + return nil, err + } + return req, nil +} + +func decodeHGet(buf []byte) (*proto.HGetRequest, error) { + req := &proto.HGetRequest{} + err := protobuf.Unmarshal(buf, req) + if err != nil { + return nil, err + } + return req, nil +} + +func decodeHGetAll(buf []byte) (*proto.HGetAllRequest, error) { + req := &proto.HGetAllRequest{} + err := protobuf.Unmarshal(buf, req) + if err != nil { + return nil, err + } + return req, nil +} + +func decodeHIncrBy(buf []byte) (*proto.HIncrByRequest, error) { + req := &proto.HIncrByRequest{} + err := protobuf.Unmarshal(buf, req) + if err != nil { + return nil, err + } + return req, nil +} + +func decodeHKeys(buf []byte) (*proto.HKeysRequest, error) { + req := &proto.HKeysRequest{} + err := protobuf.Unmarshal(buf, req) + if err != nil { + return nil, err + } + return req, nil +} + +func decodeHLen(buf []byte) (*proto.HLenRequest, error) { + req := &proto.HLenRequest{} + err := protobuf.Unmarshal(buf, req) + if err != nil { + return nil, err + } + return req, nil +} + +func decodeHSet(buf []byte) (*proto.HSetRequest, error) { + req := &proto.HSetRequest{} + err := protobuf.Unmarshal(buf, req) + if err != nil { + return nil, err + } + return req, nil +} + +func decodeHSetX(buf []byte) (*proto.HSetXRequest, error) { + req := &proto.HSetXRequest{} + err := protobuf.Unmarshal(buf, req) + if err != nil { + return nil, err + } + return req, nil +} + func decodeSet(buf []byte) (*proto.SetRequest, error) { req := &proto.SetRequest{} err := protobuf.Unmarshal(buf, req) diff --git a/storage/service/single_service.gen.go b/storage/service/single_service.gen.go index 354223d..87a5590 100644 --- a/storage/service/single_service.gen.go +++ b/storage/service/single_service.gen.go @@ -346,6 +346,258 @@ func (s *singleService) RPushX( return resp.(*proto.RPushXResponse), nil } +func (s *singleService) HDel( + ctx context.Context, + req *proto.HDelRequest, +) (*proto.HDelResponse, error) { + work := event.EventWorkFunc(func() (interface{}, error) { + resp, err := s.dao.HDel(req.Key, req.HKeys) + if err != nil { + return nil, err + } + if s.aof != nil { + s.aof.SendRequest("HDel", req) + } + return resp, nil + }) + + lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) + lruEvent.InitWaitEvent() + lruEvent.SetValue(lru.WorkFuncEventKey, work) + s.lruProduce.Call(ctx, lruEvent) + resp, err := lruEvent.StartWaitEvent(s.timeOut) + s.lruProduce.Recovery(lruEvent) + if err != nil { + return nil, err + } + + return resp.(*proto.HDelResponse), nil +} + +func (s *singleService) HExists( + ctx context.Context, + req *proto.HExistsRequest, +) (*proto.HExistsResponse, error) { + work := event.EventWorkFunc(func() (interface{}, error) { + resp, err := s.dao.HExists(req.Key, req.HKey) + if err != nil { + return nil, err + } + if s.aof != nil { + s.aof.SendRequest("HExists", req) + } + return resp, nil + }) + + lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) + lruEvent.InitWaitEvent() + lruEvent.SetValue(lru.WorkFuncEventKey, work) + s.lruProduce.Call(ctx, lruEvent) + resp, err := lruEvent.StartWaitEvent(s.timeOut) + s.lruProduce.Recovery(lruEvent) + if err != nil { + return nil, err + } + + return resp.(*proto.HExistsResponse), nil +} + +func (s *singleService) HGet( + ctx context.Context, + req *proto.HGetRequest, +) (*proto.HGetResponse, error) { + work := event.EventWorkFunc(func() (interface{}, error) { + resp, err := s.dao.HGet(req.Key, req.HKeys) + if err != nil { + return nil, err + } + if s.aof != nil { + s.aof.SendRequest("HGet", req) + } + return resp, nil + }) + + lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) + lruEvent.InitWaitEvent() + lruEvent.SetValue(lru.WorkFuncEventKey, work) + s.lruProduce.Call(ctx, lruEvent) + resp, err := lruEvent.StartWaitEvent(s.timeOut) + s.lruProduce.Recovery(lruEvent) + if err != nil { + return nil, err + } + + return resp.(*proto.HGetResponse), nil +} + +func (s *singleService) HGetAll( + ctx context.Context, + req *proto.HGetAllRequest, +) (*proto.HGetAllResponse, error) { + work := event.EventWorkFunc(func() (interface{}, error) { + resp, err := s.dao.HGetAll(req.Key) + if err != nil { + return nil, err + } + if s.aof != nil { + s.aof.SendRequest("HGetAll", req) + } + return resp, nil + }) + + lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) + lruEvent.InitWaitEvent() + lruEvent.SetValue(lru.WorkFuncEventKey, work) + s.lruProduce.Call(ctx, lruEvent) + resp, err := lruEvent.StartWaitEvent(s.timeOut) + s.lruProduce.Recovery(lruEvent) + if err != nil { + return nil, err + } + + return resp.(*proto.HGetAllResponse), nil +} + +func (s *singleService) HIncrBy( + ctx context.Context, + req *proto.HIncrByRequest, +) (*proto.HIncrByResponse, error) { + work := event.EventWorkFunc(func() (interface{}, error) { + resp, err := s.dao.HIncrBy(req.Key, req.HKeys) + if err != nil { + return nil, err + } + if s.aof != nil { + s.aof.SendRequest("HIncrBy", req) + } + return resp, nil + }) + + lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) + lruEvent.InitWaitEvent() + lruEvent.SetValue(lru.WorkFuncEventKey, work) + s.lruProduce.Call(ctx, lruEvent) + resp, err := lruEvent.StartWaitEvent(s.timeOut) + s.lruProduce.Recovery(lruEvent) + if err != nil { + return nil, err + } + + return resp.(*proto.HIncrByResponse), nil +} + +func (s *singleService) HKeys( + ctx context.Context, + req *proto.HKeysRequest, +) (*proto.HKeysResponse, error) { + work := event.EventWorkFunc(func() (interface{}, error) { + resp, err := s.dao.HKeys(req.Key) + if err != nil { + return nil, err + } + if s.aof != nil { + s.aof.SendRequest("HKeys", req) + } + return resp, nil + }) + + lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) + lruEvent.InitWaitEvent() + lruEvent.SetValue(lru.WorkFuncEventKey, work) + s.lruProduce.Call(ctx, lruEvent) + resp, err := lruEvent.StartWaitEvent(s.timeOut) + s.lruProduce.Recovery(lruEvent) + if err != nil { + return nil, err + } + + return resp.(*proto.HKeysResponse), nil +} + +func (s *singleService) HLen( + ctx context.Context, + req *proto.HLenRequest, +) (*proto.HLenResponse, error) { + work := event.EventWorkFunc(func() (interface{}, error) { + resp, err := s.dao.HLen(req.Key) + if err != nil { + return nil, err + } + if s.aof != nil { + s.aof.SendRequest("HLen", req) + } + return resp, nil + }) + + lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) + lruEvent.InitWaitEvent() + lruEvent.SetValue(lru.WorkFuncEventKey, work) + s.lruProduce.Call(ctx, lruEvent) + resp, err := lruEvent.StartWaitEvent(s.timeOut) + s.lruProduce.Recovery(lruEvent) + if err != nil { + return nil, err + } + + return resp.(*proto.HLenResponse), nil +} + +func (s *singleService) HSet( + ctx context.Context, + req *proto.HSetRequest, +) (*proto.HSetResponse, error) { + work := event.EventWorkFunc(func() (interface{}, error) { + resp, err := s.dao.HSet(req.Key, req.Items) + if err != nil { + return nil, err + } + if s.aof != nil { + s.aof.SendRequest("HSet", req) + } + return resp, nil + }) + + lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) + lruEvent.InitWaitEvent() + lruEvent.SetValue(lru.WorkFuncEventKey, work) + s.lruProduce.Call(ctx, lruEvent) + resp, err := lruEvent.StartWaitEvent(s.timeOut) + s.lruProduce.Recovery(lruEvent) + if err != nil { + return nil, err + } + + return resp.(*proto.HSetResponse), nil +} + +func (s *singleService) HSetX( + ctx context.Context, + req *proto.HSetXRequest, +) (*proto.HSetXResponse, error) { + work := event.EventWorkFunc(func() (interface{}, error) { + resp, err := s.dao.HSetX(req.Key, req.Items) + if err != nil { + return nil, err + } + if s.aof != nil { + s.aof.SendRequest("HSetX", req) + } + return resp, nil + }) + + lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) + lruEvent.InitWaitEvent() + lruEvent.SetValue(lru.WorkFuncEventKey, work) + s.lruProduce.Call(ctx, lruEvent) + resp, err := lruEvent.StartWaitEvent(s.timeOut) + s.lruProduce.Recovery(lruEvent) + if err != nil { + return nil, err + } + + return resp.(*proto.HSetXResponse), nil +} + func (s *singleService) Set( ctx context.Context, req *proto.SetRequest, From 5ce350f1153038df35436d66438939a269b44802 Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Thu, 4 Nov 2021 21:35:09 +0800 Subject: [PATCH 05/12] fix(linces): update license --- gateway/main.go | 15 --------------- storage/main.go | 15 --------------- 2 files changed, 30 deletions(-) diff --git a/gateway/main.go b/gateway/main.go index eee025b..63e1f96 100644 --- a/gateway/main.go +++ b/gateway/main.go @@ -1,18 +1,3 @@ -/* -Copyright © 2021 NAME HERE - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ package main import "gitee.com/wheat-os/wheatCache/gateway/cmd" diff --git a/storage/main.go b/storage/main.go index d96a48a..f8a36bd 100644 --- a/storage/main.go +++ b/storage/main.go @@ -1,18 +1,3 @@ -/* -Copyright © 2021 NAME HERE - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ package main import ( From 778d5152c8a8a433b57855d2d8cfeadd33d033b1 Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Fri, 5 Nov 2021 14:41:39 +0800 Subject: [PATCH 06/12] perf(incr): option incr to values --- pkg/structure/stringx/string.go | 31 ++----------------------------- pkg/structure/value.go | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 29 deletions(-) diff --git a/pkg/structure/stringx/string.go b/pkg/structure/stringx/string.go index d85f300..a38827f 100644 --- a/pkg/structure/stringx/string.go +++ b/pkg/structure/stringx/string.go @@ -1,9 +1,6 @@ package stringx import ( - "strconv" - - "gitee.com/wheat-os/wheatCache/pkg/errorx" "gitee.com/wheat-os/wheatCache/pkg/structure" ) @@ -51,32 +48,8 @@ func (s *StringSingle) Get() string { return s.val.ToString() } -func updateValueNotString(s *StringSingle, val int32) (string, error) { - switch s.val.GetDynamicType() { - case structure.DynamicNull: - s.val.SetInt(int64(val)) - return strconv.Itoa(int(val)), nil - case structure.DynamicFloat: - f, err := s.val.ToFloat64() - if err != nil { - return "", err - } - s.val.SetFloat64(f + float64(val)) - return strconv.FormatFloat(f+float64(val), 'f', 2, 64), nil - case structure.DynamicInt: - i, err := s.val.ToInt() - if err != nil { - return "", err - } - s.val.SetInt(int64(val) + i) - return strconv.Itoa(int(i + int64(val))), nil - default: - return "", errorx.New("string cannot perform add operations") - } -} - func (s *StringSingle) Add(renewal int32) (string, error) { - result, err := updateValueNotString(s, renewal) + result, err := s.val.Incr(renewal) if err != nil { return "", err } @@ -84,7 +57,7 @@ func (s *StringSingle) Add(renewal int32) (string, error) { } func (s *StringSingle) Reduce(renewal int32) (string, error) { - result, err := updateValueNotString(s, -1*renewal) + result, err := s.val.Incr(-1 * renewal) if err != nil { return "", err } diff --git a/pkg/structure/value.go b/pkg/structure/value.go index 36a5a26..3ab4fd4 100644 --- a/pkg/structure/value.go +++ b/pkg/structure/value.go @@ -187,3 +187,28 @@ func (v *Value) SliceByString(start, end int) ([]byte, error) { return v.val[start:end], nil } + +// 自增 +func (v *Value) Incr(renewal int32) (string, error) { + switch v.GetDynamicType() { + case DynamicNull: + v.SetInt(int64(renewal)) + return strconv.Itoa(int(renewal)), nil + case DynamicFloat: + f, err := v.ToFloat64() + if err != nil { + return "", err + } + v.SetFloat64(f + float64(renewal)) + return strconv.FormatFloat(f+float64(renewal), 'f', 2, 64), nil + case DynamicInt: + i, err := v.ToInt() + if err != nil { + return "", err + } + v.SetInt(int64(renewal) + i) + return strconv.Itoa(int(i + int64(renewal))), nil + default: + return "", errorx.New("string cannot perform add operations") + } +} From 976215ee108115f1fd2c19058fb80229e08ffd25 Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Fri, 5 Nov 2021 16:34:50 +0800 Subject: [PATCH 07/12] feat(structure-hashx): add hashx --- pkg/structure/hashx/hashx.go | 120 +++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 pkg/structure/hashx/hashx.go diff --git a/pkg/structure/hashx/hashx.go b/pkg/structure/hashx/hashx.go new file mode 100644 index 0000000..8d6862b --- /dev/null +++ b/pkg/structure/hashx/hashx.go @@ -0,0 +1,120 @@ +package hashx + +import ( + "gitee.com/wheat-os/wheatCache/pkg/errorx" + "gitee.com/wheat-os/wheatCache/pkg/structure" +) + +type HashX map[string]*structure.Value + +func NewHashXSingle() structure.HashXInterface { + return make(HashX) +} + +func (h HashX) SizeByte() int64 { + var size int + for _, val := range h { + size += val.GetSize() + } + return int64(size) +} + +// RollBack TODO 事务相关, V2 实现 +func (h HashX) RollBack() error { + panic("not implemented") // TODO: Implement +} + +// Begin 事务相关, V2 实现 +func (h HashX) Begin() error { + panic("not implemented") // TODO: Implement +} + +// Comment 事务相关, V2 实现 +func (h HashX) Comment() error { + panic("not implemented") // TODO: Implement +} + +func (h HashX) Encode() ([]byte, error) { + panic("not implemented") // TODO: Implement +} + +func (h HashX) Set(key string, val string) structure.UpdateLength { + + var Length structure.UpdateLength + if v, ok := h[key]; ok { + Length -= structure.UpdateLength(v.GetSize()) + } + + strVal := structure.NewValue(val) + h[key] = strVal + return Length + structure.UpdateLength(strVal.GetSize()) +} + +func (h HashX) Get(key string) (string, error) { + if v, ok := h[key]; ok { + return v.ToString(), nil + } + + return "", errorx.New("this key does not exist in hashx, key:%s", key) +} + +func (h HashX) Del(key string) (structure.UpdateLength, error) { + if v, ok := h[key]; ok { + delete(h, key) + return structure.UpdateLength(v.GetSize()), nil + } + + return 0, errorx.New("this key does not exist in hashx, key:%s", key) +} + +func (h HashX) Key() []string { + result := make([]string, 0, len(h)) + for key := range h { + result = append(result, key) + } + return result +} + +func (h HashX) Value() []string { + result := make([]string, 0, len(h)) + for _, val := range h { + result = append(result, val.ToString()) + } + return result +} + +func (h HashX) Item() map[string]string { + result := make(map[string]string, len(h)) + for key, val := range h { + result[key] = val.ToString() + } + return result +} + +func (h HashX) Add(renewal int, keys ...string) (count int, result []string, err error) { + for _, key := range keys { + if v, ok := h[key]; ok { + res, err := v.Incr(int32(renewal)) + if err != nil { + return count, result, errorx.New("option key err, key:%s, err:%v", key, err) + } + + count += 1 + result = append(result, res) + } + } + return count, result, nil +} + +func (h HashX) SetX(key string, val string) (bool, structure.UpdateLength) { + if _, ok := h[key]; ok { + return false, 0 + } + strVal := structure.NewValue(val) + h[key] = strVal + return true, structure.UpdateLength(strVal.GetSize()) +} + +func (h HashX) Length() int { + return len(h) +} From 06baf3993dea3105c64c19542cf46ef2923b2c26 Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Fri, 5 Nov 2021 16:36:00 +0800 Subject: [PATCH 08/12] feat(hashx-interface): add hash interface --- pkg/structure/define.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkg/structure/define.go b/pkg/structure/define.go index 22ec2d1..375e941 100644 --- a/pkg/structure/define.go +++ b/pkg/structure/define.go @@ -53,3 +53,16 @@ type ListXInterface interface { Range(start, end int) ([]string, error) Remove(value string, count int) (int, UpdateLength) } + +type HashXInterface interface { + KeyBaseInterface + Set(key string, val string) UpdateLength + Get(key string) (string, error) + Del(key string) (UpdateLength, error) + Key() []string + Value() []string + Item() map[string]string + Add(renewal int, key ...string) (int, []string, error) // 访问影响成功的结果 + SetX(key string, val string) (bool, UpdateLength) // 不存在才插入 + Length() int +} From c3cff03b2bf13b5d88048a60097ebe51cc1d6eae Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Fri, 5 Nov 2021 16:36:18 +0800 Subject: [PATCH 09/12] test(structure-hashx): add hashx test --- pkg/structure/hashx/hashx_test.go | 62 +++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 pkg/structure/hashx/hashx_test.go diff --git a/pkg/structure/hashx/hashx_test.go b/pkg/structure/hashx/hashx_test.go new file mode 100644 index 0000000..78c9241 --- /dev/null +++ b/pkg/structure/hashx/hashx_test.go @@ -0,0 +1,62 @@ +package hashx + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestHashX_Set_SetX(t *testing.T) { + h := NewHashXSingle() + h.Set("key", "opq") + res, err := h.Get("key") + require.NoError(t, err) + require.Equal(t, res, "opq") + b, _ := h.SetX("key", "opq") + require.Equal(t, b, false) + + b, _ = h.SetX("key1", "opq") + require.Equal(t, b, true) + res, err = h.Get("key1") + require.NoError(t, err) + require.Equal(t, res, "opq") +} + +func TestHashX_Del(t *testing.T) { + h := NewHashXSingle() + up := h.Set("key", "opq") + upu, err := h.Del("key") + require.NoError(t, err) + require.Equal(t, up, upu) +} + +func TestHashX_Key(t *testing.T) { + h := NewHashXSingle() + h.Set("key", "opq") + h.Set("key1", "opq") + h.Set("key2", "opq") + + require.Equal(t, h.Key(), []string{"key", "key1", "key2"}) +} + +func TestHashX_Value(t *testing.T) { + h := NewHashXSingle() + h.Set("key", "opq") + h.Set("key1", "opq") + h.Set("key2", "opq") + + require.Equal(t, h.Value(), []string{"opq", "opq", "opq"}) +} + +func TestHashX_Add(t *testing.T) { + h := NewHashXSingle() + h.Set("1", "1") + c, res, err := h.Add(1, "1") + require.NoError(t, err) + require.Equal(t, c, 1) + require.Equal(t, res, []string{"2"}) + + s, err := h.Get("1") + require.NoError(t, err) + require.Equal(t, s, "2") +} From 222bcc4eea34d2ba932af62cb02a259f62d92fbe Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Fri, 5 Nov 2021 20:43:56 +0800 Subject: [PATCH 10/12] chore(service): update service --- pkg/proto/hashx.pb.go | 216 ++++++++++++++------------ protobuf/hashx.proto | 5 +- storage/dao/dao.gen.go | 2 +- storage/dao/interface.gen.go | 2 +- storage/service/single_service.gen.go | 2 +- 5 files changed, 126 insertions(+), 101 deletions(-) diff --git a/pkg/proto/hashx.pb.go b/pkg/proto/hashx.pb.go index 61a161e..17a00cc 100644 --- a/pkg/proto/hashx.pb.go +++ b/pkg/proto/hashx.pb.go @@ -172,6 +172,8 @@ type HExistsResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + Exists bool `protobuf:"varint,1,opt,name=exists,proto3" json:"exists,omitempty"` } func (x *HExistsResponse) Reset() { @@ -206,6 +208,13 @@ func (*HExistsResponse) Descriptor() ([]byte, []int) { return file_hashx_proto_rawDescGZIP(), []int{3} } +func (x *HExistsResponse) GetExists() bool { + if x != nil { + return x.Exists + } + return false +} + type HGetRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -407,8 +416,9 @@ type HIncrByRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - HKeys []string `protobuf:"bytes,2,rep,name=h_keys,json=hKeys,proto3" json:"h_keys,omitempty"` + Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + HKeys []string `protobuf:"bytes,2,rep,name=h_keys,json=hKeys,proto3" json:"h_keys,omitempty"` + Renewal int32 `protobuf:"varint,3,opt,name=renewal,proto3" json:"renewal,omitempty"` } func (x *HIncrByRequest) Reset() { @@ -457,12 +467,20 @@ func (x *HIncrByRequest) GetHKeys() []string { return nil } +func (x *HIncrByRequest) GetRenewal() int32 { + if x != nil { + return x.Renewal + } + return 0 +} + type HIncrByResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Items map[string]string `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Count int32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` + Values []string `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"` } func (x *HIncrByResponse) Reset() { @@ -497,9 +515,16 @@ func (*HIncrByResponse) Descriptor() ([]byte, []int) { return file_hashx_proto_rawDescGZIP(), []int{9} } -func (x *HIncrByResponse) GetItems() map[string]string { +func (x *HIncrByResponse) GetCount() int32 { if x != nil { - return x.Items + return x.Count + } + return 0 +} + +func (x *HIncrByResponse) GetValues() []string { + if x != nil { + return x.Values } return nil } @@ -900,77 +925,76 @@ var file_hashx_proto_rawDesc = []byte{ 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x13, 0x0a, 0x05, 0x68, 0x5f, 0x6b, - 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x4b, 0x65, 0x79, 0x22, 0x11, + 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x4b, 0x65, 0x79, 0x22, 0x29, 0x0a, 0x0f, 0x48, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x40, 0x0a, 0x0b, 0x48, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x1a, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, - 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x15, 0x0a, 0x06, - 0x68, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x68, 0x4b, - 0x65, 0x79, 0x73, 0x22, 0x78, 0x0a, 0x0c, 0x48, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x48, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x69, 0x74, - 0x65, 0x6d, 0x73, 0x1a, 0x38, 0x0a, 0x0a, 0x49, 0x74, 0x65, 0x6d, 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, 0x22, 0x2c, 0x0a, - 0x0e, 0x48, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x1a, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x42, - 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x7e, 0x0a, 0x0f, 0x48, - 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x31, - 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, - 0x48, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, - 0x49, 0x74, 0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, - 0x73, 0x1a, 0x38, 0x0a, 0x0a, 0x49, 0x74, 0x65, 0x6d, 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, 0x22, 0x43, 0x0a, 0x0e, 0x48, - 0x49, 0x6e, 0x63, 0x72, 0x42, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, + 0x65, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x78, 0x69, 0x73, 0x74, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x06, 0x65, 0x78, 0x69, 0x73, 0x74, 0x73, 0x22, 0x40, 0x0a, 0x0b, 0x48, 0x47, 0x65, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x52, + 0x03, 0x6b, 0x65, 0x79, 0x12, 0x15, 0x0a, 0x06, 0x68, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x68, 0x4b, 0x65, 0x79, 0x73, 0x22, 0x78, 0x0a, 0x0c, 0x48, + 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x05, 0x69, + 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x48, 0x47, 0x65, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x1a, 0x38, 0x0a, 0x0a, 0x49, + 0x74, 0x65, 0x6d, 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, 0x22, 0x2c, 0x0a, 0x0e, 0x48, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x22, 0x7e, 0x0a, 0x0f, 0x48, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x48, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x1a, 0x38, 0x0a, 0x0a, 0x49, 0x74, 0x65, + 0x6d, 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, 0x22, 0x5d, 0x0a, 0x0e, 0x48, 0x49, 0x6e, 0x63, 0x72, 0x42, 0x79, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x15, 0x0a, 0x06, 0x68, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x05, 0x68, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x6e, 0x65, + 0x77, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x65, 0x6e, 0x65, 0x77, + 0x61, 0x6c, 0x22, 0x3f, 0x0a, 0x0f, 0x48, 0x49, 0x6e, 0x63, 0x72, 0x42, 0x79, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x22, 0x2a, 0x0a, 0x0c, 0x48, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x08, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, + 0x23, 0x0a, 0x0d, 0x48, 0x4b, 0x65, 0x79, 0x73, 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, 0x29, 0x0a, 0x0b, 0x48, 0x4c, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x08, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, + 0x26, 0x0a, 0x0c, 0x48, 0x4c, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x92, 0x01, 0x0a, 0x0b, 0x48, 0x53, 0x65, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x2d, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x48, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x69, 0x74, 0x65, + 0x6d, 0x73, 0x1a, 0x38, 0x0a, 0x0a, 0x49, 0x74, 0x65, 0x6d, 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, 0x22, 0x0e, 0x0a, 0x0c, + 0x48, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x94, 0x01, 0x0a, + 0x0c, 0x48, 0x53, 0x65, 0x74, 0x58, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x42, 0x61, 0x73, - 0x65, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x15, 0x0a, 0x06, 0x68, 0x5f, 0x6b, - 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x68, 0x4b, 0x65, 0x79, 0x73, - 0x22, 0x7e, 0x0a, 0x0f, 0x48, 0x49, 0x6e, 0x63, 0x72, 0x42, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x48, 0x49, 0x6e, 0x63, 0x72, 0x42, 0x79, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, - 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x1a, 0x38, 0x0a, 0x0a, 0x49, 0x74, 0x65, 0x6d, 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, - 0x22, 0x2a, 0x0a, 0x0c, 0x48, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x1a, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, - 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x23, 0x0a, 0x0d, - 0x48, 0x4b, 0x65, 0x79, 0x73, 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, 0x29, 0x0a, 0x0b, 0x48, 0x4c, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x1a, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, - 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x26, 0x0a, 0x0c, - 0x48, 0x4c, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x22, 0x92, 0x01, 0x0a, 0x0b, 0x48, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x08, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, - 0x12, 0x2d, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x17, 0x2e, 0x48, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x49, 0x74, - 0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x1a, - 0x38, 0x0a, 0x0a, 0x49, 0x74, 0x65, 0x6d, 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, 0x22, 0x0e, 0x0a, 0x0c, 0x48, 0x53, 0x65, - 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x94, 0x01, 0x0a, 0x0c, 0x48, 0x53, - 0x65, 0x74, 0x58, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, - 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2e, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x48, 0x53, 0x65, 0x74, 0x58, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, - 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x1a, 0x38, 0x0a, 0x0a, 0x49, 0x74, 0x65, 0x6d, 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, - 0x22, 0x25, 0x0a, 0x0d, 0x48, 0x53, 0x65, 0x74, 0x58, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x0b, 0x5a, 0x09, 0x70, 0x6b, 0x67, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2e, 0x0a, 0x05, 0x69, 0x74, 0x65, + 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x48, 0x53, 0x65, 0x74, 0x58, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x1a, 0x38, 0x0a, 0x0a, 0x49, 0x74, 0x65, + 0x6d, 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, 0x22, 0x25, 0x0a, 0x0d, 0x48, 0x53, 0x65, 0x74, 0x58, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x0b, 0x5a, 0x09, 0x70, 0x6b, + 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -985,7 +1009,7 @@ func file_hashx_proto_rawDescGZIP() []byte { return file_hashx_proto_rawDescData } -var file_hashx_proto_msgTypes = make([]protoimpl.MessageInfo, 23) +var file_hashx_proto_msgTypes = make([]protoimpl.MessageInfo, 22) var file_hashx_proto_goTypes = []interface{}{ (*HDelRequest)(nil), // 0: HDelRequest (*HDelResponse)(nil), // 1: HDelResponse @@ -1007,31 +1031,29 @@ var file_hashx_proto_goTypes = []interface{}{ (*HSetXResponse)(nil), // 17: HSetXResponse nil, // 18: HGetResponse.ItemsEntry nil, // 19: HGetAllResponse.ItemsEntry - nil, // 20: HIncrByResponse.ItemsEntry - nil, // 21: HSetRequest.ItemsEntry - nil, // 22: HSetXRequest.ItemsEntry - (*BaseKey)(nil), // 23: BaseKey + nil, // 20: HSetRequest.ItemsEntry + nil, // 21: HSetXRequest.ItemsEntry + (*BaseKey)(nil), // 22: BaseKey } var file_hashx_proto_depIdxs = []int32{ - 23, // 0: HDelRequest.key:type_name -> BaseKey - 23, // 1: HExistsRequest.key:type_name -> BaseKey - 23, // 2: HGetRequest.key:type_name -> BaseKey + 22, // 0: HDelRequest.key:type_name -> BaseKey + 22, // 1: HExistsRequest.key:type_name -> BaseKey + 22, // 2: HGetRequest.key:type_name -> BaseKey 18, // 3: HGetResponse.items:type_name -> HGetResponse.ItemsEntry - 23, // 4: HGetAllRequest.key:type_name -> BaseKey + 22, // 4: HGetAllRequest.key:type_name -> BaseKey 19, // 5: HGetAllResponse.items:type_name -> HGetAllResponse.ItemsEntry - 23, // 6: HIncrByRequest.key:type_name -> BaseKey - 20, // 7: HIncrByResponse.items:type_name -> HIncrByResponse.ItemsEntry - 23, // 8: HKeysRequest.key:type_name -> BaseKey - 23, // 9: HLenRequest.key:type_name -> BaseKey - 23, // 10: HSetRequest.key:type_name -> BaseKey - 21, // 11: HSetRequest.items:type_name -> HSetRequest.ItemsEntry - 23, // 12: HSetXRequest.key:type_name -> BaseKey - 22, // 13: HSetXRequest.items:type_name -> HSetXRequest.ItemsEntry - 14, // [14:14] is the sub-list for method output_type - 14, // [14:14] is the sub-list for method input_type - 14, // [14:14] is the sub-list for extension type_name - 14, // [14:14] is the sub-list for extension extendee - 0, // [0:14] is the sub-list for field type_name + 22, // 6: HIncrByRequest.key:type_name -> BaseKey + 22, // 7: HKeysRequest.key:type_name -> BaseKey + 22, // 8: HLenRequest.key:type_name -> BaseKey + 22, // 9: HSetRequest.key:type_name -> BaseKey + 20, // 10: HSetRequest.items:type_name -> HSetRequest.ItemsEntry + 22, // 11: HSetXRequest.key:type_name -> BaseKey + 21, // 12: HSetXRequest.items:type_name -> HSetXRequest.ItemsEntry + 13, // [13:13] is the sub-list for method output_type + 13, // [13:13] is the sub-list for method input_type + 13, // [13:13] is the sub-list for extension type_name + 13, // [13:13] is the sub-list for extension extendee + 0, // [0:13] is the sub-list for field type_name } func init() { file_hashx_proto_init() } @@ -1264,7 +1286,7 @@ func file_hashx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_hashx_proto_rawDesc, NumEnums: 0, - NumMessages: 23, + NumMessages: 22, NumExtensions: 0, NumServices: 0, }, diff --git a/protobuf/hashx.proto b/protobuf/hashx.proto index 850dce6..d13f826 100644 --- a/protobuf/hashx.proto +++ b/protobuf/hashx.proto @@ -16,6 +16,7 @@ message HExistsRequest { } message HExistsResponse { + bool exists = 1; } message HGetRequest { @@ -38,10 +39,12 @@ message HGetAllResponse { message HIncrByRequest { BaseKey key = 1; repeated string h_keys = 2; + int32 renewal = 3; } message HIncrByResponse { - map items = 1; + int32 count = 1; + repeated string values = 2; } message HKeysRequest { diff --git a/storage/dao/dao.gen.go b/storage/dao/dao.gen.go index 2c10fce..6bfdd30 100644 --- a/storage/dao/dao.gen.go +++ b/storage/dao/dao.gen.go @@ -72,7 +72,7 @@ func (d *Dao) ExecMessage(message protobuf.Message) error { _, err := d.HGetAll(req.Key) return err case *proto.HIncrByRequest: - _, err := d.HIncrBy(req.Key, req.HKeys) + _, err := d.HIncrBy(req.Key, req.HKeys, req.Renewal) return err case *proto.HKeysRequest: _, err := d.HKeys(req.Key) diff --git a/storage/dao/interface.gen.go b/storage/dao/interface.gen.go index 582c6a9..44fbe4b 100644 --- a/storage/dao/interface.gen.go +++ b/storage/dao/interface.gen.go @@ -25,7 +25,7 @@ type Interface interface { HExists(*proto.BaseKey, string) (*proto.HExistsResponse, error) HGet(*proto.BaseKey, []string) (*proto.HGetResponse, error) HGetAll(*proto.BaseKey) (*proto.HGetAllResponse, error) - HIncrBy(*proto.BaseKey, []string) (*proto.HIncrByResponse, error) + HIncrBy(*proto.BaseKey, []string, int32) (*proto.HIncrByResponse, error) HKeys(*proto.BaseKey) (*proto.HKeysResponse, error) HLen(*proto.BaseKey) (*proto.HLenResponse, error) HSet(*proto.BaseKey, map[string]string) (*proto.HSetResponse, error) diff --git a/storage/service/single_service.gen.go b/storage/service/single_service.gen.go index 87a5590..02b9117 100644 --- a/storage/service/single_service.gen.go +++ b/storage/service/single_service.gen.go @@ -463,7 +463,7 @@ func (s *singleService) HIncrBy( req *proto.HIncrByRequest, ) (*proto.HIncrByResponse, error) { work := event.EventWorkFunc(func() (interface{}, error) { - resp, err := s.dao.HIncrBy(req.Key, req.HKeys) + resp, err := s.dao.HIncrBy(req.Key, req.HKeys, req.Renewal) if err != nil { return nil, err } From fcdb2310fe230129bd2ebe9dcab16164c21f1e75 Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Fri, 5 Nov 2021 20:44:09 +0800 Subject: [PATCH 11/12] feat(storage-dao): add hashx --- storage/dao/hashx.go | 166 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 148 insertions(+), 18 deletions(-) diff --git a/storage/dao/hashx.go b/storage/dao/hashx.go index 6edcab9..5b3c77c 100644 --- a/storage/dao/hashx.go +++ b/storage/dao/hashx.go @@ -1,39 +1,169 @@ package dao -import "gitee.com/wheat-os/wheatCache/pkg/proto" +import ( + "gitee.com/wheat-os/wheatCache/pkg/errorx" + "gitee.com/wheat-os/wheatCache/pkg/proto" + "gitee.com/wheat-os/wheatCache/pkg/structure" + "gitee.com/wheat-os/wheatCache/pkg/structure/hashx" +) func (d *Dao) HDel(key *proto.BaseKey, hKeys []string) (*proto.HDelResponse, error) { - panic("not implemented") // TODO: Implement + value, ok := d.lru.Get(key) + if !ok { + return nil, errorx.NotKeyErr(key.Key) + } + + hashVal, ok := value.(structure.HashXInterface) + if !ok { + return nil, errorx.DaoTypeErr("hashx") + } + + for _, hK := range hKeys { + up, err := hashVal.Del(hK) + if err != nil { + return nil, err + } + d.lru.UpdateLruSize(up) + } + + return &proto.HDelResponse{}, nil + } -func (d *Dao) HExists(_ *proto.BaseKey, _ string) (*proto.HExistsResponse, error) { - panic("not implemented") // TODO: Implement +func (d *Dao) HExists(key *proto.BaseKey, hKeys string) (*proto.HExistsResponse, error) { + value, ok := d.lru.Get(key) + if !ok { + return nil, errorx.NotKeyErr(key.Key) + } + + hashVal, ok := value.(structure.HashXInterface) + if !ok { + return nil, errorx.DaoTypeErr("hashx") + } + _, err := hashVal.Get(hKeys) + if err != nil { + return &proto.HExistsResponse{Exists: false}, nil + } + return &proto.HExistsResponse{Exists: true}, nil } -func (d *Dao) HGet(_ *proto.BaseKey, _ []string) (*proto.HGetResponse, error) { - panic("not implemented") // TODO: Implement +func (d *Dao) HGet(key *proto.BaseKey, hKeys []string) (*proto.HGetResponse, error) { + value, ok := d.lru.Get(key) + if !ok { + return nil, errorx.NotKeyErr(key.Key) + } + + hashVal, ok := value.(structure.HashXInterface) + if !ok { + return nil, errorx.DaoTypeErr("hashx") + } + + result := make(map[string]string) + for _, hK := range hKeys { + res, err := hashVal.Get(hK) + if err != nil { + return nil, err + } + result[hK] = res + } + return &proto.HGetResponse{Items: result}, nil } -func (d *Dao) HGetAll(_ *proto.BaseKey) (*proto.HGetAllResponse, error) { - panic("not implemented") // TODO: Implement +func (d *Dao) HGetAll(key *proto.BaseKey) (*proto.HGetAllResponse, error) { + value, ok := d.lru.Get(key) + if !ok { + return nil, errorx.NotKeyErr(key.Key) + } + + hashVal, ok := value.(structure.HashXInterface) + if !ok { + return nil, errorx.DaoTypeErr("hashx") + } + return &proto.HGetAllResponse{Items: hashVal.Item()}, nil } -func (d *Dao) HIncrBy(_ *proto.BaseKey, _ []string) (*proto.HIncrByResponse, error) { - panic("not implemented") // TODO: Implement +func (d *Dao) HIncrBy(key *proto.BaseKey, hKeys []string, renewal int32) (*proto.HIncrByResponse, error) { + value, ok := d.lru.Get(key) + if !ok { + return nil, errorx.NotKeyErr(key.Key) + } + + hashVal, ok := value.(structure.HashXInterface) + if !ok { + return nil, errorx.DaoTypeErr("hashx") + } + count, result, err := hashVal.Add(int(renewal), hKeys...) + return &proto.HIncrByResponse{ + Count: int32(count), + Values: result, + }, err } -func (d *Dao) HKeys(_ *proto.BaseKey) (*proto.HKeysResponse, error) { - panic("not implemented") // TODO: Implement +func (d *Dao) HKeys(key *proto.BaseKey) (*proto.HKeysResponse, error) { + value, ok := d.lru.Get(key) + if !ok { + return nil, errorx.NotKeyErr(key.Key) + } + + hashVal, ok := value.(structure.HashXInterface) + if !ok { + return nil, errorx.DaoTypeErr("hashx") + } + + return &proto.HKeysResponse{Keys: hashVal.Key()}, nil } -func (d *Dao) HLen(_ *proto.BaseKey) (*proto.HLenResponse, error) { - panic("not implemented") // TODO: Implement +func (d *Dao) HLen(key *proto.BaseKey) (*proto.HLenResponse, error) { + value, ok := d.lru.Get(key) + if !ok { + return nil, errorx.NotKeyErr(key.Key) + } + + hashVal, ok := value.(structure.HashXInterface) + if !ok { + return nil, errorx.DaoTypeErr("hashx") + } + + return &proto.HLenResponse{Length: int32(hashVal.Length())}, nil } -func (d *Dao) HSet(_ *proto.BaseKey, _ map[string]string) (*proto.HSetResponse, error) { - panic("not implemented") // TODO: Implement +func (d *Dao) HSet(key *proto.BaseKey, set map[string]string) (*proto.HSetResponse, error) { + value, ok := d.lru.Get(key) + if !ok { + hashVal := hashx.NewHashXSingle() + for k, v := range set { + hashVal.Set(k, v) + } + err := d.lru.Add(key, hashVal) + return &proto.HSetResponse{}, err + } + + hashVal, ok := value.(structure.HashXInterface) + if !ok { + return nil, errorx.DaoTypeErr("hashx") + } + for k, v := range set { + upLength := hashVal.Set(k, v) + d.lru.UpdateLruSize(upLength) + } + + return &proto.HSetResponse{}, nil } -func (d *Dao) HSetX(_ *proto.BaseKey, _ map[string]string) (*proto.HSetXResponse, error) { - panic("not implemented") // TODO: Implement +func (d *Dao) HSetX(key *proto.BaseKey, set map[string]string) (*proto.HSetXResponse, error) { + value, ok := d.lru.Get(key) + if !ok { + return &proto.HSetXResponse{}, errorx.NotKeyErr(key.Key) + } + + hashVal, ok := value.(structure.HashXInterface) + if !ok { + return nil, errorx.DaoTypeErr("hashx") + } + for k, v := range set { + upLength := hashVal.Set(k, v) + d.lru.UpdateLruSize(upLength) + } + + return &proto.HSetXResponse{}, nil } From 44bd5bc7cd7a50402b1f92041a9544a6118398f7 Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Fri, 5 Nov 2021 20:48:34 +0800 Subject: [PATCH 12/12] doc(readme): over hashx --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f0e6b55..5ce326c 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,7 @@ func TestClient(t *testing.T) { - [x] 基础类型 - [x] listx - [x] stringx - - [ ] hashx + - [x] hashx - [ ] setx - [ ] zsetx - [ ] channelx @@ -112,8 +112,8 @@ func TestClient(t *testing.T) { - [ ] lru 消息推送 - 网关层 - [x] 基于 key 一致性 hash 的集群 transport - - [ ] 基于配置的主从 transpoart - - [ ] 基于配置的备份 transpoart + - [ ] 基于配置的主从 transport + - [ ] 基于配置的备份 transport - 中间件以及插件层 - [x] 推送中间件 - [x] 事件驱动 v2