From 921078c61d6c46e4101222338ebbcbbe575ec130 Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Sun, 7 Nov 2021 20:46:22 +0800 Subject: [PATCH 01/18] chore(proto): update proto --- pkg/proto/setx.pb.go | 1834 +++++++++++++++++++++++++++++++++++++ pkg/proto/storage.pb.go | 906 ++++++++++++++---- protobuf/setx.proto | 119 +++ protobuf/storage.proto | 14 + storage/temp/const.gen.go | 42 + storage/temp/tem.yaml | 17 +- 6 files changed, 2757 insertions(+), 175 deletions(-) create mode 100644 pkg/proto/setx.pb.go create mode 100644 protobuf/setx.proto diff --git a/pkg/proto/setx.pb.go b/pkg/proto/setx.pb.go new file mode 100644 index 0000000..39a6d51 --- /dev/null +++ b/pkg/proto/setx.pb.go @@ -0,0 +1,1834 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.17.3 +// source: setx.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 SAddRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Member []string `protobuf:"bytes,2,rep,name=member,proto3" json:"member,omitempty"` +} + +func (x *SAddRequest) Reset() { + *x = SAddRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_setx_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SAddRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SAddRequest) ProtoMessage() {} + +func (x *SAddRequest) ProtoReflect() protoreflect.Message { + mi := &file_setx_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 SAddRequest.ProtoReflect.Descriptor instead. +func (*SAddRequest) Descriptor() ([]byte, []int) { + return file_setx_proto_rawDescGZIP(), []int{0} +} + +func (x *SAddRequest) GetKey() *BaseKey { + if x != nil { + return x.Key + } + return nil +} + +func (x *SAddRequest) GetMember() []string { + if x != nil { + return x.Member + } + return nil +} + +type SAddResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *SAddResponse) Reset() { + *x = SAddResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_setx_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SAddResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SAddResponse) ProtoMessage() {} + +func (x *SAddResponse) ProtoReflect() protoreflect.Message { + mi := &file_setx_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 SAddResponse.ProtoReflect.Descriptor instead. +func (*SAddResponse) Descriptor() ([]byte, []int) { + return file_setx_proto_rawDescGZIP(), []int{1} +} + +type SCardRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` +} + +func (x *SCardRequest) Reset() { + *x = SCardRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_setx_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SCardRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SCardRequest) ProtoMessage() {} + +func (x *SCardRequest) ProtoReflect() protoreflect.Message { + mi := &file_setx_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 SCardRequest.ProtoReflect.Descriptor instead. +func (*SCardRequest) Descriptor() ([]byte, []int) { + return file_setx_proto_rawDescGZIP(), []int{2} +} + +func (x *SCardRequest) GetKey() *BaseKey { + if x != nil { + return x.Key + } + return nil +} + +type SCardResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Length int32 `protobuf:"varint,1,opt,name=length,proto3" json:"length,omitempty"` +} + +func (x *SCardResponse) Reset() { + *x = SCardResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_setx_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SCardResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SCardResponse) ProtoMessage() {} + +func (x *SCardResponse) ProtoReflect() protoreflect.Message { + mi := &file_setx_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 SCardResponse.ProtoReflect.Descriptor instead. +func (*SCardResponse) Descriptor() ([]byte, []int) { + return file_setx_proto_rawDescGZIP(), []int{3} +} + +func (x *SCardResponse) GetLength() int32 { + if x != nil { + return x.Length + } + return 0 +} + +type SDiffRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + SKeys []string `protobuf:"bytes,2,rep,name=sKeys,proto3" json:"sKeys,omitempty"` +} + +func (x *SDiffRequest) Reset() { + *x = SDiffRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_setx_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SDiffRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SDiffRequest) ProtoMessage() {} + +func (x *SDiffRequest) ProtoReflect() protoreflect.Message { + mi := &file_setx_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 SDiffRequest.ProtoReflect.Descriptor instead. +func (*SDiffRequest) Descriptor() ([]byte, []int) { + return file_setx_proto_rawDescGZIP(), []int{4} +} + +func (x *SDiffRequest) GetKey() *BaseKey { + if x != nil { + return x.Key + } + return nil +} + +func (x *SDiffRequest) GetSKeys() []string { + if x != nil { + return x.SKeys + } + return nil +} + +type SDiffResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Resluts []string `protobuf:"bytes,2,rep,name=resluts,proto3" json:"resluts,omitempty"` +} + +func (x *SDiffResponse) Reset() { + *x = SDiffResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_setx_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SDiffResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SDiffResponse) ProtoMessage() {} + +func (x *SDiffResponse) ProtoReflect() protoreflect.Message { + mi := &file_setx_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 SDiffResponse.ProtoReflect.Descriptor instead. +func (*SDiffResponse) Descriptor() ([]byte, []int) { + return file_setx_proto_rawDescGZIP(), []int{5} +} + +func (x *SDiffResponse) GetResluts() []string { + if x != nil { + return x.Resluts + } + return nil +} + +type SDiffStoreRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + SKeys []string `protobuf:"bytes,2,rep,name=sKeys,proto3" json:"sKeys,omitempty"` + SaveKey string `protobuf:"bytes,3,opt,name=save_key,json=saveKey,proto3" json:"save_key,omitempty"` +} + +func (x *SDiffStoreRequest) Reset() { + *x = SDiffStoreRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_setx_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SDiffStoreRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SDiffStoreRequest) ProtoMessage() {} + +func (x *SDiffStoreRequest) ProtoReflect() protoreflect.Message { + mi := &file_setx_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 SDiffStoreRequest.ProtoReflect.Descriptor instead. +func (*SDiffStoreRequest) Descriptor() ([]byte, []int) { + return file_setx_proto_rawDescGZIP(), []int{6} +} + +func (x *SDiffStoreRequest) GetKey() *BaseKey { + if x != nil { + return x.Key + } + return nil +} + +func (x *SDiffStoreRequest) GetSKeys() []string { + if x != nil { + return x.SKeys + } + return nil +} + +func (x *SDiffStoreRequest) GetSaveKey() string { + if x != nil { + return x.SaveKey + } + return "" +} + +type SDiffStoreResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *SDiffStoreResponse) Reset() { + *x = SDiffStoreResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_setx_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SDiffStoreResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SDiffStoreResponse) ProtoMessage() {} + +func (x *SDiffStoreResponse) ProtoReflect() protoreflect.Message { + mi := &file_setx_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 SDiffStoreResponse.ProtoReflect.Descriptor instead. +func (*SDiffStoreResponse) Descriptor() ([]byte, []int) { + return file_setx_proto_rawDescGZIP(), []int{7} +} + +type SInterRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + SKeys []string `protobuf:"bytes,2,rep,name=sKeys,proto3" json:"sKeys,omitempty"` +} + +func (x *SInterRequest) Reset() { + *x = SInterRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_setx_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SInterRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SInterRequest) ProtoMessage() {} + +func (x *SInterRequest) ProtoReflect() protoreflect.Message { + mi := &file_setx_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 SInterRequest.ProtoReflect.Descriptor instead. +func (*SInterRequest) Descriptor() ([]byte, []int) { + return file_setx_proto_rawDescGZIP(), []int{8} +} + +func (x *SInterRequest) GetKey() *BaseKey { + if x != nil { + return x.Key + } + return nil +} + +func (x *SInterRequest) GetSKeys() []string { + if x != nil { + return x.SKeys + } + return nil +} + +type SInterResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Resluts []string `protobuf:"bytes,2,rep,name=resluts,proto3" json:"resluts,omitempty"` +} + +func (x *SInterResponse) Reset() { + *x = SInterResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_setx_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SInterResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SInterResponse) ProtoMessage() {} + +func (x *SInterResponse) ProtoReflect() protoreflect.Message { + mi := &file_setx_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 SInterResponse.ProtoReflect.Descriptor instead. +func (*SInterResponse) Descriptor() ([]byte, []int) { + return file_setx_proto_rawDescGZIP(), []int{9} +} + +func (x *SInterResponse) GetResluts() []string { + if x != nil { + return x.Resluts + } + return nil +} + +type SInterStoreRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + SKeys []string `protobuf:"bytes,2,rep,name=sKeys,proto3" json:"sKeys,omitempty"` + SaveKey string `protobuf:"bytes,3,opt,name=save_key,json=saveKey,proto3" json:"save_key,omitempty"` +} + +func (x *SInterStoreRequest) Reset() { + *x = SInterStoreRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_setx_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SInterStoreRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SInterStoreRequest) ProtoMessage() {} + +func (x *SInterStoreRequest) ProtoReflect() protoreflect.Message { + mi := &file_setx_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 SInterStoreRequest.ProtoReflect.Descriptor instead. +func (*SInterStoreRequest) Descriptor() ([]byte, []int) { + return file_setx_proto_rawDescGZIP(), []int{10} +} + +func (x *SInterStoreRequest) GetKey() *BaseKey { + if x != nil { + return x.Key + } + return nil +} + +func (x *SInterStoreRequest) GetSKeys() []string { + if x != nil { + return x.SKeys + } + return nil +} + +func (x *SInterStoreRequest) GetSaveKey() string { + if x != nil { + return x.SaveKey + } + return "" +} + +type SInterStoreResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *SInterStoreResponse) Reset() { + *x = SInterStoreResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_setx_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SInterStoreResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SInterStoreResponse) ProtoMessage() {} + +func (x *SInterStoreResponse) ProtoReflect() protoreflect.Message { + mi := &file_setx_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 SInterStoreResponse.ProtoReflect.Descriptor instead. +func (*SInterStoreResponse) Descriptor() ([]byte, []int) { + return file_setx_proto_rawDescGZIP(), []int{11} +} + +type SIsMemberRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Member string `protobuf:"bytes,2,opt,name=member,proto3" json:"member,omitempty"` +} + +func (x *SIsMemberRequest) Reset() { + *x = SIsMemberRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_setx_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SIsMemberRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SIsMemberRequest) ProtoMessage() {} + +func (x *SIsMemberRequest) ProtoReflect() protoreflect.Message { + mi := &file_setx_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 SIsMemberRequest.ProtoReflect.Descriptor instead. +func (*SIsMemberRequest) Descriptor() ([]byte, []int) { + return file_setx_proto_rawDescGZIP(), []int{12} +} + +func (x *SIsMemberRequest) GetKey() *BaseKey { + if x != nil { + return x.Key + } + return nil +} + +func (x *SIsMemberRequest) GetMember() string { + if x != nil { + return x.Member + } + return "" +} + +type SIsMemberResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Exist bool `protobuf:"varint,1,opt,name=exist,proto3" json:"exist,omitempty"` +} + +func (x *SIsMemberResponse) Reset() { + *x = SIsMemberResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_setx_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SIsMemberResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SIsMemberResponse) ProtoMessage() {} + +func (x *SIsMemberResponse) ProtoReflect() protoreflect.Message { + mi := &file_setx_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 SIsMemberResponse.ProtoReflect.Descriptor instead. +func (*SIsMemberResponse) Descriptor() ([]byte, []int) { + return file_setx_proto_rawDescGZIP(), []int{13} +} + +func (x *SIsMemberResponse) GetExist() bool { + if x != nil { + return x.Exist + } + return false +} + +type SMoveRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + MoveKey string `protobuf:"bytes,2,opt,name=move_key,json=moveKey,proto3" json:"move_key,omitempty"` + Members []string `protobuf:"bytes,3,rep,name=members,proto3" json:"members,omitempty"` +} + +func (x *SMoveRequest) Reset() { + *x = SMoveRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_setx_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SMoveRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SMoveRequest) ProtoMessage() {} + +func (x *SMoveRequest) ProtoReflect() protoreflect.Message { + mi := &file_setx_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 SMoveRequest.ProtoReflect.Descriptor instead. +func (*SMoveRequest) Descriptor() ([]byte, []int) { + return file_setx_proto_rawDescGZIP(), []int{14} +} + +func (x *SMoveRequest) GetKey() *BaseKey { + if x != nil { + return x.Key + } + return nil +} + +func (x *SMoveRequest) GetMoveKey() string { + if x != nil { + return x.MoveKey + } + return "" +} + +func (x *SMoveRequest) GetMembers() []string { + if x != nil { + return x.Members + } + return nil +} + +type SMoveResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *SMoveResponse) Reset() { + *x = SMoveResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_setx_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SMoveResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SMoveResponse) ProtoMessage() {} + +func (x *SMoveResponse) ProtoReflect() protoreflect.Message { + mi := &file_setx_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 SMoveResponse.ProtoReflect.Descriptor instead. +func (*SMoveResponse) Descriptor() ([]byte, []int) { + return file_setx_proto_rawDescGZIP(), []int{15} +} + +type SPopRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Count int32 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` +} + +func (x *SPopRequest) Reset() { + *x = SPopRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_setx_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SPopRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SPopRequest) ProtoMessage() {} + +func (x *SPopRequest) ProtoReflect() protoreflect.Message { + mi := &file_setx_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 SPopRequest.ProtoReflect.Descriptor instead. +func (*SPopRequest) Descriptor() ([]byte, []int) { + return file_setx_proto_rawDescGZIP(), []int{16} +} + +func (x *SPopRequest) GetKey() *BaseKey { + if x != nil { + return x.Key + } + return nil +} + +func (x *SPopRequest) GetCount() int32 { + if x != nil { + return x.Count + } + return 0 +} + +type SPopResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Members []string `protobuf:"bytes,1,rep,name=members,proto3" json:"members,omitempty"` +} + +func (x *SPopResponse) Reset() { + *x = SPopResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_setx_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SPopResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SPopResponse) ProtoMessage() {} + +func (x *SPopResponse) ProtoReflect() protoreflect.Message { + mi := &file_setx_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 SPopResponse.ProtoReflect.Descriptor instead. +func (*SPopResponse) Descriptor() ([]byte, []int) { + return file_setx_proto_rawDescGZIP(), []int{17} +} + +func (x *SPopResponse) GetMembers() []string { + if x != nil { + return x.Members + } + return nil +} + +type SRemRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Count int32 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` +} + +func (x *SRemRequest) Reset() { + *x = SRemRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_setx_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SRemRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SRemRequest) ProtoMessage() {} + +func (x *SRemRequest) ProtoReflect() protoreflect.Message { + mi := &file_setx_proto_msgTypes[18] + 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 SRemRequest.ProtoReflect.Descriptor instead. +func (*SRemRequest) Descriptor() ([]byte, []int) { + return file_setx_proto_rawDescGZIP(), []int{18} +} + +func (x *SRemRequest) GetKey() *BaseKey { + if x != nil { + return x.Key + } + return nil +} + +func (x *SRemRequest) GetCount() int32 { + if x != nil { + return x.Count + } + return 0 +} + +type SRemResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *SRemResponse) Reset() { + *x = SRemResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_setx_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SRemResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SRemResponse) ProtoMessage() {} + +func (x *SRemResponse) ProtoReflect() protoreflect.Message { + mi := &file_setx_proto_msgTypes[19] + 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 SRemResponse.ProtoReflect.Descriptor instead. +func (*SRemResponse) Descriptor() ([]byte, []int) { + return file_setx_proto_rawDescGZIP(), []int{19} +} + +type SUnionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + SKeys []string `protobuf:"bytes,2,rep,name=sKeys,proto3" json:"sKeys,omitempty"` +} + +func (x *SUnionRequest) Reset() { + *x = SUnionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_setx_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SUnionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SUnionRequest) ProtoMessage() {} + +func (x *SUnionRequest) ProtoReflect() protoreflect.Message { + mi := &file_setx_proto_msgTypes[20] + 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 SUnionRequest.ProtoReflect.Descriptor instead. +func (*SUnionRequest) Descriptor() ([]byte, []int) { + return file_setx_proto_rawDescGZIP(), []int{20} +} + +func (x *SUnionRequest) GetKey() *BaseKey { + if x != nil { + return x.Key + } + return nil +} + +func (x *SUnionRequest) GetSKeys() []string { + if x != nil { + return x.SKeys + } + return nil +} + +type SUnionResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Results []string `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` +} + +func (x *SUnionResponse) Reset() { + *x = SUnionResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_setx_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SUnionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SUnionResponse) ProtoMessage() {} + +func (x *SUnionResponse) ProtoReflect() protoreflect.Message { + mi := &file_setx_proto_msgTypes[21] + 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 SUnionResponse.ProtoReflect.Descriptor instead. +func (*SUnionResponse) Descriptor() ([]byte, []int) { + return file_setx_proto_rawDescGZIP(), []int{21} +} + +func (x *SUnionResponse) GetResults() []string { + if x != nil { + return x.Results + } + return nil +} + +type SUnionStoreRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + SKeys []string `protobuf:"bytes,2,rep,name=sKeys,proto3" json:"sKeys,omitempty"` + SaveKey string `protobuf:"bytes,3,opt,name=save_key,json=saveKey,proto3" json:"save_key,omitempty"` +} + +func (x *SUnionStoreRequest) Reset() { + *x = SUnionStoreRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_setx_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SUnionStoreRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SUnionStoreRequest) ProtoMessage() {} + +func (x *SUnionStoreRequest) ProtoReflect() protoreflect.Message { + mi := &file_setx_proto_msgTypes[22] + 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 SUnionStoreRequest.ProtoReflect.Descriptor instead. +func (*SUnionStoreRequest) Descriptor() ([]byte, []int) { + return file_setx_proto_rawDescGZIP(), []int{22} +} + +func (x *SUnionStoreRequest) GetKey() *BaseKey { + if x != nil { + return x.Key + } + return nil +} + +func (x *SUnionStoreRequest) GetSKeys() []string { + if x != nil { + return x.SKeys + } + return nil +} + +func (x *SUnionStoreRequest) GetSaveKey() string { + if x != nil { + return x.SaveKey + } + return "" +} + +type SUnionStoreResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *SUnionStoreResponse) Reset() { + *x = SUnionStoreResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_setx_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SUnionStoreResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SUnionStoreResponse) ProtoMessage() {} + +func (x *SUnionStoreResponse) ProtoReflect() protoreflect.Message { + mi := &file_setx_proto_msgTypes[23] + 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 SUnionStoreResponse.ProtoReflect.Descriptor instead. +func (*SUnionStoreResponse) Descriptor() ([]byte, []int) { + return file_setx_proto_rawDescGZIP(), []int{23} +} + +type SScanRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Sursor int32 `protobuf:"varint,2,opt,name=sursor,proto3" json:"sursor,omitempty"` + Regexp string `protobuf:"bytes,3,opt,name=regexp,proto3" json:"regexp,omitempty"` + Count int32 `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"` +} + +func (x *SScanRequest) Reset() { + *x = SScanRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_setx_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SScanRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SScanRequest) ProtoMessage() {} + +func (x *SScanRequest) ProtoReflect() protoreflect.Message { + mi := &file_setx_proto_msgTypes[24] + 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 SScanRequest.ProtoReflect.Descriptor instead. +func (*SScanRequest) Descriptor() ([]byte, []int) { + return file_setx_proto_rawDescGZIP(), []int{24} +} + +func (x *SScanRequest) GetKey() *BaseKey { + if x != nil { + return x.Key + } + return nil +} + +func (x *SScanRequest) GetSursor() int32 { + if x != nil { + return x.Sursor + } + return 0 +} + +func (x *SScanRequest) GetRegexp() string { + if x != nil { + return x.Regexp + } + return "" +} + +func (x *SScanRequest) GetCount() int32 { + if x != nil { + return x.Count + } + return 0 +} + +type SScanResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Results []string `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` +} + +func (x *SScanResponse) Reset() { + *x = SScanResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_setx_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SScanResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SScanResponse) ProtoMessage() {} + +func (x *SScanResponse) ProtoReflect() protoreflect.Message { + mi := &file_setx_proto_msgTypes[25] + 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 SScanResponse.ProtoReflect.Descriptor instead. +func (*SScanResponse) Descriptor() ([]byte, []int) { + return file_setx_proto_rawDescGZIP(), []int{25} +} + +func (x *SScanResponse) GetResults() []string { + if x != nil { + return x.Results + } + return nil +} + +var File_setx_proto protoreflect.FileDescriptor + +var file_setx_proto_rawDesc = []byte{ + 0x0a, 0x0a, 0x73, 0x65, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x62, 0x61, + 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x41, 0x0a, 0x0b, 0x53, 0x41, 0x64, 0x64, + 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, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x0e, 0x0a, 0x0c, 0x53, + 0x41, 0x64, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2a, 0x0a, 0x0c, 0x53, + 0x43, 0x61, 0x72, 0x64, 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, 0x27, 0x0a, 0x0d, 0x53, 0x43, 0x61, 0x72, 0x64, + 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, 0x40, 0x0a, 0x0c, 0x53, 0x44, 0x69, 0x66, 0x66, 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, 0x14, 0x0a, 0x05, + 0x73, 0x4b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x73, 0x4b, 0x65, + 0x79, 0x73, 0x22, 0x29, 0x0a, 0x0d, 0x53, 0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x6c, 0x75, 0x74, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x73, 0x6c, 0x75, 0x74, 0x73, 0x22, 0x60, 0x0a, + 0x11, 0x53, 0x44, 0x69, 0x66, 0x66, 0x53, 0x74, 0x6f, 0x72, 0x65, 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, 0x14, + 0x0a, 0x05, 0x73, 0x4b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x73, + 0x4b, 0x65, 0x79, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x61, 0x76, 0x65, 0x5f, 0x6b, 0x65, 0x79, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x61, 0x76, 0x65, 0x4b, 0x65, 0x79, 0x22, + 0x14, 0x0a, 0x12, 0x53, 0x44, 0x69, 0x66, 0x66, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x41, 0x0a, 0x0d, 0x53, 0x49, 0x6e, 0x74, 0x65, 0x72, 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, 0x14, 0x0a, 0x05, 0x73, 0x4b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x05, 0x73, 0x4b, 0x65, 0x79, 0x73, 0x22, 0x2a, 0x0a, 0x0e, 0x53, 0x49, 0x6e, 0x74, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, + 0x73, 0x6c, 0x75, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x73, + 0x6c, 0x75, 0x74, 0x73, 0x22, 0x61, 0x0a, 0x12, 0x53, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x53, 0x74, + 0x6f, 0x72, 0x65, 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, 0x14, 0x0a, 0x05, 0x73, 0x4b, 0x65, 0x79, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x73, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x19, 0x0a, 0x08, + 0x73, 0x61, 0x76, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x73, 0x61, 0x76, 0x65, 0x4b, 0x65, 0x79, 0x22, 0x15, 0x0a, 0x13, 0x53, 0x49, 0x6e, 0x74, 0x65, + 0x72, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x46, + 0x0a, 0x10, 0x53, 0x49, 0x73, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 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, 0x16, + 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x29, 0x0a, 0x11, 0x53, 0x49, 0x73, 0x4d, 0x65, 0x6d, + 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, + 0x78, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x65, 0x78, 0x69, 0x73, + 0x74, 0x22, 0x5f, 0x0a, 0x0c, 0x53, 0x4d, 0x6f, 0x76, 0x65, 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, 0x19, 0x0a, + 0x08, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x6d, 0x6f, 0x76, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, + 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, + 0x72, 0x73, 0x22, 0x0f, 0x0a, 0x0d, 0x53, 0x4d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x3f, 0x0a, 0x0b, 0x53, 0x50, 0x6f, 0x70, 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, 0x14, + 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x28, 0x0a, 0x0c, 0x53, 0x50, 0x6f, 0x70, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x22, 0x3f, + 0x0a, 0x0b, 0x53, 0x52, 0x65, 0x6d, 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, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, + 0x0e, 0x0a, 0x0c, 0x53, 0x52, 0x65, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x41, 0x0a, 0x0d, 0x53, 0x55, 0x6e, 0x69, 0x6f, 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, 0x12, 0x14, 0x0a, 0x05, + 0x73, 0x4b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x73, 0x4b, 0x65, + 0x79, 0x73, 0x22, 0x2a, 0x0a, 0x0e, 0x53, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x22, 0x61, + 0x0a, 0x12, 0x53, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x6f, 0x72, 0x65, 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, 0x14, 0x0a, 0x05, 0x73, 0x4b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x05, 0x73, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x61, 0x76, 0x65, 0x5f, 0x6b, + 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x61, 0x76, 0x65, 0x4b, 0x65, + 0x79, 0x22, 0x15, 0x0a, 0x13, 0x53, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x6f, 0x72, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x70, 0x0a, 0x0c, 0x53, 0x53, 0x63, 0x61, + 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, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x12, 0x16, 0x0a, 0x06, + 0x72, 0x65, 0x67, 0x65, 0x78, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, + 0x67, 0x65, 0x78, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x29, 0x0a, 0x0d, 0x53, 0x53, + 0x63, 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, + 0x73, 0x75, 0x6c, 0x74, 0x73, 0x42, 0x0b, 0x5a, 0x09, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_setx_proto_rawDescOnce sync.Once + file_setx_proto_rawDescData = file_setx_proto_rawDesc +) + +func file_setx_proto_rawDescGZIP() []byte { + file_setx_proto_rawDescOnce.Do(func() { + file_setx_proto_rawDescData = protoimpl.X.CompressGZIP(file_setx_proto_rawDescData) + }) + return file_setx_proto_rawDescData +} + +var file_setx_proto_msgTypes = make([]protoimpl.MessageInfo, 26) +var file_setx_proto_goTypes = []interface{}{ + (*SAddRequest)(nil), // 0: SAddRequest + (*SAddResponse)(nil), // 1: SAddResponse + (*SCardRequest)(nil), // 2: SCardRequest + (*SCardResponse)(nil), // 3: SCardResponse + (*SDiffRequest)(nil), // 4: SDiffRequest + (*SDiffResponse)(nil), // 5: SDiffResponse + (*SDiffStoreRequest)(nil), // 6: SDiffStoreRequest + (*SDiffStoreResponse)(nil), // 7: SDiffStoreResponse + (*SInterRequest)(nil), // 8: SInterRequest + (*SInterResponse)(nil), // 9: SInterResponse + (*SInterStoreRequest)(nil), // 10: SInterStoreRequest + (*SInterStoreResponse)(nil), // 11: SInterStoreResponse + (*SIsMemberRequest)(nil), // 12: SIsMemberRequest + (*SIsMemberResponse)(nil), // 13: SIsMemberResponse + (*SMoveRequest)(nil), // 14: SMoveRequest + (*SMoveResponse)(nil), // 15: SMoveResponse + (*SPopRequest)(nil), // 16: SPopRequest + (*SPopResponse)(nil), // 17: SPopResponse + (*SRemRequest)(nil), // 18: SRemRequest + (*SRemResponse)(nil), // 19: SRemResponse + (*SUnionRequest)(nil), // 20: SUnionRequest + (*SUnionResponse)(nil), // 21: SUnionResponse + (*SUnionStoreRequest)(nil), // 22: SUnionStoreRequest + (*SUnionStoreResponse)(nil), // 23: SUnionStoreResponse + (*SScanRequest)(nil), // 24: SScanRequest + (*SScanResponse)(nil), // 25: SScanResponse + (*BaseKey)(nil), // 26: BaseKey +} +var file_setx_proto_depIdxs = []int32{ + 26, // 0: SAddRequest.key:type_name -> BaseKey + 26, // 1: SCardRequest.key:type_name -> BaseKey + 26, // 2: SDiffRequest.key:type_name -> BaseKey + 26, // 3: SDiffStoreRequest.key:type_name -> BaseKey + 26, // 4: SInterRequest.key:type_name -> BaseKey + 26, // 5: SInterStoreRequest.key:type_name -> BaseKey + 26, // 6: SIsMemberRequest.key:type_name -> BaseKey + 26, // 7: SMoveRequest.key:type_name -> BaseKey + 26, // 8: SPopRequest.key:type_name -> BaseKey + 26, // 9: SRemRequest.key:type_name -> BaseKey + 26, // 10: SUnionRequest.key:type_name -> BaseKey + 26, // 11: SUnionStoreRequest.key:type_name -> BaseKey + 26, // 12: SScanRequest.key:type_name -> BaseKey + 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_setx_proto_init() } +func file_setx_proto_init() { + if File_setx_proto != nil { + return + } + file_base_proto_init() + if !protoimpl.UnsafeEnabled { + file_setx_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SAddRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_setx_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SAddResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_setx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SCardRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_setx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SCardResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_setx_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SDiffRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_setx_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SDiffResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_setx_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SDiffStoreRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_setx_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SDiffStoreResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_setx_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SInterRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_setx_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SInterResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_setx_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SInterStoreRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_setx_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SInterStoreResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_setx_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SIsMemberRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_setx_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SIsMemberResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_setx_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SMoveRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_setx_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SMoveResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_setx_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SPopRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_setx_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SPopResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_setx_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SRemRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_setx_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SRemResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_setx_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SUnionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_setx_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SUnionResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_setx_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SUnionStoreRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_setx_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SUnionStoreResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_setx_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SScanRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_setx_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SScanResponse); 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_setx_proto_rawDesc, + NumEnums: 0, + NumMessages: 26, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_setx_proto_goTypes, + DependencyIndexes: file_setx_proto_depIdxs, + MessageInfos: file_setx_proto_msgTypes, + }.Build() + File_setx_proto = out.File + file_setx_proto_rawDesc = nil + file_setx_proto_goTypes = nil + file_setx_proto_depIdxs = nil +} diff --git a/pkg/proto/storage.pb.go b/pkg/proto/storage.pb.go index cace64b..22731e0 100644 --- a/pkg/proto/storage.pb.go +++ b/pkg/proto/storage.pb.go @@ -32,152 +32,215 @@ 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, 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, + 0x68, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x73, 0x65, 0x74, 0x78, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xb1, 0x0e, 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, 0x12, 0x23, 0x0a, 0x04, 0x53, 0x41, 0x64, 0x64, 0x12, 0x0c, 0x2e, 0x53, + 0x41, 0x64, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x53, 0x41, 0x64, + 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x05, 0x53, 0x43, 0x61, + 0x72, 0x64, 0x12, 0x0d, 0x2e, 0x53, 0x43, 0x61, 0x72, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x0e, 0x2e, 0x53, 0x43, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x26, 0x0a, 0x05, 0x53, 0x44, 0x69, 0x66, 0x66, 0x12, 0x0d, 0x2e, 0x53, 0x44, 0x69, + 0x66, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x53, 0x44, 0x69, 0x66, + 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x0a, 0x53, 0x44, 0x69, + 0x66, 0x66, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x12, 0x2e, 0x53, 0x44, 0x69, 0x66, 0x66, 0x53, + 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x53, 0x44, + 0x69, 0x66, 0x66, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x29, 0x0a, 0x06, 0x53, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x0e, 0x2e, 0x53, 0x49, 0x6e, + 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x53, 0x49, 0x6e, + 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x0b, 0x53, + 0x49, 0x6e, 0x74, 0x65, 0x72, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x13, 0x2e, 0x53, 0x49, 0x6e, + 0x74, 0x65, 0x72, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x14, 0x2e, 0x53, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x09, 0x53, 0x49, 0x73, 0x4d, 0x65, 0x6d, 0x62, + 0x65, 0x72, 0x12, 0x11, 0x2e, 0x53, 0x49, 0x73, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x53, 0x49, 0x73, 0x4d, 0x65, 0x6d, 0x62, 0x65, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x05, 0x53, 0x4d, 0x6f, + 0x76, 0x65, 0x12, 0x0d, 0x2e, 0x53, 0x4d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x0e, 0x2e, 0x53, 0x4d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x23, 0x0a, 0x04, 0x53, 0x50, 0x6f, 0x70, 0x12, 0x0c, 0x2e, 0x53, 0x50, 0x6f, 0x70, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x53, 0x50, 0x6f, 0x70, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x53, 0x52, 0x65, 0x6d, 0x12, 0x0c, + 0x2e, 0x53, 0x52, 0x65, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x53, + 0x52, 0x65, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x53, + 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x2e, 0x53, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x53, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x0b, 0x53, 0x55, 0x6e, 0x69, 0x6f, 0x6e, + 0x53, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x13, 0x2e, 0x53, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x53, 0x74, + 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x53, 0x55, 0x6e, + 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x26, 0x0a, 0x05, 0x53, 0x53, 0x63, 0x61, 0x6e, 0x12, 0x0d, 0x2e, 0x53, 0x53, 0x63, 0x61, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x53, 0x53, 0x63, 0x61, 0x6e, 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{}{ - (*SetRequest)(nil), // 0: SetRequest - (*GetRequest)(nil), // 1: GetRequest - (*AddRequest)(nil), // 2: AddRequest - (*ReduceRequest)(nil), // 3: ReduceRequest - (*SetBitRequest)(nil), // 4: SetBitRequest - (*GetBitRequest)(nil), // 5: GetBitRequest - (*GetRangeRequest)(nil), // 6: GetRangeRequest - (*GetSetRequest)(nil), // 7: GetSetRequest - (*StrLenRequest)(nil), // 8: StrLenRequest - (*SetnxRequest)(nil), // 9: SetnxRequest - (*LIndexRequest)(nil), // 10: LIndexRequest - (*LLenRequest)(nil), // 11: LLenRequest - (*LPopRequest)(nil), // 12: LPopRequest - (*LPushRequest)(nil), // 13: LPushRequest - (*LPushXRequest)(nil), // 14: LPushXRequest - (*LRangeRequest)(nil), // 15: LRangeRequest - (*LRemRequest)(nil), // 16: LRemRequest - (*LSetRequest)(nil), // 17: LSetRequest - (*RPopRequest)(nil), // 18: RPopRequest - (*LTrimRequest)(nil), // 19: LTrimRequest - (*RPushRequest)(nil), // 20: RPushRequest - (*RPushXRequest)(nil), // 21: RPushXRequest - (*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 + (*SetRequest)(nil), // 0: SetRequest + (*GetRequest)(nil), // 1: GetRequest + (*AddRequest)(nil), // 2: AddRequest + (*ReduceRequest)(nil), // 3: ReduceRequest + (*SetBitRequest)(nil), // 4: SetBitRequest + (*GetBitRequest)(nil), // 5: GetBitRequest + (*GetRangeRequest)(nil), // 6: GetRangeRequest + (*GetSetRequest)(nil), // 7: GetSetRequest + (*StrLenRequest)(nil), // 8: StrLenRequest + (*SetnxRequest)(nil), // 9: SetnxRequest + (*LIndexRequest)(nil), // 10: LIndexRequest + (*LLenRequest)(nil), // 11: LLenRequest + (*LPopRequest)(nil), // 12: LPopRequest + (*LPushRequest)(nil), // 13: LPushRequest + (*LPushXRequest)(nil), // 14: LPushXRequest + (*LRangeRequest)(nil), // 15: LRangeRequest + (*LRemRequest)(nil), // 16: LRemRequest + (*LSetRequest)(nil), // 17: LSetRequest + (*RPopRequest)(nil), // 18: RPopRequest + (*LTrimRequest)(nil), // 19: LTrimRequest + (*RPushRequest)(nil), // 20: RPushRequest + (*RPushXRequest)(nil), // 21: RPushXRequest + (*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 + (*SAddRequest)(nil), // 31: SAddRequest + (*SCardRequest)(nil), // 32: SCardRequest + (*SDiffRequest)(nil), // 33: SDiffRequest + (*SDiffStoreRequest)(nil), // 34: SDiffStoreRequest + (*SInterRequest)(nil), // 35: SInterRequest + (*SInterStoreRequest)(nil), // 36: SInterStoreRequest + (*SIsMemberRequest)(nil), // 37: SIsMemberRequest + (*SMoveRequest)(nil), // 38: SMoveRequest + (*SPopRequest)(nil), // 39: SPopRequest + (*SRemRequest)(nil), // 40: SRemRequest + (*SUnionRequest)(nil), // 41: SUnionRequest + (*SUnionStoreRequest)(nil), // 42: SUnionStoreRequest + (*SScanRequest)(nil), // 43: SScanRequest + (*SetResponse)(nil), // 44: SetResponse + (*GetResponse)(nil), // 45: GetResponse + (*AddResponse)(nil), // 46: AddResponse + (*ReduceResponse)(nil), // 47: ReduceResponse + (*SetBitResponse)(nil), // 48: SetBitResponse + (*GetBitResponse)(nil), // 49: GetBitResponse + (*GetRangeResponse)(nil), // 50: GetRangeResponse + (*GetSetResponse)(nil), // 51: GetSetResponse + (*StrLenResponse)(nil), // 52: StrLenResponse + (*SetnxResponse)(nil), // 53: SetnxResponse + (*LIndexResponse)(nil), // 54: LIndexResponse + (*LLenResponse)(nil), // 55: LLenResponse + (*LPopResponse)(nil), // 56: LPopResponse + (*LPushResponse)(nil), // 57: LPushResponse + (*LPushXResponse)(nil), // 58: LPushXResponse + (*LRangeResponse)(nil), // 59: LRangeResponse + (*LRemResponse)(nil), // 60: LRemResponse + (*LSetResponse)(nil), // 61: LSetResponse + (*RPopResponse)(nil), // 62: RPopResponse + (*LTrimResponse)(nil), // 63: LTrimResponse + (*RPushResponse)(nil), // 64: RPushResponse + (*RPushXResponse)(nil), // 65: RPushXResponse + (*HDelResponse)(nil), // 66: HDelResponse + (*HExistsResponse)(nil), // 67: HExistsResponse + (*HGetResponse)(nil), // 68: HGetResponse + (*HGetAllResponse)(nil), // 69: HGetAllResponse + (*HIncrByResponse)(nil), // 70: HIncrByResponse + (*HKeysResponse)(nil), // 71: HKeysResponse + (*HLenResponse)(nil), // 72: HLenResponse + (*HSetResponse)(nil), // 73: HSetResponse + (*HSetXResponse)(nil), // 74: HSetXResponse + (*SAddResponse)(nil), // 75: SAddResponse + (*SCardResponse)(nil), // 76: SCardResponse + (*SDiffResponse)(nil), // 77: SDiffResponse + (*SDiffStoreResponse)(nil), // 78: SDiffStoreResponse + (*SInterResponse)(nil), // 79: SInterResponse + (*SInterStoreResponse)(nil), // 80: SInterStoreResponse + (*SIsMemberResponse)(nil), // 81: SIsMemberResponse + (*SMoveResponse)(nil), // 82: SMoveResponse + (*SPopResponse)(nil), // 83: SPopResponse + (*SRemResponse)(nil), // 84: SRemResponse + (*SUnionResponse)(nil), // 85: SUnionResponse + (*SUnionStoreResponse)(nil), // 86: SUnionStoreResponse + (*SScanResponse)(nil), // 87: SScanResponse } var file_storage_proto_depIdxs = []int32{ 0, // 0: CommServer.Set:input_type -> SetRequest @@ -211,39 +274,65 @@ var file_storage_proto_depIdxs = []int32{ 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 + 31, // 31: CommServer.SAdd:input_type -> SAddRequest + 32, // 32: CommServer.SCard:input_type -> SCardRequest + 33, // 33: CommServer.SDiff:input_type -> SDiffRequest + 34, // 34: CommServer.SDiffStore:input_type -> SDiffStoreRequest + 35, // 35: CommServer.SInter:input_type -> SInterRequest + 36, // 36: CommServer.SInterStore:input_type -> SInterStoreRequest + 37, // 37: CommServer.SIsMember:input_type -> SIsMemberRequest + 38, // 38: CommServer.SMove:input_type -> SMoveRequest + 39, // 39: CommServer.SPop:input_type -> SPopRequest + 40, // 40: CommServer.SRem:input_type -> SRemRequest + 41, // 41: CommServer.SUnion:input_type -> SUnionRequest + 42, // 42: CommServer.SUnionStore:input_type -> SUnionStoreRequest + 43, // 43: CommServer.SScan:input_type -> SScanRequest + 44, // 44: CommServer.Set:output_type -> SetResponse + 45, // 45: CommServer.Get:output_type -> GetResponse + 46, // 46: CommServer.Add:output_type -> AddResponse + 47, // 47: CommServer.Reduce:output_type -> ReduceResponse + 48, // 48: CommServer.SetBit:output_type -> SetBitResponse + 49, // 49: CommServer.GetBit:output_type -> GetBitResponse + 50, // 50: CommServer.GetRange:output_type -> GetRangeResponse + 51, // 51: CommServer.GetSet:output_type -> GetSetResponse + 52, // 52: CommServer.StrLen:output_type -> StrLenResponse + 53, // 53: CommServer.Setnx:output_type -> SetnxResponse + 54, // 54: CommServer.LIndex:output_type -> LIndexResponse + 55, // 55: CommServer.LLen:output_type -> LLenResponse + 56, // 56: CommServer.LPop:output_type -> LPopResponse + 57, // 57: CommServer.LPush:output_type -> LPushResponse + 58, // 58: CommServer.LPushX:output_type -> LPushXResponse + 59, // 59: CommServer.LRange:output_type -> LRangeResponse + 60, // 60: CommServer.LRem:output_type -> LRemResponse + 61, // 61: CommServer.LSet:output_type -> LSetResponse + 62, // 62: CommServer.RPop:output_type -> RPopResponse + 63, // 63: CommServer.LTrim:output_type -> LTrimResponse + 64, // 64: CommServer.RPush:output_type -> RPushResponse + 65, // 65: CommServer.RPushX:output_type -> RPushXResponse + 66, // 66: CommServer.HDel:output_type -> HDelResponse + 67, // 67: CommServer.HExists:output_type -> HExistsResponse + 68, // 68: CommServer.HGet:output_type -> HGetResponse + 69, // 69: CommServer.HGetAll:output_type -> HGetAllResponse + 70, // 70: CommServer.HIncrBy:output_type -> HIncrByResponse + 71, // 71: CommServer.HKeys:output_type -> HKeysResponse + 72, // 72: CommServer.HLen:output_type -> HLenResponse + 73, // 73: CommServer.HSet:output_type -> HSetResponse + 74, // 74: CommServer.HSetX:output_type -> HSetXResponse + 75, // 75: CommServer.SAdd:output_type -> SAddResponse + 76, // 76: CommServer.SCard:output_type -> SCardResponse + 77, // 77: CommServer.SDiff:output_type -> SDiffResponse + 78, // 78: CommServer.SDiffStore:output_type -> SDiffStoreResponse + 79, // 79: CommServer.SInter:output_type -> SInterResponse + 80, // 80: CommServer.SInterStore:output_type -> SInterStoreResponse + 81, // 81: CommServer.SIsMember:output_type -> SIsMemberResponse + 82, // 82: CommServer.SMove:output_type -> SMoveResponse + 83, // 83: CommServer.SPop:output_type -> SPopResponse + 84, // 84: CommServer.SRem:output_type -> SRemResponse + 85, // 85: CommServer.SUnion:output_type -> SUnionResponse + 86, // 86: CommServer.SUnionStore:output_type -> SUnionStoreResponse + 87, // 87: CommServer.SScan:output_type -> SScanResponse + 44, // [44:88] is the sub-list for method output_type + 0, // [0:44] 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 @@ -257,6 +346,7 @@ func file_storage_proto_init() { file_stringx_proto_init() file_listx_proto_init() file_hashx_proto_init() + file_setx_proto_init() type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ @@ -319,6 +409,19 @@ type CommServerClient interface { 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) + SAdd(ctx context.Context, in *SAddRequest, opts ...grpc.CallOption) (*SAddResponse, error) + SCard(ctx context.Context, in *SCardRequest, opts ...grpc.CallOption) (*SCardResponse, error) + SDiff(ctx context.Context, in *SDiffRequest, opts ...grpc.CallOption) (*SDiffResponse, error) + SDiffStore(ctx context.Context, in *SDiffStoreRequest, opts ...grpc.CallOption) (*SDiffStoreResponse, error) + SInter(ctx context.Context, in *SInterRequest, opts ...grpc.CallOption) (*SInterResponse, error) + SInterStore(ctx context.Context, in *SInterStoreRequest, opts ...grpc.CallOption) (*SInterStoreResponse, error) + SIsMember(ctx context.Context, in *SIsMemberRequest, opts ...grpc.CallOption) (*SIsMemberResponse, error) + SMove(ctx context.Context, in *SMoveRequest, opts ...grpc.CallOption) (*SMoveResponse, error) + SPop(ctx context.Context, in *SPopRequest, opts ...grpc.CallOption) (*SPopResponse, error) + SRem(ctx context.Context, in *SRemRequest, opts ...grpc.CallOption) (*SRemResponse, error) + SUnion(ctx context.Context, in *SUnionRequest, opts ...grpc.CallOption) (*SUnionResponse, error) + SUnionStore(ctx context.Context, in *SUnionStoreRequest, opts ...grpc.CallOption) (*SUnionStoreResponse, error) + SScan(ctx context.Context, in *SScanRequest, opts ...grpc.CallOption) (*SScanResponse, error) } type commServerClient struct { @@ -608,6 +711,123 @@ func (c *commServerClient) HSetX(ctx context.Context, in *HSetXRequest, opts ... return out, nil } +func (c *commServerClient) SAdd(ctx context.Context, in *SAddRequest, opts ...grpc.CallOption) (*SAddResponse, error) { + out := new(SAddResponse) + err := c.cc.Invoke(ctx, "/CommServer/SAdd", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *commServerClient) SCard(ctx context.Context, in *SCardRequest, opts ...grpc.CallOption) (*SCardResponse, error) { + out := new(SCardResponse) + err := c.cc.Invoke(ctx, "/CommServer/SCard", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *commServerClient) SDiff(ctx context.Context, in *SDiffRequest, opts ...grpc.CallOption) (*SDiffResponse, error) { + out := new(SDiffResponse) + err := c.cc.Invoke(ctx, "/CommServer/SDiff", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *commServerClient) SDiffStore(ctx context.Context, in *SDiffStoreRequest, opts ...grpc.CallOption) (*SDiffStoreResponse, error) { + out := new(SDiffStoreResponse) + err := c.cc.Invoke(ctx, "/CommServer/SDiffStore", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *commServerClient) SInter(ctx context.Context, in *SInterRequest, opts ...grpc.CallOption) (*SInterResponse, error) { + out := new(SInterResponse) + err := c.cc.Invoke(ctx, "/CommServer/SInter", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *commServerClient) SInterStore(ctx context.Context, in *SInterStoreRequest, opts ...grpc.CallOption) (*SInterStoreResponse, error) { + out := new(SInterStoreResponse) + err := c.cc.Invoke(ctx, "/CommServer/SInterStore", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *commServerClient) SIsMember(ctx context.Context, in *SIsMemberRequest, opts ...grpc.CallOption) (*SIsMemberResponse, error) { + out := new(SIsMemberResponse) + err := c.cc.Invoke(ctx, "/CommServer/SIsMember", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *commServerClient) SMove(ctx context.Context, in *SMoveRequest, opts ...grpc.CallOption) (*SMoveResponse, error) { + out := new(SMoveResponse) + err := c.cc.Invoke(ctx, "/CommServer/SMove", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *commServerClient) SPop(ctx context.Context, in *SPopRequest, opts ...grpc.CallOption) (*SPopResponse, error) { + out := new(SPopResponse) + err := c.cc.Invoke(ctx, "/CommServer/SPop", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *commServerClient) SRem(ctx context.Context, in *SRemRequest, opts ...grpc.CallOption) (*SRemResponse, error) { + out := new(SRemResponse) + err := c.cc.Invoke(ctx, "/CommServer/SRem", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *commServerClient) SUnion(ctx context.Context, in *SUnionRequest, opts ...grpc.CallOption) (*SUnionResponse, error) { + out := new(SUnionResponse) + err := c.cc.Invoke(ctx, "/CommServer/SUnion", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *commServerClient) SUnionStore(ctx context.Context, in *SUnionStoreRequest, opts ...grpc.CallOption) (*SUnionStoreResponse, error) { + out := new(SUnionStoreResponse) + err := c.cc.Invoke(ctx, "/CommServer/SUnionStore", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *commServerClient) SScan(ctx context.Context, in *SScanRequest, opts ...grpc.CallOption) (*SScanResponse, error) { + out := new(SScanResponse) + err := c.cc.Invoke(ctx, "/CommServer/SScan", 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) @@ -641,6 +861,19 @@ type CommServerServer interface { HLen(context.Context, *HLenRequest) (*HLenResponse, error) HSet(context.Context, *HSetRequest) (*HSetResponse, error) HSetX(context.Context, *HSetXRequest) (*HSetXResponse, error) + SAdd(context.Context, *SAddRequest) (*SAddResponse, error) + SCard(context.Context, *SCardRequest) (*SCardResponse, error) + SDiff(context.Context, *SDiffRequest) (*SDiffResponse, error) + SDiffStore(context.Context, *SDiffStoreRequest) (*SDiffStoreResponse, error) + SInter(context.Context, *SInterRequest) (*SInterResponse, error) + SInterStore(context.Context, *SInterStoreRequest) (*SInterStoreResponse, error) + SIsMember(context.Context, *SIsMemberRequest) (*SIsMemberResponse, error) + SMove(context.Context, *SMoveRequest) (*SMoveResponse, error) + SPop(context.Context, *SPopRequest) (*SPopResponse, error) + SRem(context.Context, *SRemRequest) (*SRemResponse, error) + SUnion(context.Context, *SUnionRequest) (*SUnionResponse, error) + SUnionStore(context.Context, *SUnionStoreRequest) (*SUnionStoreResponse, error) + SScan(context.Context, *SScanRequest) (*SScanResponse, error) } // UnimplementedCommServerServer can be embedded to have forward compatible implementations. @@ -740,6 +973,45 @@ func (*UnimplementedCommServerServer) HSet(context.Context, *HSetRequest) (*HSet func (*UnimplementedCommServerServer) HSetX(context.Context, *HSetXRequest) (*HSetXResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method HSetX not implemented") } +func (*UnimplementedCommServerServer) SAdd(context.Context, *SAddRequest) (*SAddResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SAdd not implemented") +} +func (*UnimplementedCommServerServer) SCard(context.Context, *SCardRequest) (*SCardResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SCard not implemented") +} +func (*UnimplementedCommServerServer) SDiff(context.Context, *SDiffRequest) (*SDiffResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SDiff not implemented") +} +func (*UnimplementedCommServerServer) SDiffStore(context.Context, *SDiffStoreRequest) (*SDiffStoreResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SDiffStore not implemented") +} +func (*UnimplementedCommServerServer) SInter(context.Context, *SInterRequest) (*SInterResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SInter not implemented") +} +func (*UnimplementedCommServerServer) SInterStore(context.Context, *SInterStoreRequest) (*SInterStoreResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SInterStore not implemented") +} +func (*UnimplementedCommServerServer) SIsMember(context.Context, *SIsMemberRequest) (*SIsMemberResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SIsMember not implemented") +} +func (*UnimplementedCommServerServer) SMove(context.Context, *SMoveRequest) (*SMoveResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SMove not implemented") +} +func (*UnimplementedCommServerServer) SPop(context.Context, *SPopRequest) (*SPopResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SPop not implemented") +} +func (*UnimplementedCommServerServer) SRem(context.Context, *SRemRequest) (*SRemResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SRem not implemented") +} +func (*UnimplementedCommServerServer) SUnion(context.Context, *SUnionRequest) (*SUnionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SUnion not implemented") +} +func (*UnimplementedCommServerServer) SUnionStore(context.Context, *SUnionStoreRequest) (*SUnionStoreResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SUnionStore not implemented") +} +func (*UnimplementedCommServerServer) SScan(context.Context, *SScanRequest) (*SScanResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SScan not implemented") +} func RegisterCommServerServer(s *grpc.Server, srv CommServerServer) { s.RegisterService(&_CommServer_serviceDesc, srv) @@ -1303,6 +1575,240 @@ func _CommServer_HSetX_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _CommServer_SAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SAddRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CommServerServer).SAdd(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/CommServer/SAdd", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CommServerServer).SAdd(ctx, req.(*SAddRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CommServer_SCard_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SCardRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CommServerServer).SCard(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/CommServer/SCard", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CommServerServer).SCard(ctx, req.(*SCardRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CommServer_SDiff_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SDiffRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CommServerServer).SDiff(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/CommServer/SDiff", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CommServerServer).SDiff(ctx, req.(*SDiffRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CommServer_SDiffStore_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SDiffStoreRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CommServerServer).SDiffStore(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/CommServer/SDiffStore", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CommServerServer).SDiffStore(ctx, req.(*SDiffStoreRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CommServer_SInter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SInterRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CommServerServer).SInter(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/CommServer/SInter", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CommServerServer).SInter(ctx, req.(*SInterRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CommServer_SInterStore_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SInterStoreRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CommServerServer).SInterStore(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/CommServer/SInterStore", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CommServerServer).SInterStore(ctx, req.(*SInterStoreRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CommServer_SIsMember_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SIsMemberRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CommServerServer).SIsMember(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/CommServer/SIsMember", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CommServerServer).SIsMember(ctx, req.(*SIsMemberRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CommServer_SMove_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SMoveRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CommServerServer).SMove(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/CommServer/SMove", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CommServerServer).SMove(ctx, req.(*SMoveRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CommServer_SPop_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SPopRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CommServerServer).SPop(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/CommServer/SPop", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CommServerServer).SPop(ctx, req.(*SPopRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CommServer_SRem_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SRemRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CommServerServer).SRem(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/CommServer/SRem", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CommServerServer).SRem(ctx, req.(*SRemRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CommServer_SUnion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SUnionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CommServerServer).SUnion(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/CommServer/SUnion", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CommServerServer).SUnion(ctx, req.(*SUnionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CommServer_SUnionStore_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SUnionStoreRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CommServerServer).SUnionStore(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/CommServer/SUnionStore", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CommServerServer).SUnionStore(ctx, req.(*SUnionStoreRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CommServer_SScan_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SScanRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CommServerServer).SScan(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/CommServer/SScan", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CommServerServer).SScan(ctx, req.(*SScanRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _CommServer_serviceDesc = grpc.ServiceDesc{ ServiceName: "CommServer", HandlerType: (*CommServerServer)(nil), @@ -1431,6 +1937,58 @@ var _CommServer_serviceDesc = grpc.ServiceDesc{ MethodName: "HSetX", Handler: _CommServer_HSetX_Handler, }, + { + MethodName: "SAdd", + Handler: _CommServer_SAdd_Handler, + }, + { + MethodName: "SCard", + Handler: _CommServer_SCard_Handler, + }, + { + MethodName: "SDiff", + Handler: _CommServer_SDiff_Handler, + }, + { + MethodName: "SDiffStore", + Handler: _CommServer_SDiffStore_Handler, + }, + { + MethodName: "SInter", + Handler: _CommServer_SInter_Handler, + }, + { + MethodName: "SInterStore", + Handler: _CommServer_SInterStore_Handler, + }, + { + MethodName: "SIsMember", + Handler: _CommServer_SIsMember_Handler, + }, + { + MethodName: "SMove", + Handler: _CommServer_SMove_Handler, + }, + { + MethodName: "SPop", + Handler: _CommServer_SPop_Handler, + }, + { + MethodName: "SRem", + Handler: _CommServer_SRem_Handler, + }, + { + MethodName: "SUnion", + Handler: _CommServer_SUnion_Handler, + }, + { + MethodName: "SUnionStore", + Handler: _CommServer_SUnionStore_Handler, + }, + { + MethodName: "SScan", + Handler: _CommServer_SScan_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "storage.proto", diff --git a/protobuf/setx.proto b/protobuf/setx.proto new file mode 100644 index 0000000..8e0470d --- /dev/null +++ b/protobuf/setx.proto @@ -0,0 +1,119 @@ +syntax = "proto3"; +import "base.proto"; +option go_package = "pkg/proto"; + +message SAddRequest { + BaseKey key = 1; + repeated string member = 2; +} + +message SAddResponse { +} + +message SCardRequest { + BaseKey key = 1; +} + +message SCardResponse { + int32 length = 1; +} + +message SDiffRequest { + BaseKey key = 1; + repeated string sKeys = 2; +} + +message SDiffResponse { + repeated string resluts = 2; +} + +message SDiffStoreRequest { + BaseKey key = 1; + repeated string sKeys = 2; + string save_key = 3; +} + +message SDiffStoreResponse { +} + +message SInterRequest { + BaseKey key = 1; + repeated string sKeys = 2; +} + +message SInterResponse { + repeated string resluts = 2; +} + +message SInterStoreRequest { + BaseKey key = 1; + repeated string sKeys = 2; + string save_key = 3; +} + +message SInterStoreResponse { +} + +message SIsMemberRequest { + BaseKey key = 1; + string member = 2; +} + +message SIsMemberResponse { + bool exist = 1; +} + +message SMoveRequest { + BaseKey key = 1; + string move_key = 2; + repeated string members = 3; +} + +message SMoveResponse { +} + +message SPopRequest { + BaseKey key = 1; + int32 count = 2; +} + +message SPopResponse { + repeated string members = 1; +} + +message SRemRequest { + BaseKey key = 1; + int32 count = 2; +} + +message SRemResponse { +} + +message SUnionRequest { + BaseKey key = 1; + repeated string sKeys = 2; +} + +message SUnionResponse { + repeated string results = 1; +} + +message SUnionStoreRequest { + BaseKey key = 1; + repeated string sKeys = 2; + string save_key = 3; +} + +message SUnionStoreResponse { +} + +message SScanRequest { + BaseKey key = 1; + int32 sursor = 2; + string regexp = 3; + int32 count = 4; +} + +message SScanResponse { + repeated string results = 1; +} diff --git a/protobuf/storage.proto b/protobuf/storage.proto index ab0737c..94f48e2 100644 --- a/protobuf/storage.proto +++ b/protobuf/storage.proto @@ -8,6 +8,7 @@ option go_package = "pkg/proto"; import "stringx.proto"; import "listx.proto"; import "hashx.proto"; +import "setx.proto"; service CommServer { @@ -42,4 +43,17 @@ service CommServer { rpc HLen (HLenRequest) returns (HLenResponse); rpc HSet (HSetRequest) returns (HSetResponse); rpc HSetX (HSetXRequest) returns (HSetXResponse); + rpc SAdd (SAddRequest) returns (SAddResponse); + rpc SCard (SCardRequest) returns (SCardResponse); + rpc SDiff (SDiffRequest) returns (SDiffResponse); + rpc SDiffStore (SDiffStoreRequest) returns (SDiffStoreResponse); + rpc SInter (SInterRequest) returns (SInterResponse); + rpc SInterStore (SInterStoreRequest) returns (SInterStoreResponse); + rpc SIsMember (SIsMemberRequest) returns (SIsMemberResponse); + rpc SMove (SMoveRequest) returns (SMoveResponse); + rpc SPop (SPopRequest) returns (SPopResponse); + rpc SRem (SRemRequest) returns (SRemResponse); + rpc SUnion (SUnionRequest) returns (SUnionResponse); + rpc SUnionStore (SUnionStoreRequest) returns (SUnionStoreResponse); + rpc SScan (SScanRequest) returns (SScanResponse); } \ No newline at end of file diff --git a/storage/temp/const.gen.go b/storage/temp/const.gen.go index d861166..37c9d89 100644 --- a/storage/temp/const.gen.go +++ b/storage/temp/const.gen.go @@ -9,6 +9,7 @@ const ( STRING_X LIST_X HASH_X + SET_X ) const ( @@ -44,6 +45,19 @@ const ( HLen HSet HSetX + SAdd + SCard + SDiff + SDiffStore + SInter + SInterStore + SIsMember + SMove + SPop + SRem + SUnion + SUnionStore + SScan ) var CommKeyString = map[string]int{ @@ -80,6 +94,20 @@ var CommKeyString = map[string]int{ "HLen": HASH_X, "HSet": HASH_X, "HSetX": HASH_X, + + "SAdd": SET_X, + "SCard": SET_X, + "SDiff": SET_X, + "SDiffStore": SET_X, + "SInter": SET_X, + "SInterStore": SET_X, + "SIsMember": SET_X, + "SMove": SET_X, + "SPop": SET_X, + "SRem": SET_X, + "SUnion": SET_X, + "SUnionStore": SET_X, + "SScan": SET_X, } var CommKey = map[int]int{ @@ -116,4 +144,18 @@ var CommKey = map[int]int{ HLen: HASH_X, HSet: HASH_X, HSetX: HASH_X, + + SAdd: SET_X, + SCard: SET_X, + SDiff: SET_X, + SDiffStore: SET_X, + SInter: SET_X, + SInterStore: SET_X, + SIsMember: SET_X, + SMove: SET_X, + SPop: SET_X, + SRem: SET_X, + SUnion: SET_X, + SUnionStore: SET_X, + SScan: SET_X, } diff --git a/storage/temp/tem.yaml b/storage/temp/tem.yaml index c6634da..32505c0 100644 --- a/storage/temp/tem.yaml +++ b/storage/temp/tem.yaml @@ -36,4 +36,19 @@ HASH_X: - h_keys - h_len - h_set - - h_set_x \ No newline at end of file + - h_set_x + +SET_X: + - s_add + - s_card + - s_diff + - s_diff_store + - s_inter + - s_inter_store + - s_is_member + - s_move + - s_pop + - s_rem + - s_union + - s_union_store + - s_scan \ No newline at end of file From f6eaae71b9e415a6bd9d8d3c924b7b759ced077a Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Sun, 7 Nov 2021 20:53:01 +0800 Subject: [PATCH 02/18] chore(service): update service --- pkg/proto/setx.pb.go | 166 ++++++------ protobuf/setx.proto | 12 +- storage/dao/dao.gen.go | 39 +++ storage/dao/interface.gen.go | 13 + storage/dao/setx.go | 55 ++++ storage/persisted/codec.gen.go | 143 ++++++++++ storage/service/single_service.gen.go | 364 ++++++++++++++++++++++++++ 7 files changed, 703 insertions(+), 89 deletions(-) create mode 100644 storage/dao/setx.go diff --git a/pkg/proto/setx.pb.go b/pkg/proto/setx.pb.go index 39a6d51..b0b33d2 100644 --- a/pkg/proto/setx.pb.go +++ b/pkg/proto/setx.pb.go @@ -213,7 +213,7 @@ type SDiffRequest struct { unknownFields protoimpl.UnknownFields Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - SKeys []string `protobuf:"bytes,2,rep,name=sKeys,proto3" json:"sKeys,omitempty"` + SKeys []string `protobuf:"bytes,2,rep,name=s_keys,json=sKeys,proto3" json:"s_keys,omitempty"` } func (x *SDiffRequest) Reset() { @@ -315,7 +315,7 @@ type SDiffStoreRequest struct { unknownFields protoimpl.UnknownFields Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - SKeys []string `protobuf:"bytes,2,rep,name=sKeys,proto3" json:"sKeys,omitempty"` + SKeys []string `protobuf:"bytes,2,rep,name=s_keys,json=sKeys,proto3" json:"s_keys,omitempty"` SaveKey string `protobuf:"bytes,3,opt,name=save_key,json=saveKey,proto3" json:"save_key,omitempty"` } @@ -416,7 +416,7 @@ type SInterRequest struct { unknownFields protoimpl.UnknownFields Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - SKeys []string `protobuf:"bytes,2,rep,name=sKeys,proto3" json:"sKeys,omitempty"` + SKeys []string `protobuf:"bytes,2,rep,name=s_keys,json=sKeys,proto3" json:"s_keys,omitempty"` } func (x *SInterRequest) Reset() { @@ -518,7 +518,7 @@ type SInterStoreRequest struct { unknownFields protoimpl.UnknownFields Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - SKeys []string `protobuf:"bytes,2,rep,name=sKeys,proto3" json:"sKeys,omitempty"` + SKeys []string `protobuf:"bytes,2,rep,name=s_keys,json=sKeys,proto3" json:"s_keys,omitempty"` SaveKey string `protobuf:"bytes,3,opt,name=save_key,json=saveKey,proto3" json:"save_key,omitempty"` } @@ -1017,7 +1017,7 @@ type SUnionRequest struct { unknownFields protoimpl.UnknownFields Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - SKeys []string `protobuf:"bytes,2,rep,name=sKeys,proto3" json:"sKeys,omitempty"` + SKeys []string `protobuf:"bytes,2,rep,name=s_keys,json=sKeys,proto3" json:"s_keys,omitempty"` } func (x *SUnionRequest) Reset() { @@ -1119,7 +1119,7 @@ type SUnionStoreRequest struct { unknownFields protoimpl.UnknownFields Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - SKeys []string `protobuf:"bytes,2,rep,name=sKeys,proto3" json:"sKeys,omitempty"` + SKeys []string `protobuf:"bytes,2,rep,name=s_keys,json=sKeys,proto3" json:"s_keys,omitempty"` SaveKey string `protobuf:"bytes,3,opt,name=save_key,json=saveKey,proto3" json:"save_key,omitempty"` } @@ -1347,87 +1347,87 @@ var file_setx_proto_rawDesc = []byte{ 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x27, 0x0a, 0x0d, 0x53, 0x43, 0x61, 0x72, 0x64, 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, 0x40, 0x0a, 0x0c, 0x53, 0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x22, 0x41, 0x0a, 0x0c, 0x53, 0x44, 0x69, 0x66, 0x66, 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, 0x14, 0x0a, 0x05, - 0x73, 0x4b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x73, 0x4b, 0x65, - 0x79, 0x73, 0x22, 0x29, 0x0a, 0x0d, 0x53, 0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x6c, 0x75, 0x74, 0x73, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x73, 0x6c, 0x75, 0x74, 0x73, 0x22, 0x60, 0x0a, - 0x11, 0x53, 0x44, 0x69, 0x66, 0x66, 0x53, 0x74, 0x6f, 0x72, 0x65, 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, 0x14, - 0x0a, 0x05, 0x73, 0x4b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x73, - 0x4b, 0x65, 0x79, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x61, 0x76, 0x65, 0x5f, 0x6b, 0x65, 0x79, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x61, 0x76, 0x65, 0x4b, 0x65, 0x79, 0x22, - 0x14, 0x0a, 0x12, 0x53, 0x44, 0x69, 0x66, 0x66, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x41, 0x0a, 0x0d, 0x53, 0x49, 0x6e, 0x74, 0x65, 0x72, 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, 0x14, 0x0a, 0x05, 0x73, 0x4b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, - 0x09, 0x52, 0x05, 0x73, 0x4b, 0x65, 0x79, 0x73, 0x22, 0x2a, 0x0a, 0x0e, 0x53, 0x49, 0x6e, 0x74, - 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, - 0x73, 0x6c, 0x75, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x73, - 0x6c, 0x75, 0x74, 0x73, 0x22, 0x61, 0x0a, 0x12, 0x53, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x53, 0x74, - 0x6f, 0x72, 0x65, 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, 0x14, 0x0a, 0x05, 0x73, 0x4b, 0x65, 0x79, 0x73, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x73, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x19, 0x0a, 0x08, - 0x73, 0x61, 0x76, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x73, 0x61, 0x76, 0x65, 0x4b, 0x65, 0x79, 0x22, 0x15, 0x0a, 0x13, 0x53, 0x49, 0x6e, 0x74, 0x65, - 0x72, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x46, - 0x0a, 0x10, 0x53, 0x49, 0x73, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 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, 0x16, - 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x29, 0x0a, 0x11, 0x53, 0x49, 0x73, 0x4d, 0x65, 0x6d, - 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, - 0x78, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x65, 0x78, 0x69, 0x73, - 0x74, 0x22, 0x5f, 0x0a, 0x0c, 0x53, 0x4d, 0x6f, 0x76, 0x65, 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, 0x19, 0x0a, - 0x08, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x6d, 0x6f, 0x76, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, - 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, - 0x72, 0x73, 0x22, 0x0f, 0x0a, 0x0d, 0x53, 0x4d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x3f, 0x0a, 0x0b, 0x53, 0x50, 0x6f, 0x70, 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, 0x14, - 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x28, 0x0a, 0x0c, 0x53, 0x50, 0x6f, 0x70, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x22, 0x3f, - 0x0a, 0x0b, 0x53, 0x52, 0x65, 0x6d, 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, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, - 0x0e, 0x0a, 0x0c, 0x53, 0x52, 0x65, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x41, 0x0a, 0x0d, 0x53, 0x55, 0x6e, 0x69, 0x6f, 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, 0x12, 0x14, 0x0a, 0x05, - 0x73, 0x4b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x73, 0x4b, 0x65, - 0x79, 0x73, 0x22, 0x2a, 0x0a, 0x0e, 0x53, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x22, 0x61, - 0x0a, 0x12, 0x53, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x6f, 0x72, 0x65, 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, 0x14, 0x0a, 0x05, 0x73, 0x4b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x15, 0x0a, 0x06, + 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x73, 0x4b, + 0x65, 0x79, 0x73, 0x22, 0x29, 0x0a, 0x0d, 0x53, 0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x6c, 0x75, 0x74, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x73, 0x6c, 0x75, 0x74, 0x73, 0x22, 0x61, + 0x0a, 0x11, 0x53, 0x44, 0x69, 0x66, 0x66, 0x53, 0x74, 0x6f, 0x72, 0x65, 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, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x73, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x61, 0x76, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x61, 0x76, 0x65, 0x4b, 0x65, - 0x79, 0x22, 0x15, 0x0a, 0x13, 0x53, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x6f, 0x72, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x70, 0x0a, 0x0c, 0x53, 0x53, 0x63, 0x61, - 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x79, 0x22, 0x14, 0x0a, 0x12, 0x53, 0x44, 0x69, 0x66, 0x66, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x42, 0x0a, 0x0d, 0x53, 0x49, 0x6e, 0x74, 0x65, + 0x72, 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, 0x16, 0x0a, 0x06, 0x73, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x12, 0x16, 0x0a, 0x06, - 0x72, 0x65, 0x67, 0x65, 0x78, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, - 0x67, 0x65, 0x78, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x29, 0x0a, 0x0d, 0x53, 0x53, - 0x63, 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, - 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, - 0x73, 0x75, 0x6c, 0x74, 0x73, 0x42, 0x0b, 0x5a, 0x09, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x03, 0x6b, 0x65, 0x79, 0x12, 0x15, 0x0a, 0x06, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x73, 0x4b, 0x65, 0x79, 0x73, 0x22, 0x2a, 0x0a, 0x0e, 0x53, + 0x49, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, + 0x07, 0x72, 0x65, 0x73, 0x6c, 0x75, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, + 0x72, 0x65, 0x73, 0x6c, 0x75, 0x74, 0x73, 0x22, 0x62, 0x0a, 0x12, 0x53, 0x49, 0x6e, 0x74, 0x65, + 0x72, 0x53, 0x74, 0x6f, 0x72, 0x65, 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, 0x73, 0x5f, 0x6b, + 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x73, 0x4b, 0x65, 0x79, 0x73, + 0x12, 0x19, 0x0a, 0x08, 0x73, 0x61, 0x76, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x73, 0x61, 0x76, 0x65, 0x4b, 0x65, 0x79, 0x22, 0x15, 0x0a, 0x13, 0x53, + 0x49, 0x6e, 0x74, 0x65, 0x72, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x46, 0x0a, 0x10, 0x53, 0x49, 0x73, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 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, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x29, 0x0a, 0x11, 0x53, 0x49, + 0x73, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x14, 0x0a, 0x05, 0x65, 0x78, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, + 0x65, 0x78, 0x69, 0x73, 0x74, 0x22, 0x5f, 0x0a, 0x0c, 0x53, 0x4d, 0x6f, 0x76, 0x65, 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, 0x19, 0x0a, 0x08, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x6f, 0x76, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x18, 0x0a, 0x07, + 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6d, + 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x22, 0x0f, 0x0a, 0x0d, 0x53, 0x4d, 0x6f, 0x76, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3f, 0x0a, 0x0b, 0x53, 0x50, 0x6f, 0x70, 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, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x28, 0x0a, 0x0c, 0x53, 0x50, 0x6f, 0x70, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, + 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, + 0x72, 0x73, 0x22, 0x3f, 0x0a, 0x0b, 0x53, 0x52, 0x65, 0x6d, 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, 0x14, 0x0a, + 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x22, 0x0e, 0x0a, 0x0c, 0x53, 0x52, 0x65, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x42, 0x0a, 0x0d, 0x53, 0x55, 0x6e, 0x69, 0x6f, 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, + 0x12, 0x15, 0x0a, 0x06, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x05, 0x73, 0x4b, 0x65, 0x79, 0x73, 0x22, 0x2a, 0x0a, 0x0e, 0x53, 0x55, 0x6e, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, + 0x6c, 0x74, 0x73, 0x22, 0x62, 0x0a, 0x12, 0x53, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x6f, + 0x72, 0x65, 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, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x73, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x19, 0x0a, 0x08, + 0x73, 0x61, 0x76, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x73, 0x61, 0x76, 0x65, 0x4b, 0x65, 0x79, 0x22, 0x15, 0x0a, 0x13, 0x53, 0x55, 0x6e, 0x69, 0x6f, + 0x6e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x70, + 0x0a, 0x0c, 0x53, 0x53, 0x63, 0x61, 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, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x75, + 0x72, 0x73, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x75, 0x72, 0x73, + 0x6f, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x65, 0x78, 0x70, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x67, 0x65, 0x78, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x22, 0x29, 0x0a, 0x0d, 0x53, 0x53, 0x63, 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x42, 0x0b, 0x5a, 0x09, 0x70, + 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/protobuf/setx.proto b/protobuf/setx.proto index 8e0470d..1cee993 100644 --- a/protobuf/setx.proto +++ b/protobuf/setx.proto @@ -20,7 +20,7 @@ message SCardResponse { message SDiffRequest { BaseKey key = 1; - repeated string sKeys = 2; + repeated string s_keys = 2; } message SDiffResponse { @@ -29,7 +29,7 @@ message SDiffResponse { message SDiffStoreRequest { BaseKey key = 1; - repeated string sKeys = 2; + repeated string s_keys = 2; string save_key = 3; } @@ -38,7 +38,7 @@ message SDiffStoreResponse { message SInterRequest { BaseKey key = 1; - repeated string sKeys = 2; + repeated string s_keys = 2; } message SInterResponse { @@ -47,7 +47,7 @@ message SInterResponse { message SInterStoreRequest { BaseKey key = 1; - repeated string sKeys = 2; + repeated string s_keys = 2; string save_key = 3; } @@ -91,7 +91,7 @@ message SRemResponse { message SUnionRequest { BaseKey key = 1; - repeated string sKeys = 2; + repeated string s_keys = 2; } message SUnionResponse { @@ -100,7 +100,7 @@ message SUnionResponse { message SUnionStoreRequest { BaseKey key = 1; - repeated string sKeys = 2; + repeated string s_keys = 2; string save_key = 3; } diff --git a/storage/dao/dao.gen.go b/storage/dao/dao.gen.go index 6bfdd30..01d3de1 100644 --- a/storage/dao/dao.gen.go +++ b/storage/dao/dao.gen.go @@ -116,6 +116,45 @@ func (d *Dao) ExecMessage(message protobuf.Message) error { case *proto.StrLenRequest: _, err := d.StrLen(req.Key) return err + case *proto.SAddRequest: + _, err := d.SAdd(req.Key, req.Member) + return err + case *proto.SCardRequest: + _, err := d.SCard(req.Key) + return err + case *proto.SDiffRequest: + _, err := d.SDiff(req.Key, req.SKeys) + return err + case *proto.SDiffStoreRequest: + _, err := d.SDiffStore(req.Key, req.SKeys, req.SaveKey) + return err + case *proto.SInterRequest: + _, err := d.SInter(req.Key, req.SKeys) + return err + case *proto.SInterStoreRequest: + _, err := d.SInterStore(req.Key, req.SKeys, req.SaveKey) + return err + case *proto.SIsMemberRequest: + _, err := d.SIsMember(req.Key, req.Member) + return err + case *proto.SMoveRequest: + _, err := d.SMove(req.Key, req.MoveKey, req.Members) + return err + case *proto.SPopRequest: + _, err := d.SPop(req.Key, req.Count) + return err + case *proto.SRemRequest: + _, err := d.SRem(req.Key, req.Count) + return err + case *proto.SUnionRequest: + _, err := d.SUnion(req.Key, req.SKeys) + return err + case *proto.SUnionStoreRequest: + _, err := d.SUnionStore(req.Key, req.SKeys, req.SaveKey) + return err + case *proto.SScanRequest: + _, err := d.SScan(req.Key, req.Sursor, req.Regexp, req.Count) + return err default: return errorx.New("The type that is not registered exec err") } diff --git a/storage/dao/interface.gen.go b/storage/dao/interface.gen.go index 44fbe4b..e9e6364 100644 --- a/storage/dao/interface.gen.go +++ b/storage/dao/interface.gen.go @@ -40,5 +40,18 @@ type Interface interface { GetRange(*proto.BaseKey, int32, int32) (*proto.GetRangeResponse, error) GetSet(*proto.BaseKey, string) (*proto.GetSetResponse, error) StrLen(*proto.BaseKey) (*proto.StrLenResponse, error) + SAdd(*proto.BaseKey, []string) (*proto.SAddResponse, error) + SCard(*proto.BaseKey) (*proto.SCardResponse, error) + SDiff(*proto.BaseKey, []string) (*proto.SDiffResponse, error) + SDiffStore(*proto.BaseKey, []string, string) (*proto.SDiffStoreResponse, error) + SInter(*proto.BaseKey, []string) (*proto.SInterResponse, error) + SInterStore(*proto.BaseKey, []string, string) (*proto.SInterStoreResponse, error) + SIsMember(*proto.BaseKey, string) (*proto.SIsMemberResponse, error) + SMove(*proto.BaseKey, string, []string) (*proto.SMoveResponse, error) + SPop(*proto.BaseKey, int32) (*proto.SPopResponse, error) + SRem(*proto.BaseKey, int32) (*proto.SRemResponse, error) + SUnion(*proto.BaseKey, []string) (*proto.SUnionResponse, error) + SUnionStore(*proto.BaseKey, []string, string) (*proto.SUnionStoreResponse, error) + SScan(*proto.BaseKey, int32, string, int32) (*proto.SScanResponse, error) ExecMessage(message protobuf.Message) error } diff --git a/storage/dao/setx.go b/storage/dao/setx.go new file mode 100644 index 0000000..e4dd9af --- /dev/null +++ b/storage/dao/setx.go @@ -0,0 +1,55 @@ +package dao + +import "gitee.com/wheat-os/wheatCache/pkg/proto" + +func (d *Dao) SAdd(_ *proto.BaseKey, _ []string) (*proto.SAddResponse, error) { + panic("not implemented") // TODO: Implement +} + +func (d *Dao) SCard(_ *proto.BaseKey) (*proto.SCardResponse, error) { + panic("not implemented") // TODO: Implement +} + +func (d *Dao) SDiff(_ *proto.BaseKey, _ []string) (*proto.SDiffResponse, error) { + panic("not implemented") // TODO: Implement +} + +func (d *Dao) SDiffStore(_ *proto.BaseKey, _ []string, _ string) (*proto.SDiffStoreResponse, error) { + panic("not implemented") // TODO: Implement +} + +func (d *Dao) SInter(_ *proto.BaseKey, _ []string) (*proto.SInterResponse, error) { + panic("not implemented") // TODO: Implement +} + +func (d *Dao) SInterStore(_ *proto.BaseKey, _ []string, _ string) (*proto.SInterStoreResponse, error) { + panic("not implemented") // TODO: Implement +} + +func (d *Dao) SIsMember(_ *proto.BaseKey, _ string) (*proto.SIsMemberResponse, error) { + panic("not implemented") // TODO: Implement +} + +func (d *Dao) SMove(_ *proto.BaseKey, _ string, _ []string) (*proto.SMoveResponse, error) { + panic("not implemented") // TODO: Implement +} + +func (d *Dao) SPop(_ *proto.BaseKey, _ int32) (*proto.SPopResponse, error) { + panic("not implemented") // TODO: Implement +} + +func (d *Dao) SRem(_ *proto.BaseKey, _ int32) (*proto.SRemResponse, error) { + panic("not implemented") // TODO: Implement +} + +func (d *Dao) SUnion(_ *proto.BaseKey, _ []string) (*proto.SUnionResponse, error) { + panic("not implemented") // TODO: Implement +} + +func (d *Dao) SUnionStore(_ *proto.BaseKey, _ []string, _ string) (*proto.SUnionStoreResponse, error) { + panic("not implemented") // TODO: Implement +} + +func (d *Dao) SScan(_ *proto.BaseKey, _ int32, _ string, _ int32) (*proto.SScanResponse, error) { + panic("not implemented") // TODO: Implement +} diff --git a/storage/persisted/codec.gen.go b/storage/persisted/codec.gen.go index ec7fd3b..b705993 100644 --- a/storage/persisted/codec.gen.go +++ b/storage/persisted/codec.gen.go @@ -110,6 +110,32 @@ func decode(method string, buf []byte) (protobuf.Message, error) { return decodeGetSet(buf) case "StrLen": return decodeStrLen(buf) + case "SAdd": + return decodeSAdd(buf) + case "SCard": + return decodeSCard(buf) + case "SDiff": + return decodeSDiff(buf) + case "SDiffStore": + return decodeSDiffStore(buf) + case "SInter": + return decodeSInter(buf) + case "SInterStore": + return decodeSInterStore(buf) + case "SIsMember": + return decodeSIsMember(buf) + case "SMove": + return decodeSMove(buf) + case "SPop": + return decodeSPop(buf) + case "SRem": + return decodeSRem(buf) + case "SUnion": + return decodeSUnion(buf) + case "SUnionStore": + return decodeSUnionStore(buf) + case "SScan": + return decodeSScan(buf) } @@ -394,3 +420,120 @@ func decodeStrLen(buf []byte) (*proto.StrLenRequest, error) { } return req, nil } + +func decodeSAdd(buf []byte) (*proto.SAddRequest, error) { + req := &proto.SAddRequest{} + err := protobuf.Unmarshal(buf, req) + if err != nil { + return nil, err + } + return req, nil +} + +func decodeSCard(buf []byte) (*proto.SCardRequest, error) { + req := &proto.SCardRequest{} + err := protobuf.Unmarshal(buf, req) + if err != nil { + return nil, err + } + return req, nil +} + +func decodeSDiff(buf []byte) (*proto.SDiffRequest, error) { + req := &proto.SDiffRequest{} + err := protobuf.Unmarshal(buf, req) + if err != nil { + return nil, err + } + return req, nil +} + +func decodeSDiffStore(buf []byte) (*proto.SDiffStoreRequest, error) { + req := &proto.SDiffStoreRequest{} + err := protobuf.Unmarshal(buf, req) + if err != nil { + return nil, err + } + return req, nil +} + +func decodeSInter(buf []byte) (*proto.SInterRequest, error) { + req := &proto.SInterRequest{} + err := protobuf.Unmarshal(buf, req) + if err != nil { + return nil, err + } + return req, nil +} + +func decodeSInterStore(buf []byte) (*proto.SInterStoreRequest, error) { + req := &proto.SInterStoreRequest{} + err := protobuf.Unmarshal(buf, req) + if err != nil { + return nil, err + } + return req, nil +} + +func decodeSIsMember(buf []byte) (*proto.SIsMemberRequest, error) { + req := &proto.SIsMemberRequest{} + err := protobuf.Unmarshal(buf, req) + if err != nil { + return nil, err + } + return req, nil +} + +func decodeSMove(buf []byte) (*proto.SMoveRequest, error) { + req := &proto.SMoveRequest{} + err := protobuf.Unmarshal(buf, req) + if err != nil { + return nil, err + } + return req, nil +} + +func decodeSPop(buf []byte) (*proto.SPopRequest, error) { + req := &proto.SPopRequest{} + err := protobuf.Unmarshal(buf, req) + if err != nil { + return nil, err + } + return req, nil +} + +func decodeSRem(buf []byte) (*proto.SRemRequest, error) { + req := &proto.SRemRequest{} + err := protobuf.Unmarshal(buf, req) + if err != nil { + return nil, err + } + return req, nil +} + +func decodeSUnion(buf []byte) (*proto.SUnionRequest, error) { + req := &proto.SUnionRequest{} + err := protobuf.Unmarshal(buf, req) + if err != nil { + return nil, err + } + return req, nil +} + +func decodeSUnionStore(buf []byte) (*proto.SUnionStoreRequest, error) { + req := &proto.SUnionStoreRequest{} + err := protobuf.Unmarshal(buf, req) + if err != nil { + return nil, err + } + return req, nil +} + +func decodeSScan(buf []byte) (*proto.SScanRequest, error) { + req := &proto.SScanRequest{} + err := protobuf.Unmarshal(buf, req) + if err != nil { + return nil, err + } + return req, nil +} diff --git a/storage/service/single_service.gen.go b/storage/service/single_service.gen.go index 02b9117..1340f0f 100644 --- a/storage/service/single_service.gen.go +++ b/storage/service/single_service.gen.go @@ -877,3 +877,367 @@ func (s *singleService) StrLen( return resp.(*proto.StrLenResponse), nil } + +func (s *singleService) SAdd( + ctx context.Context, + req *proto.SAddRequest, +) (*proto.SAddResponse, error) { + work := event.EventWorkFunc(func() (interface{}, error) { + resp, err := s.dao.SAdd(req.Key, req.Member) + if err != nil { + return nil, err + } + if s.aof != nil { + s.aof.SendRequest("SAdd", 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.SAddResponse), nil +} + +func (s *singleService) SCard( + ctx context.Context, + req *proto.SCardRequest, +) (*proto.SCardResponse, error) { + work := event.EventWorkFunc(func() (interface{}, error) { + resp, err := s.dao.SCard(req.Key) + if err != nil { + return nil, err + } + if s.aof != nil { + s.aof.SendRequest("SCard", 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.SCardResponse), nil +} + +func (s *singleService) SDiff( + ctx context.Context, + req *proto.SDiffRequest, +) (*proto.SDiffResponse, error) { + work := event.EventWorkFunc(func() (interface{}, error) { + resp, err := s.dao.SDiff(req.Key, req.SKeys) + if err != nil { + return nil, err + } + if s.aof != nil { + s.aof.SendRequest("SDiff", 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.SDiffResponse), nil +} + +func (s *singleService) SDiffStore( + ctx context.Context, + req *proto.SDiffStoreRequest, +) (*proto.SDiffStoreResponse, error) { + work := event.EventWorkFunc(func() (interface{}, error) { + resp, err := s.dao.SDiffStore(req.Key, req.SKeys, req.SaveKey) + if err != nil { + return nil, err + } + if s.aof != nil { + s.aof.SendRequest("SDiffStore", 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.SDiffStoreResponse), nil +} + +func (s *singleService) SInter( + ctx context.Context, + req *proto.SInterRequest, +) (*proto.SInterResponse, error) { + work := event.EventWorkFunc(func() (interface{}, error) { + resp, err := s.dao.SInter(req.Key, req.SKeys) + if err != nil { + return nil, err + } + if s.aof != nil { + s.aof.SendRequest("SInter", 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.SInterResponse), nil +} + +func (s *singleService) SInterStore( + ctx context.Context, + req *proto.SInterStoreRequest, +) (*proto.SInterStoreResponse, error) { + work := event.EventWorkFunc(func() (interface{}, error) { + resp, err := s.dao.SInterStore(req.Key, req.SKeys, req.SaveKey) + if err != nil { + return nil, err + } + if s.aof != nil { + s.aof.SendRequest("SInterStore", 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.SInterStoreResponse), nil +} + +func (s *singleService) SIsMember( + ctx context.Context, + req *proto.SIsMemberRequest, +) (*proto.SIsMemberResponse, error) { + work := event.EventWorkFunc(func() (interface{}, error) { + resp, err := s.dao.SIsMember(req.Key, req.Member) + if err != nil { + return nil, err + } + if s.aof != nil { + s.aof.SendRequest("SIsMember", 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.SIsMemberResponse), nil +} + +func (s *singleService) SMove( + ctx context.Context, + req *proto.SMoveRequest, +) (*proto.SMoveResponse, error) { + work := event.EventWorkFunc(func() (interface{}, error) { + resp, err := s.dao.SMove(req.Key, req.MoveKey, req.Members) + if err != nil { + return nil, err + } + if s.aof != nil { + s.aof.SendRequest("SMove", 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.SMoveResponse), nil +} + +func (s *singleService) SPop( + ctx context.Context, + req *proto.SPopRequest, +) (*proto.SPopResponse, error) { + work := event.EventWorkFunc(func() (interface{}, error) { + resp, err := s.dao.SPop(req.Key, req.Count) + if err != nil { + return nil, err + } + if s.aof != nil { + s.aof.SendRequest("SPop", 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.SPopResponse), nil +} + +func (s *singleService) SRem( + ctx context.Context, + req *proto.SRemRequest, +) (*proto.SRemResponse, error) { + work := event.EventWorkFunc(func() (interface{}, error) { + resp, err := s.dao.SRem(req.Key, req.Count) + if err != nil { + return nil, err + } + if s.aof != nil { + s.aof.SendRequest("SRem", 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.SRemResponse), nil +} + +func (s *singleService) SUnion( + ctx context.Context, + req *proto.SUnionRequest, +) (*proto.SUnionResponse, error) { + work := event.EventWorkFunc(func() (interface{}, error) { + resp, err := s.dao.SUnion(req.Key, req.SKeys) + if err != nil { + return nil, err + } + if s.aof != nil { + s.aof.SendRequest("SUnion", 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.SUnionResponse), nil +} + +func (s *singleService) SUnionStore( + ctx context.Context, + req *proto.SUnionStoreRequest, +) (*proto.SUnionStoreResponse, error) { + work := event.EventWorkFunc(func() (interface{}, error) { + resp, err := s.dao.SUnionStore(req.Key, req.SKeys, req.SaveKey) + if err != nil { + return nil, err + } + if s.aof != nil { + s.aof.SendRequest("SUnionStore", 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.SUnionStoreResponse), nil +} + +func (s *singleService) SScan( + ctx context.Context, + req *proto.SScanRequest, +) (*proto.SScanResponse, error) { + work := event.EventWorkFunc(func() (interface{}, error) { + resp, err := s.dao.SScan(req.Key, req.Sursor, req.Regexp, req.Count) + if err != nil { + return nil, err + } + if s.aof != nil { + s.aof.SendRequest("SScan", 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.SScanResponse), nil +} From 51bd9b242f176ca992fff5980e9725517bba9638 Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Sun, 7 Nov 2021 21:45:11 +0800 Subject: [PATCH 03/18] fix(hash-endpoint): tranport to endpoint --- gateway/cmd/root.go | 6 +++--- gateway/{transport => endpoint}/define.go | 4 ++-- gateway/{transport => endpoint}/hash.go | 22 ++++++++++---------- gateway/{transport => endpoint}/hash_test.go | 2 +- gateway/proxy/define.go | 4 ++-- gateway/proxy/director.go | 6 +++--- gateway/proxy/proxy.go | 12 +++++------ 7 files changed, 28 insertions(+), 28 deletions(-) rename gateway/{transport => endpoint}/define.go (70%) rename gateway/{transport => endpoint}/hash.go (71%) rename gateway/{transport => endpoint}/hash_test.go (94%) diff --git a/gateway/cmd/root.go b/gateway/cmd/root.go index a3deb3a..9300437 100644 --- a/gateway/cmd/root.go +++ b/gateway/cmd/root.go @@ -6,8 +6,8 @@ import ( _ "gitee.com/wheat-os/wheatCache/conf" wheatCodec "gitee.com/wheat-os/wheatCache/gateway/codec" + "gitee.com/wheat-os/wheatCache/gateway/endpoint" "gitee.com/wheat-os/wheatCache/gateway/proxy" - "gitee.com/wheat-os/wheatCache/gateway/transport" "gitee.com/wheat-os/wheatCache/pkg/logx" "gitee.com/wheat-os/wheatCache/pkg/util/server" "github.com/spf13/cobra" @@ -56,13 +56,13 @@ func GetGatewayServer() *grpc.Server { logx.Debug("service target in %v", targets) stream := proxy.GetDirectorByServiceHash() - transport := transport.NewHashTransport(transport.HashReplicasDefault, nil, targets...) + endpoint := endpoint.NewHashEndpoint(endpoint.HashReplicasDefault, nil, targets...) opts := make([]grpc.ServerOption, 0) opts = append( opts, grpc.ForceServerCodec(wheatCodec.Codec()), - grpc.UnknownServiceHandler(proxy.TransparentHandler(stream, transport)), + grpc.UnknownServiceHandler(proxy.TransparentHandler(stream, endpoint)), ) return grpc.NewServer(opts...) diff --git a/gateway/transport/define.go b/gateway/endpoint/define.go similarity index 70% rename from gateway/transport/define.go rename to gateway/endpoint/define.go index 57c7942..9e5b6ec 100644 --- a/gateway/transport/define.go +++ b/gateway/endpoint/define.go @@ -1,6 +1,6 @@ -package transport +package endpoint -type TransPortInterface interface { +type EndpointInterface interface { GetTargetAddr(...string) (string, error) IsEmpty() bool AddTarget(targets ...string) diff --git a/gateway/transport/hash.go b/gateway/endpoint/hash.go similarity index 71% rename from gateway/transport/hash.go rename to gateway/endpoint/hash.go index 329de74..0b1e2c7 100644 --- a/gateway/transport/hash.go +++ b/gateway/endpoint/hash.go @@ -1,4 +1,4 @@ -package transport +package endpoint import ( "hash/crc32" @@ -25,34 +25,34 @@ func (s UInt32Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } -type HashTransport struct { +type HashEndpoint struct { hash HashFunc replicas int // 复制因子 keys UInt32Slice hashMap map[uint32]string // taraget 隐射 } -func NewHashTransport(replicas int, fn HashFunc, target ...string) TransPortInterface { - transport := &HashTransport{ +func NewHashEndpoint(replicas int, fn HashFunc, target ...string) EndpointInterface { + endpoint := &HashEndpoint{ replicas: replicas, hash: fn, hashMap: make(map[uint32]string, len(target)), } - if transport.hash == nil { - transport.hash = crc32.ChecksumIEEE // 默认使用 CRC32 算法 + if endpoint.hash == nil { + endpoint.hash = crc32.ChecksumIEEE // 默认使用 CRC32 算法 } - transport.AddTarget(target...) + endpoint.AddTarget(target...) - return transport + return endpoint } -func (h *HashTransport) IsEmpty() bool { +func (h *HashEndpoint) IsEmpty() bool { return len(h.keys) == 0 } -func (h *HashTransport) AddTarget(targets ...string) { +func (h *HashEndpoint) AddTarget(targets ...string) { for _, tar := range targets { for i := 0; i < h.replicas; i++ { @@ -66,7 +66,7 @@ func (h *HashTransport) AddTarget(targets ...string) { sort.Sort(h.keys) } -func (h *HashTransport) GetTargetAddr(str ...string) (string, error) { +func (h *HashEndpoint) GetTargetAddr(str ...string) (string, error) { if h.IsEmpty() { return "", errorx.New("gateway not register transport") } diff --git a/gateway/transport/hash_test.go b/gateway/endpoint/hash_test.go similarity index 94% rename from gateway/transport/hash_test.go rename to gateway/endpoint/hash_test.go index f6e9774..b074a72 100644 --- a/gateway/transport/hash_test.go +++ b/gateway/endpoint/hash_test.go @@ -1,4 +1,4 @@ -package transport +package endpoint import ( "testing" diff --git a/gateway/proxy/define.go b/gateway/proxy/define.go index e100c5c..a20ec52 100644 --- a/gateway/proxy/define.go +++ b/gateway/proxy/define.go @@ -3,11 +3,11 @@ package proxy import ( "context" - "gitee.com/wheat-os/wheatCache/gateway/transport" + "gitee.com/wheat-os/wheatCache/gateway/endpoint" "google.golang.org/grpc" ) -type StreamDirector func(ctx context.Context, fullMethodName string, transport transport.TransPortInterface) (context.Context, *grpc.ClientConn, error) +type StreamDirector func(ctx context.Context, fullMethodName string, endpoint endpoint.EndpointInterface) (context.Context, *grpc.ClientConn, error) var ( clientStreamDescForProxying = &grpc.StreamDesc{ diff --git a/gateway/proxy/director.go b/gateway/proxy/director.go index 0215c8b..d473cfb 100644 --- a/gateway/proxy/director.go +++ b/gateway/proxy/director.go @@ -4,7 +4,7 @@ import ( "context" "gitee.com/wheat-os/wheatCache/gateway/codec" - "gitee.com/wheat-os/wheatCache/gateway/transport" + "gitee.com/wheat-os/wheatCache/gateway/endpoint" "gitee.com/wheat-os/wheatCache/pkg/proto" "google.golang.org/grpc" "google.golang.org/grpc/codes" @@ -13,7 +13,7 @@ import ( ) func GetDirectorByServiceHash() StreamDirector { - return func(ctx context.Context, fullMethodName string, transport transport.TransPortInterface) (context.Context, *grpc.ClientConn, error) { + return func(ctx context.Context, fullMethodName string, endpoint endpoint.EndpointInterface) (context.Context, *grpc.ClientConn, error) { md, ok := metadata.FromIncomingContext(ctx) if !ok { @@ -26,7 +26,7 @@ func GetDirectorByServiceHash() StreamDirector { "grpc header is not found %s, please check the client interceptor", proto.BaseKeyMethodKey) } - target, err := transport.GetTargetAddr(baseKey...) + target, err := endpoint.GetTargetAddr(baseKey...) if err != nil { return nil, nil, status.Errorf(codes.Unknown, "get transport err, err:%v", err) } diff --git a/gateway/proxy/proxy.go b/gateway/proxy/proxy.go index e317a33..85fa532 100644 --- a/gateway/proxy/proxy.go +++ b/gateway/proxy/proxy.go @@ -5,7 +5,7 @@ import ( "io" wheatCodec "gitee.com/wheat-os/wheatCache/gateway/codec" - "gitee.com/wheat-os/wheatCache/gateway/transport" + "gitee.com/wheat-os/wheatCache/gateway/endpoint" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -16,17 +16,17 @@ import ( // backends. It should be used as a `grpc.UnknownServiceHandler`. // // This can *only* be used if the `server` also uses grpcproxy.CodecForServer() ServerOption. -func TransparentHandler(director StreamDirector, tranport transport.TransPortInterface) grpc.StreamHandler { +func TransparentHandler(director StreamDirector, endpoint endpoint.EndpointInterface) grpc.StreamHandler { streamer := &handler{ director, - tranport, + endpoint, } return streamer.handler } type handler struct { - director StreamDirector - transport transport.TransPortInterface + director StreamDirector + endpoint endpoint.EndpointInterface } // handler is where the real magic of proxying happens. @@ -38,7 +38,7 @@ func (s *handler) handler(srv interface{}, serverStream grpc.ServerStream) error return status.Errorf(codes.Internal, "lowLevelServerStream not exists in context") } - outgoingCtx, backendConn, err := s.director(serverStream.Context(), fullMethodName, s.transport) + outgoingCtx, backendConn, err := s.director(serverStream.Context(), fullMethodName, s.endpoint) if err != nil { return err } From 62d3105273f5af6515980953031458bc52f4d34a Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Wed, 10 Nov 2021 17:38:20 +0800 Subject: [PATCH 04/18] doc(event): add event2.0 doc --- doc/_icon/event.svg | 3 +++ doc/pkg/event/事件驱动2.0文档.md | 13 +++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 doc/_icon/event.svg create mode 100644 doc/pkg/event/事件驱动2.0文档.md diff --git a/doc/_icon/event.svg b/doc/_icon/event.svg new file mode 100644 index 0000000..e1de32f --- /dev/null +++ b/doc/_icon/event.svg @@ -0,0 +1,3 @@ + + +event 2.0
回执通道
回执通道
1
1
2
2
2 级挂起操作
2 级挂起操作
1 级访问通道
1 级访问通道
优先执行
优先执行
3
3
对外挂起
对外挂起
执行回执
执行回执
Viewer does not support full SVG 1.1
\ No newline at end of file diff --git a/doc/pkg/event/事件驱动2.0文档.md b/doc/pkg/event/事件驱动2.0文档.md new file mode 100644 index 0000000..afd53be --- /dev/null +++ b/doc/pkg/event/事件驱动2.0文档.md @@ -0,0 +1,13 @@ +### 事件驱动 2.0 + +### event 1.0 存在的问题 +事件驱动 1.0 在 相互关联访问时,会发生 死锁问题, 导致一个事件执行周期失败 + +### event 2.0 新特性 +- 异步事件支持 +- 挂起操作 + + +### event 2.0 设计图 +![](../../_icon/event.svg) + From 8b8fd58c0913e2cb724f6453d626b291f63d99e6 Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Thu, 11 Nov 2021 22:24:17 +0800 Subject: [PATCH 05/18] feat(event2): add event2 --- pkg/errorx/event.go | 5 + pkg/event2/consumer.go | 21 ++++ pkg/event2/define.go | 49 ++++++++++ pkg/event2/driver.go | 212 +++++++++++++++++++++++++++++++++++++++++ pkg/event2/produce.go | 21 ++++ pkg/event2/worker.go | 13 +++ pkg/lru/define.go | 7 +- 7 files changed, 324 insertions(+), 4 deletions(-) create mode 100644 pkg/errorx/event.go create mode 100644 pkg/event2/consumer.go create mode 100644 pkg/event2/define.go create mode 100644 pkg/event2/driver.go create mode 100644 pkg/event2/produce.go create mode 100644 pkg/event2/worker.go diff --git a/pkg/errorx/event.go b/pkg/errorx/event.go new file mode 100644 index 0000000..f12980d --- /dev/null +++ b/pkg/errorx/event.go @@ -0,0 +1,5 @@ +package errorx + +func EventRecoveryErr() error { + return New("this event has been recycled") +} diff --git a/pkg/event2/consumer.go b/pkg/event2/consumer.go new file mode 100644 index 0000000..61cdf63 --- /dev/null +++ b/pkg/event2/consumer.go @@ -0,0 +1,21 @@ +package event2 + +import "context" + +type Consumer struct { + driver DriverInterface +} + +func (c *Consumer) Receive(ctx context.Context) *event { + return c.driver.Get() +} + +func (c *Consumer) NewEvent(name string) *event { + return c.driver.NewEvent(name) +} + +func NewConsumer(driver DriverInterface) ConsumerInterface { + return &Consumer{ + driver: driver, + } +} diff --git a/pkg/event2/define.go b/pkg/event2/define.go new file mode 100644 index 0000000..86714ab --- /dev/null +++ b/pkg/event2/define.go @@ -0,0 +1,49 @@ +package event2 + +import ( + "context" +) + +const ( + initEventState = int32(iota) // 初始化状态 + waitEventState // 等待状态 + workEventState // 工作状态 + closeEventState // 事件关闭状态 + recoveryEventState // 事件回收状态 +) + +const ( + awaitThread = 3 +) + +const ( + WorkFuncEventKey = "workFunc" +) + +// 线程安全 +type EventWorkFunc func() (interface{}, error) + +// 挂起事件, 线程不安全 +type EventAwaitFunc func() (interface{}, error) + +// 实际操作 +type awaitFunc func() (*event, interface{}, error) + +type DriverInterface interface { + Get() *event + Put(*event) + GetLength() int + NewEvent(string) *event + + await(awaitFunc) + recovery(e *event) +} + +type ProduceInterface interface { + Call(context.Context, *event) + NewEvent(string) *event +} + +type ConsumerInterface interface { + Receive(ctx context.Context) *event +} diff --git a/pkg/event2/driver.go b/pkg/event2/driver.go new file mode 100644 index 0000000..49d57fc --- /dev/null +++ b/pkg/event2/driver.go @@ -0,0 +1,212 @@ +package event2 + +import ( + "sync/atomic" + "time" + + "gitee.com/wheat-os/wheatCache/pkg/errorx" +) + +type event struct { + msgCtx map[string]interface{} + eventName string + msg map[string]string // 消息 + waitResult chan interface{} // 等待返回 + err error + eventStatus int32 + ttlManage *time.Timer + parentDriver DriverInterface +} + +func (e *event) reset() { + if e.ttlManage != nil { + e.ttlManage.Stop() + + if len(e.ttlManage.C) > 0 { + <-e.ttlManage.C + } + } + + e.err = nil + + // 清空结果 + if len(e.waitResult) != 0 { + <-e.waitResult + } +} + +func (e *event) Recovery() { + e.parentDriver.recovery(e) +} + +func (e *event) SetMsg(key string, val string) { + if e.msg == nil { + e.msg = make(map[string]string) + } + e.msg[key] = val +} + +func (e *event) GetMsg(key string) string { + if e.msg == nil { + return "" + } + return e.msg[key] +} + +func (e *event) GetEventName() string { + return e.eventName +} + +// SetValue 写入 ctx 传递用参数 +func (e *event) SetValue(key string, value interface{}) { + if e.msgCtx == nil { + e.msgCtx = make(map[string]interface{}) + } + e.msgCtx[key] = value +} + +func (e *event) GetValue(key string) (interface{}, bool) { + if e.msgCtx == nil { + return nil, false + } + val, ok := e.msgCtx[key] + return val, ok +} + +func (e *event) InitWaitEvent() { + e.reset() + if e.waitResult == nil { + e.waitResult = make(chan interface{}) + } + + atomic.SwapInt32(&e.eventStatus, waitEventState) +} + +// StartWaitEvent 开始一个等待任务 +func (e *event) StartWaitEvent(ttl time.Duration) (interface{}, error) { + if e.ttlManage == nil { + e.ttlManage = time.NewTimer(ttl) + } else { + e.ttlManage.Reset(ttl) + } + + for { + select { + case <-e.ttlManage.C: + if atomic.CompareAndSwapInt32(&e.eventStatus, waitEventState, closeEventState) { + return nil, errorx.TimeOutErr() + } + continue + + case result := <-e.waitResult: + atomic.SwapInt32(&e.eventStatus, closeEventState) + return result, e.err + } + } +} + +// 实际执行推送 +func (e *event) execWorker(res interface{}, err error) { + switch work := res.(type) { + case EventAwaitFunc: + await := func() (*event, interface{}, error) { + result, err := work() + return e, result, err + } + e.parentDriver.await(await) + + case EventWorkFunc: + e.InitWaitEvent() + e.SetValue(WorkFuncEventKey, work) + e.parentDriver.Put(e) + + default: + e.err = err + e.waitResult <- res + } +} + +func (e *event) ExecWorkAndSendResult(work EventWorkFunc) (interface{}, error) { + if !atomic.CompareAndSwapInt32(&e.eventStatus, waitEventState, workEventState) { + return nil, errorx.New("not wait status, exec err") + } + + res, err := work() + e.execWorker(res, err) + return res, err +} + +type driver struct { + waitQueue chan awaitFunc + eventQueue chan *event + levelQueue chan *event + + // event 池的实现 + poll chan *event + maxPoolSize int32 + nowPoolSize int32 +} + +func NewDriver(maxSize int) DriverInterface { + d := &driver{ + // pool + maxPoolSize: int32(maxSize), + nowPoolSize: 0, + poll: make(chan *event, maxSize), + + // waitQueue 1/3 的挂起指标 + waitQueue: make(chan awaitFunc, maxSize/3), + levelQueue: make(chan *event, maxSize/3), + eventQueue: make(chan *event, maxSize), + } + d.awaitWorker() + return d +} + +func (d *driver) NewEvent(name string) *event { + + issSize := atomic.LoadInt32(&d.nowPoolSize) + if issSize < d.maxPoolSize { + atomic.AddInt32(&d.nowPoolSize, 1) + return d.newEvent(name) + } + e := <-d.poll + e.eventName = name + return e +} + +func (d *driver) newEvent(name string) *event { + status := initEventState + return &event{ + eventStatus: status, + parentDriver: d, + eventName: name, + } +} + +// 先尝试 level +func (d *driver) Get() *event { + if len(d.levelQueue) > 0 { + return <-d.levelQueue + } + return <-d.eventQueue +} + +func (d *driver) Put(e *event) { + d.eventQueue <- e +} + +func (d *driver) GetLength() int { + return len(d.eventQueue) + len(d.levelQueue) +} + +func (d *driver) recovery(e *event) { + atomic.SwapInt32(&e.eventStatus, recoveryEventState) + e.reset() + d.poll <- e +} + +// 挂起操作相关 +func (d *driver) await(a awaitFunc) { + d.waitQueue <- a +} diff --git a/pkg/event2/produce.go b/pkg/event2/produce.go new file mode 100644 index 0000000..221533f --- /dev/null +++ b/pkg/event2/produce.go @@ -0,0 +1,21 @@ +package event2 + +import "context" + +type Produce struct { + driver DriverInterface +} + +func (p *Produce) NewEvent(name string) *event { + return p.driver.NewEvent(name) +} + +func (p *Produce) Call(ctx context.Context, e *event) { + p.driver.Put(e) +} + +func NewProduce(driver DriverInterface) ProduceInterface { + return &Produce{ + driver: driver, + } +} diff --git a/pkg/event2/worker.go b/pkg/event2/worker.go new file mode 100644 index 0000000..595a97d --- /dev/null +++ b/pkg/event2/worker.go @@ -0,0 +1,13 @@ +package event2 + +func (d *driver) awaitWorker() { + for i := 0; i < awaitThread; i++ { + go func() { + for { + awaitFunc := <-d.waitQueue + e, res, err := awaitFunc() + e.execWorker(res, err) + } + }() + } +} diff --git a/pkg/lru/define.go b/pkg/lru/define.go index d5d3dd3..f4c1f48 100644 --- a/pkg/lru/define.go +++ b/pkg/lru/define.go @@ -11,10 +11,9 @@ import ( type SingleWorkFunc func() interface{} const ( - OptionEventName = "operateEvent" - CleanEventName = "clearEvent" - TtlEventName = "ttlEvent" - WorkFuncEventKey = "workFunc" + OptionEventName = "operateEvent" + CleanEventName = "clearEvent" + TtlEventName = "ttlEvent" ) var ( From 3f3b208db13c44b623a9ee9deceae9b95b160cb1 Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Thu, 11 Nov 2021 22:24:28 +0800 Subject: [PATCH 06/18] test(event2): add event2 test --- pkg/event2/driver_test.go | 152 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 pkg/event2/driver_test.go diff --git a/pkg/event2/driver_test.go b/pkg/event2/driver_test.go new file mode 100644 index 0000000..69f2bfc --- /dev/null +++ b/pkg/event2/driver_test.go @@ -0,0 +1,152 @@ +package event2 + +import ( + "context" + "fmt" + "strconv" + "sync" + "testing" + "time" + + "github.com/stretchr/testify/require" +) + +const testEvent = "1001" +const waitTestEvent = "1002" + +// 简单的 单向 event 使用 +func Test_EventDriver(t *testing.T) { + driver := NewDriver(2000) + produce := NewProduce(driver) + consumer := NewConsumer(driver) + + ctx := context.Background() + + wait := sync.WaitGroup{} + wait.Add(30000) + + go func() { + for i := 0; i < 30000; i++ { + event := produce.NewEvent(testEvent) + event.SetMsg("k", strconv.Itoa(i)) + produce.Call(ctx, event) + + } + }() + + go func() { + for { + event := consumer.Receive(ctx) + fmt.Println(event.GetMsg("k")) + event.Recovery() + wait.Done() + } + }() + + wait.Wait() + +} + +// 双向 event +func Test_EventDriver_Tow_way(t *testing.T) { + + ctx := context.Background() + driver := NewDriver(2000) + produce := NewProduce(driver) + consumer := NewConsumer(driver) + + go func() { + for { + event := consumer.Receive(ctx) + work, ok := event.GetValue(WorkFuncEventKey) + if !ok { + panic("get work key err") + } + workFunc, ok := work.(EventWorkFunc) + if !ok { + panic("work func err") + } + _, err := event.ExecWorkAndSendResult(workFunc) + require.NoError(t, err) + } + }() + + // 一般的 two-way 模式 + for i := 0; i < 10000; i++ { + event := produce.NewEvent(waitTestEvent) + event.InitWaitEvent() + event.SetValue(WorkFuncEventKey, EventWorkFunc(func() (interface{}, error) { + return i + 1, nil + })) + produce.Call(ctx, event) + res, err := event.StartWaitEvent(2 * time.Second) + require.NoError(t, err) + require.Equal(t, res, i+1) + event.Recovery() + } + + // 挂起模式,2 秒左右的执行时间 + group := sync.WaitGroup{} + group.Add(5) + for i := 0; i < 5; i++ { + go func(i int) { + event := produce.NewEvent(waitTestEvent) + event.InitWaitEvent() + event.SetValue(WorkFuncEventKey, EventWorkFunc(func() (interface{}, error) { + // 访问 await Work 来发起一个 异步请求操作 + return EventAwaitFunc(func() (interface{}, error) { + time.Sleep(time.Second) + return i + 1, nil + }), nil + })) + produce.Call(ctx, event) + res, err := event.StartWaitEvent(2 * time.Second) + require.NoError(t, err) + require.Equal(t, res, i+1) + event.Recovery() + group.Done() + }(i) + } + + // 挂起成功不发生超时 + for i := 0; i < 10000; i++ { + event := produce.NewEvent(waitTestEvent) + event.InitWaitEvent() + event.SetValue(WorkFuncEventKey, EventWorkFunc(func() (interface{}, error) { + return i + 1, nil + })) + produce.Call(ctx, event) + res, err := event.StartWaitEvent(500 * time.Millisecond) + require.NoError(t, err) + require.Equal(t, res, i+1) + event.Recovery() + } + + group.Wait() + + // 挂起一个高延迟操作, 保证局部操作还在事件中 + group = sync.WaitGroup{} + group.Add(5) + for i := 0; i < 5; i++ { + event := produce.NewEvent(waitTestEvent) + event.InitWaitEvent() + event.SetValue(WorkFuncEventKey, EventWorkFunc(func() (interface{}, error) { + return EventAwaitFunc(func() (interface{}, error) { + // 返回值为 EventWorkFunc 时, 会重新加入末端队列 + return EventWorkFunc(func() (interface{}, error) { + return i + 1, nil + }), nil + + }), nil + })) + produce.Call(ctx, event) + res, err := event.StartWaitEvent(2 * time.Second) + require.NoError(t, err) + require.Equal(t, res, i+1) + event.Recovery() + group.Done() + fmt.Println(i) + } + group.Wait() + +} From 3eb515325d542b1ee7b1cf6847016b1c3a4684f0 Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Thu, 11 Nov 2021 22:32:14 +0800 Subject: [PATCH 07/18] feat(lru): update lru event2 --- pkg/lru/lru.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pkg/lru/lru.go b/pkg/lru/lru.go index 951d2dc..b51df88 100644 --- a/pkg/lru/lru.go +++ b/pkg/lru/lru.go @@ -7,6 +7,7 @@ import ( _ "gitee.com/wheat-os/wheatCache/conf" "gitee.com/wheat-os/wheatCache/pkg/errorx" "gitee.com/wheat-os/wheatCache/pkg/event" + "gitee.com/wheat-os/wheatCache/pkg/event2" "gitee.com/wheat-os/wheatCache/pkg/middle" "gitee.com/wheat-os/wheatCache/pkg/proto" "gitee.com/wheat-os/wheatCache/pkg/structure" @@ -29,9 +30,9 @@ type SingleCache struct { lruMaxDiverSize int lruTtlManage *lruTTl // 定时清理器 - lruDriver event.DriverInterface - lruConsumer event.ConsumerInterface - lruCleanProduce event.ProduceInterface // 发送清理事件 + lruDriver event2.DriverInterface + lruConsumer event2.ConsumerInterface + lruCleanProduce event2.ProduceInterface // 发送清理事件 middleProduce event.ProduceInterface // 中间件驱动 } @@ -76,7 +77,7 @@ func cacheInit() (int64, int64, int, int) { // NewLRUCache lru初始化 func NewLRUCache() *SingleCache { maxSize, clearSize, maxDriverSize, detachNum := cacheInit() - lruDriver := event.NewDriver(maxDriverSize) + lruDriver := event2.NewDriver(maxDriverSize) lruCacheOnce.Do(func() { lru := &SingleCache{ maxsize: maxSize, @@ -86,8 +87,8 @@ func NewLRUCache() *SingleCache { lruMap: make(map[string]*list.Element), lruMaxDiverSize: maxDriverSize, lruDriver: lruDriver, - lruConsumer: event.NewConsumer(lruDriver), - lruCleanProduce: event.NewProduce(lruDriver), + lruConsumer: event2.NewConsumer(lruDriver), + lruCleanProduce: event2.NewProduce(lruDriver), middleProduce: event.NewProduce(middle.NewMiddleWare().GetEventDriver()), lruTtlManage: newLruTTl(detachNum), } @@ -103,7 +104,7 @@ func NewLRUCache() *SingleCache { } // GetDriver 获取驱动 -func (lru *SingleCache) GetDriver() event.DriverInterface { +func (lru *SingleCache) GetDriver() event2.DriverInterface { return lru.lruDriver } From 2f81eab9819ed77e1542f7f3438925e9edb5eed6 Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Thu, 11 Nov 2021 22:39:50 +0800 Subject: [PATCH 08/18] feat(lru, single service): update event2 --- pkg/event2/driver.go | 9 +++++++++ pkg/lru/worker.go | 19 ++++++++++--------- storage/service/single.go | 5 +++-- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/pkg/event2/driver.go b/pkg/event2/driver.go index 49d57fc..db61c83 100644 --- a/pkg/event2/driver.go +++ b/pkg/event2/driver.go @@ -82,6 +82,15 @@ func (e *event) InitWaitEvent() { atomic.SwapInt32(&e.eventStatus, waitEventState) } +func (e *event) SetResultErr(err error) { + if !atomic.CompareAndSwapInt32(&e.eventStatus, waitEventState, workEventState) { + return + } + + e.err = err + e.waitResult <- nil +} + // StartWaitEvent 开始一个等待任务 func (e *event) StartWaitEvent(ttl time.Duration) (interface{}, error) { if e.ttlManage == nil { diff --git a/pkg/lru/worker.go b/pkg/lru/worker.go index 674d5e1..bdcde92 100644 --- a/pkg/lru/worker.go +++ b/pkg/lru/worker.go @@ -6,6 +6,7 @@ import ( "gitee.com/wheat-os/wheatCache/pkg/errorx" "gitee.com/wheat-os/wheatCache/pkg/event" + "gitee.com/wheat-os/wheatCache/pkg/event2" "gitee.com/wheat-os/wheatCache/pkg/logx" mMsg "gitee.com/wheat-os/wheatCache/pkg/middle-msg" ) @@ -14,7 +15,7 @@ func (lru *SingleCache) lruSingleWork() { ctx := context.Background() for { workEvent := lru.lruConsumer.Receive(ctx) - workFunc, ok := workEvent.GetValue(WorkFuncEventKey) + workFunc, ok := workEvent.GetValue(event2.WorkFuncEventKey) if !ok { workEvent.SetResultErr(errorx.LruNotWorkFuncEventErr()) continue @@ -22,7 +23,7 @@ func (lru *SingleCache) lruSingleWork() { switch workEvent.GetEventName() { case OptionEventName: - if work, ok := workFunc.(event.EventWorkFunc); ok { + if work, ok := workFunc.(event2.EventWorkFunc); ok { workEvent.ExecWorkAndSendResult(work) } @@ -33,12 +34,12 @@ func (lru *SingleCache) lruSingleWork() { lru.lruCleanProduce.Call(ctx, workEvent) continue } - if work, ok := workFunc.(event.EventWorkFunc); ok { + if work, ok := workFunc.(event2.EventWorkFunc); ok { workEvent.ExecWorkAndSendResult(work) } case TtlEventName: - if work, ok := workFunc.(event.EventWorkFunc); ok { + if work, ok := workFunc.(event2.EventWorkFunc); ok { workEvent.ExecWorkAndSendResult(work) } } @@ -52,7 +53,7 @@ func (lru *SingleCache) lruTtlWork() { // 清理事件 go func() { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { beforeTime := time.Now().Unix() cle := lru.lruTtlManage.detachNum @@ -80,12 +81,12 @@ func (lru *SingleCache) lruTtlWork() { } ttlEvent := lru.lruCleanProduce.NewEvent(TtlEventName) - ttlEvent.SetValue(WorkFuncEventKey, work) + ttlEvent.SetValue(event2.WorkFuncEventKey, work) ttlEvent.InitWaitEvent() lru.lruCleanProduce.Call(ctx, ttlEvent) keys, err := ttlEvent.StartWaitEvent(time.Second * 2) - lru.lruCleanProduce.Recovery(ttlEvent) + ttlEvent.Recovery() mMsg.SendMiddleMsg(ctx, lru.middleProduce, mMsg.LruTTlContext{ Keys: keys.([]string), @@ -118,7 +119,7 @@ func (lru *SingleCache) cleanWork() { time.Sleep(2 * time.Second) if lru.clearSize < lru.nowSize { lruCleanEvent := lru.lruCleanProduce.NewEvent(CleanEventName) - lruCleanEvent.SetValue(WorkFuncEventKey, work) + lruCleanEvent.SetValue(event2.WorkFuncEventKey, work) lruCleanEvent.InitWaitEvent() lru.lruCleanProduce.Call(cxt, lruCleanEvent) @@ -128,7 +129,7 @@ func (lru *SingleCache) cleanWork() { } // 归还 - lru.lruCleanProduce.Recovery(lruCleanEvent) + lruCleanEvent.Recovery() } } } diff --git a/storage/service/single.go b/storage/service/single.go index aca1922..2c96d59 100644 --- a/storage/service/single.go +++ b/storage/service/single.go @@ -7,6 +7,7 @@ import ( "time" "gitee.com/wheat-os/wheatCache/pkg/event" + "gitee.com/wheat-os/wheatCache/pkg/event2" "gitee.com/wheat-os/wheatCache/pkg/logx" "gitee.com/wheat-os/wheatCache/pkg/lru" "gitee.com/wheat-os/wheatCache/pkg/middle" @@ -18,7 +19,7 @@ import ( type singleService struct { middleProduce event.ProduceInterface - lruProduce event.ProduceInterface + lruProduce event2.ProduceInterface timeOut time.Duration lruCache *lru.SingleCache dao dao.Interface @@ -100,7 +101,7 @@ func NewSingleServer() proto.CommServerServer { ser := &singleService{ lruCache: lruCache, - lruProduce: event.NewProduce(lruCache.GetDriver()), + lruProduce: event2.NewProduce(lruCache.GetDriver()), timeOut: time.Duration(timeOut) * time.Second, dao: dao, middleProduce: event.NewProduce(middle.NewMiddleWare().GetEventDriver()), From 55204575d75c68f739f2bfd5837988702acfee52 Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Thu, 11 Nov 2021 22:46:20 +0800 Subject: [PATCH 09/18] feat(temp): update service temp to event2 --- storage/temp/service.template | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/storage/temp/service.template b/storage/temp/service.template index fa969b6..919ab30 100644 --- a/storage/temp/service.template +++ b/storage/temp/service.template @@ -5,7 +5,7 @@ package service import ( context "context" - "gitee.com/wheat-os/wheatCache/pkg/event" + "gitee.com/wheat-os/wheatCache/pkg/event2" "gitee.com/wheat-os/wheatCache/pkg/lru" "gitee.com/wheat-os/wheatCache/pkg/proto" ) @@ -15,7 +15,7 @@ func (s *singleService) {{key.method}}( ctx context.Context, req *proto.{{key.method}}Request, ) (*proto.{{key.method}}Response, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.{{key.method}}({% for opt in key.option %}req.{{opt[0]}}, {% endfor %}) if err != nil{ return nil, err @@ -28,10 +28,10 @@ func (s *singleService) {{key.method}}( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } From 60de1a6ae95923857a21f919a92dca0622c31196 Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Thu, 11 Nov 2021 22:46:39 +0800 Subject: [PATCH 10/18] chore(service): update service --- storage/service/single_service.gen.go | 266 +++++++++++++------------- 1 file changed, 133 insertions(+), 133 deletions(-) diff --git a/storage/service/single_service.gen.go b/storage/service/single_service.gen.go index 1340f0f..9dfdf7c 100644 --- a/storage/service/single_service.gen.go +++ b/storage/service/single_service.gen.go @@ -5,7 +5,7 @@ package service import ( context "context" - "gitee.com/wheat-os/wheatCache/pkg/event" + "gitee.com/wheat-os/wheatCache/pkg/event2" "gitee.com/wheat-os/wheatCache/pkg/lru" "gitee.com/wheat-os/wheatCache/pkg/proto" ) @@ -14,7 +14,7 @@ func (s *singleService) LIndex( ctx context.Context, req *proto.LIndexRequest, ) (*proto.LIndexResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.LIndex(req.Key, req.Index) if err != nil { return nil, err @@ -27,10 +27,10 @@ func (s *singleService) LIndex( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -42,7 +42,7 @@ func (s *singleService) LLen( ctx context.Context, req *proto.LLenRequest, ) (*proto.LLenResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.LLen(req.Key) if err != nil { return nil, err @@ -55,10 +55,10 @@ func (s *singleService) LLen( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -70,7 +70,7 @@ func (s *singleService) LPop( ctx context.Context, req *proto.LPopRequest, ) (*proto.LPopResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.LPop(req.Key, req.Count) if err != nil { return nil, err @@ -83,10 +83,10 @@ func (s *singleService) LPop( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -98,7 +98,7 @@ func (s *singleService) LPush( ctx context.Context, req *proto.LPushRequest, ) (*proto.LPushResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.LPush(req.Key, req.Values) if err != nil { return nil, err @@ -111,10 +111,10 @@ func (s *singleService) LPush( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -126,7 +126,7 @@ func (s *singleService) LPushX( ctx context.Context, req *proto.LPushXRequest, ) (*proto.LPushXResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.LPushX(req.Key, req.Values) if err != nil { return nil, err @@ -139,10 +139,10 @@ func (s *singleService) LPushX( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -154,7 +154,7 @@ func (s *singleService) LRange( ctx context.Context, req *proto.LRangeRequest, ) (*proto.LRangeResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.LRange(req.Key, req.Start, req.End) if err != nil { return nil, err @@ -167,10 +167,10 @@ func (s *singleService) LRange( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -182,7 +182,7 @@ func (s *singleService) LRem( ctx context.Context, req *proto.LRemRequest, ) (*proto.LRemResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.LRem(req.Key, req.Count, req.Value) if err != nil { return nil, err @@ -195,10 +195,10 @@ func (s *singleService) LRem( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -210,7 +210,7 @@ func (s *singleService) LSet( ctx context.Context, req *proto.LSetRequest, ) (*proto.LSetResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.LSet(req.Key, req.Index, req.Value) if err != nil { return nil, err @@ -223,10 +223,10 @@ func (s *singleService) LSet( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -238,7 +238,7 @@ func (s *singleService) RPop( ctx context.Context, req *proto.RPopRequest, ) (*proto.RPopResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.RPop(req.Key, req.Count) if err != nil { return nil, err @@ -251,10 +251,10 @@ func (s *singleService) RPop( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -266,7 +266,7 @@ func (s *singleService) LTrim( ctx context.Context, req *proto.LTrimRequest, ) (*proto.LTrimResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.LTrim(req.Key, req.Start, req.End) if err != nil { return nil, err @@ -279,10 +279,10 @@ func (s *singleService) LTrim( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -294,7 +294,7 @@ func (s *singleService) RPush( ctx context.Context, req *proto.RPushRequest, ) (*proto.RPushResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.RPush(req.Key, req.Values) if err != nil { return nil, err @@ -307,10 +307,10 @@ func (s *singleService) RPush( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -322,7 +322,7 @@ func (s *singleService) RPushX( ctx context.Context, req *proto.RPushXRequest, ) (*proto.RPushXResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.RPushX(req.Key, req.Values) if err != nil { return nil, err @@ -335,10 +335,10 @@ func (s *singleService) RPushX( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -350,7 +350,7 @@ func (s *singleService) HDel( ctx context.Context, req *proto.HDelRequest, ) (*proto.HDelResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.HDel(req.Key, req.HKeys) if err != nil { return nil, err @@ -363,10 +363,10 @@ func (s *singleService) HDel( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -378,7 +378,7 @@ func (s *singleService) HExists( ctx context.Context, req *proto.HExistsRequest, ) (*proto.HExistsResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.HExists(req.Key, req.HKey) if err != nil { return nil, err @@ -391,10 +391,10 @@ func (s *singleService) HExists( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -406,7 +406,7 @@ func (s *singleService) HGet( ctx context.Context, req *proto.HGetRequest, ) (*proto.HGetResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.HGet(req.Key, req.HKeys) if err != nil { return nil, err @@ -419,10 +419,10 @@ func (s *singleService) HGet( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -434,7 +434,7 @@ func (s *singleService) HGetAll( ctx context.Context, req *proto.HGetAllRequest, ) (*proto.HGetAllResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.HGetAll(req.Key) if err != nil { return nil, err @@ -447,10 +447,10 @@ func (s *singleService) HGetAll( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -462,7 +462,7 @@ func (s *singleService) HIncrBy( ctx context.Context, req *proto.HIncrByRequest, ) (*proto.HIncrByResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.HIncrBy(req.Key, req.HKeys, req.Renewal) if err != nil { return nil, err @@ -475,10 +475,10 @@ func (s *singleService) HIncrBy( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -490,7 +490,7 @@ func (s *singleService) HKeys( ctx context.Context, req *proto.HKeysRequest, ) (*proto.HKeysResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.HKeys(req.Key) if err != nil { return nil, err @@ -503,10 +503,10 @@ func (s *singleService) HKeys( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -518,7 +518,7 @@ func (s *singleService) HLen( ctx context.Context, req *proto.HLenRequest, ) (*proto.HLenResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.HLen(req.Key) if err != nil { return nil, err @@ -531,10 +531,10 @@ func (s *singleService) HLen( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -546,7 +546,7 @@ func (s *singleService) HSet( ctx context.Context, req *proto.HSetRequest, ) (*proto.HSetResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.HSet(req.Key, req.Items) if err != nil { return nil, err @@ -559,10 +559,10 @@ func (s *singleService) HSet( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -574,7 +574,7 @@ func (s *singleService) HSetX( ctx context.Context, req *proto.HSetXRequest, ) (*proto.HSetXResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.HSetX(req.Key, req.Items) if err != nil { return nil, err @@ -587,10 +587,10 @@ func (s *singleService) HSetX( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -602,7 +602,7 @@ func (s *singleService) Set( ctx context.Context, req *proto.SetRequest, ) (*proto.SetResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.Set(req.Key, req.Val) if err != nil { return nil, err @@ -615,10 +615,10 @@ func (s *singleService) Set( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -630,7 +630,7 @@ func (s *singleService) Get( ctx context.Context, req *proto.GetRequest, ) (*proto.GetResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.Get(req.Key) if err != nil { return nil, err @@ -643,10 +643,10 @@ func (s *singleService) Get( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -658,7 +658,7 @@ func (s *singleService) Add( ctx context.Context, req *proto.AddRequest, ) (*proto.AddResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.Add(req.Key, req.Renewal) if err != nil { return nil, err @@ -671,10 +671,10 @@ func (s *singleService) Add( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -686,7 +686,7 @@ func (s *singleService) Reduce( ctx context.Context, req *proto.ReduceRequest, ) (*proto.ReduceResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.Reduce(req.Key, req.Renewal) if err != nil { return nil, err @@ -699,10 +699,10 @@ func (s *singleService) Reduce( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -714,7 +714,7 @@ func (s *singleService) Setnx( ctx context.Context, req *proto.SetnxRequest, ) (*proto.SetnxResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.Setnx(req.Key, req.Val) if err != nil { return nil, err @@ -727,10 +727,10 @@ func (s *singleService) Setnx( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -742,7 +742,7 @@ func (s *singleService) SetBit( ctx context.Context, req *proto.SetBitRequest, ) (*proto.SetBitResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.SetBit(req.Key, req.Val, req.Offer) if err != nil { return nil, err @@ -755,10 +755,10 @@ func (s *singleService) SetBit( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -770,7 +770,7 @@ func (s *singleService) GetBit( ctx context.Context, req *proto.GetBitRequest, ) (*proto.GetBitResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.GetBit(req.Key, req.Offer) if err != nil { return nil, err @@ -783,10 +783,10 @@ func (s *singleService) GetBit( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -798,7 +798,7 @@ func (s *singleService) GetRange( ctx context.Context, req *proto.GetRangeRequest, ) (*proto.GetRangeResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.GetRange(req.Key, req.Start, req.End) if err != nil { return nil, err @@ -811,10 +811,10 @@ func (s *singleService) GetRange( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -826,7 +826,7 @@ func (s *singleService) GetSet( ctx context.Context, req *proto.GetSetRequest, ) (*proto.GetSetResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.GetSet(req.Key, req.Val) if err != nil { return nil, err @@ -839,10 +839,10 @@ func (s *singleService) GetSet( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -854,7 +854,7 @@ func (s *singleService) StrLen( ctx context.Context, req *proto.StrLenRequest, ) (*proto.StrLenResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.StrLen(req.Key) if err != nil { return nil, err @@ -867,10 +867,10 @@ func (s *singleService) StrLen( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -882,7 +882,7 @@ func (s *singleService) SAdd( ctx context.Context, req *proto.SAddRequest, ) (*proto.SAddResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.SAdd(req.Key, req.Member) if err != nil { return nil, err @@ -895,10 +895,10 @@ func (s *singleService) SAdd( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -910,7 +910,7 @@ func (s *singleService) SCard( ctx context.Context, req *proto.SCardRequest, ) (*proto.SCardResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.SCard(req.Key) if err != nil { return nil, err @@ -923,10 +923,10 @@ func (s *singleService) SCard( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -938,7 +938,7 @@ func (s *singleService) SDiff( ctx context.Context, req *proto.SDiffRequest, ) (*proto.SDiffResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.SDiff(req.Key, req.SKeys) if err != nil { return nil, err @@ -951,10 +951,10 @@ func (s *singleService) SDiff( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -966,7 +966,7 @@ func (s *singleService) SDiffStore( ctx context.Context, req *proto.SDiffStoreRequest, ) (*proto.SDiffStoreResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.SDiffStore(req.Key, req.SKeys, req.SaveKey) if err != nil { return nil, err @@ -979,10 +979,10 @@ func (s *singleService) SDiffStore( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -994,7 +994,7 @@ func (s *singleService) SInter( ctx context.Context, req *proto.SInterRequest, ) (*proto.SInterResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.SInter(req.Key, req.SKeys) if err != nil { return nil, err @@ -1007,10 +1007,10 @@ func (s *singleService) SInter( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -1022,7 +1022,7 @@ func (s *singleService) SInterStore( ctx context.Context, req *proto.SInterStoreRequest, ) (*proto.SInterStoreResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.SInterStore(req.Key, req.SKeys, req.SaveKey) if err != nil { return nil, err @@ -1035,10 +1035,10 @@ func (s *singleService) SInterStore( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -1050,7 +1050,7 @@ func (s *singleService) SIsMember( ctx context.Context, req *proto.SIsMemberRequest, ) (*proto.SIsMemberResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.SIsMember(req.Key, req.Member) if err != nil { return nil, err @@ -1063,10 +1063,10 @@ func (s *singleService) SIsMember( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -1078,7 +1078,7 @@ func (s *singleService) SMove( ctx context.Context, req *proto.SMoveRequest, ) (*proto.SMoveResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.SMove(req.Key, req.MoveKey, req.Members) if err != nil { return nil, err @@ -1091,10 +1091,10 @@ func (s *singleService) SMove( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -1106,7 +1106,7 @@ func (s *singleService) SPop( ctx context.Context, req *proto.SPopRequest, ) (*proto.SPopResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.SPop(req.Key, req.Count) if err != nil { return nil, err @@ -1119,10 +1119,10 @@ func (s *singleService) SPop( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -1134,7 +1134,7 @@ func (s *singleService) SRem( ctx context.Context, req *proto.SRemRequest, ) (*proto.SRemResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.SRem(req.Key, req.Count) if err != nil { return nil, err @@ -1147,10 +1147,10 @@ func (s *singleService) SRem( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -1162,7 +1162,7 @@ func (s *singleService) SUnion( ctx context.Context, req *proto.SUnionRequest, ) (*proto.SUnionResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.SUnion(req.Key, req.SKeys) if err != nil { return nil, err @@ -1175,10 +1175,10 @@ func (s *singleService) SUnion( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -1190,7 +1190,7 @@ func (s *singleService) SUnionStore( ctx context.Context, req *proto.SUnionStoreRequest, ) (*proto.SUnionStoreResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.SUnionStore(req.Key, req.SKeys, req.SaveKey) if err != nil { return nil, err @@ -1203,10 +1203,10 @@ func (s *singleService) SUnionStore( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } @@ -1218,7 +1218,7 @@ func (s *singleService) SScan( ctx context.Context, req *proto.SScanRequest, ) (*proto.SScanResponse, error) { - work := event.EventWorkFunc(func() (interface{}, error) { + work := event2.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.SScan(req.Key, req.Sursor, req.Regexp, req.Count) if err != nil { return nil, err @@ -1231,10 +1231,10 @@ func (s *singleService) SScan( lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() - lruEvent.SetValue(lru.WorkFuncEventKey, work) + lruEvent.SetValue(event2.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) - s.lruProduce.Recovery(lruEvent) + lruEvent.Recovery() if err != nil { return nil, err } From 25be4a1509df3662c9a44e7598770d3466d7b011 Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Thu, 11 Nov 2021 23:00:04 +0800 Subject: [PATCH 11/18] test(hash-endpoint): update hash endpoint test --- gateway/endpoint/hash_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gateway/endpoint/hash_test.go b/gateway/endpoint/hash_test.go index b074a72..c147533 100644 --- a/gateway/endpoint/hash_test.go +++ b/gateway/endpoint/hash_test.go @@ -7,7 +7,7 @@ import ( ) func TestHashTransport_GetTargetAddr(t *testing.T) { - tran := NewHashTransport(3, nil, "127.0.0.1:5581", "127.0.0.1:5582", "127.0.0.1:5583") + tran := NewHashEndpoint(3, nil, "127.0.0.1:5581", "127.0.0.1:5582", "127.0.0.1:5583") key := "test" From 400d620aa4079ee16cb1ac7badc6f02cc47db644 Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Thu, 11 Nov 2021 23:00:21 +0800 Subject: [PATCH 12/18] test(lru-worker): update lru worker test --- pkg/lru/woker_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/lru/woker_test.go b/pkg/lru/woker_test.go index c80bee2..f4bf3df 100644 --- a/pkg/lru/woker_test.go +++ b/pkg/lru/woker_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "gitee.com/wheat-os/wheatCache/pkg/event" + "gitee.com/wheat-os/wheatCache/pkg/event2" "gitee.com/wheat-os/wheatCache/pkg/logx" "gitee.com/wheat-os/wheatCache/pkg/proto" "gitee.com/wheat-os/wheatCache/pkg/structure/stringx" @@ -15,9 +15,9 @@ import ( func TestWorker(t *testing.T) { ctx := context.Background() lru := NewLRUCache() - produce := event.NewProduce(lru.GetDriver()) + produce := event2.NewProduce(lru.GetDriver()) workEvent := produce.NewEvent(OptionEventName) - workEvent.SetValue(WorkFuncEventKey, event.EventWorkFunc(func() (interface{}, error) { + workEvent.SetValue(event2.WorkFuncEventKey, event2.EventWorkFunc(func() (interface{}, error) { v1 := stringx.NewStringSingle() key := proto.BaseKey{ Key: "v1", @@ -36,11 +36,11 @@ func TestWorker(t *testing.T) { func TestSingleCache_DelToClearSize(t *testing.T) { ctx := context.Background() lru := NewLRUCache() - produce := event.NewProduce(lru.GetDriver()) + produce := event2.NewProduce(lru.GetDriver()) for i := int32(20000); i > 0; i-- { workEvent := produce.NewEvent(OptionEventName) - workEvent.SetValue(WorkFuncEventKey, event.EventWorkFunc(func() (interface{}, error) { + workEvent.SetValue(event2.WorkFuncEventKey, event2.EventWorkFunc(func() (interface{}, error) { v1 := stringx.NewStringSingle() key := proto.BaseKey{ Key: string(i), @@ -53,7 +53,7 @@ func TestSingleCache_DelToClearSize(t *testing.T) { workEvent.InitWaitEvent() produce.Call(ctx, workEvent) workEvent.StartWaitEvent(2 * time.Second) - produce.Recovery(workEvent) + workEvent.Recovery() } logx.Info("start size is %d", lru.nowSize) From 5105a62bca11e80c2a4766f09b7e86af77f6eebd Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Sat, 13 Nov 2021 20:04:21 +0800 Subject: [PATCH 13/18] test(hashx): add unsafe.Point test --- pkg/structure/hashx/hashx_test.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/pkg/structure/hashx/hashx_test.go b/pkg/structure/hashx/hashx_test.go index 78c9241..8aa5eac 100644 --- a/pkg/structure/hashx/hashx_test.go +++ b/pkg/structure/hashx/hashx_test.go @@ -1,7 +1,10 @@ package hashx import ( + "fmt" + "reflect" "testing" + "unsafe" "github.com/stretchr/testify/require" ) @@ -60,3 +63,27 @@ func TestHashX_Add(t *testing.T) { require.NoError(t, err) require.Equal(t, s, "2") } + +func Test_Pointer(t *testing.T) { + s := make([]int, 9, 20) + lens := *(*int)(unsafe.Pointer(uintptr(unsafe.Pointer(&s)) + uintptr(8))) + fmt.Println(lens, len(s)) + + mp := make(map[string]int) + mp["qcrao"] = 100 + mp["stefno"] = 18 + + count := **(**uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&mp)) + uintptr(16))) + fmt.Println(count, len(mp)) // 2 +} + +func string2bytes(s string) []byte { + stringHeader := (*reflect.StringHeader)(unsafe.Pointer(&s)) + + result := reflect.SliceHeader{ + Data: stringHeader.Data, + Len: stringHeader.Len, + Cap: stringHeader.Len, + } + return *(*[]byte)(unsafe.Pointer(&result)) +} From 366793d9550b3aa3bb620512235201c25f8b77f9 Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Sun, 14 Nov 2021 21:16:36 +0800 Subject: [PATCH 14/18] chore(proto): update proto --- pkg/proto/base.pb.go | 64 ++++++- pkg/proto/setx.pb.go | 247 +++++++++++++++++--------- protobuf/base.proto | 4 + protobuf/setx.proto | 15 +- shell/make_service.py | 18 +- storage/dao/dao.gen.go | 2 +- storage/dao/interface.gen.go | 14 +- storage/service/single_service.gen.go | 2 +- storage/temp/dao.template | 2 +- 9 files changed, 260 insertions(+), 108 deletions(-) diff --git a/pkg/proto/base.pb.go b/pkg/proto/base.pb.go index 7e14747..d9e5092 100644 --- a/pkg/proto/base.pb.go +++ b/pkg/proto/base.pb.go @@ -84,6 +84,44 @@ func (x *BaseKey) GetExpire() *timestamppb.Timestamp { return nil } +type External struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *External) Reset() { + *x = External{} + if protoimpl.UnsafeEnabled { + mi := &file_base_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *External) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*External) ProtoMessage() {} + +func (x *External) ProtoReflect() protoreflect.Message { + mi := &file_base_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 External.ProtoReflect.Descriptor instead. +func (*External) Descriptor() ([]byte, []int) { + return file_base_proto_rawDescGZIP(), []int{1} +} + var File_base_proto protoreflect.FileDescriptor var file_base_proto_rawDesc = []byte{ @@ -96,8 +134,9 @@ var file_base_proto_rawDesc = []byte{ 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x06, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, - 0x42, 0x0b, 0x5a, 0x09, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x22, 0x0a, 0x0a, 0x08, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x42, 0x0b, 0x5a, 0x09, + 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( @@ -112,13 +151,14 @@ func file_base_proto_rawDescGZIP() []byte { return file_base_proto_rawDescData } -var file_base_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_base_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_base_proto_goTypes = []interface{}{ (*BaseKey)(nil), // 0: BaseKey - (*timestamppb.Timestamp)(nil), // 1: google.protobuf.Timestamp + (*External)(nil), // 1: External + (*timestamppb.Timestamp)(nil), // 2: google.protobuf.Timestamp } var file_base_proto_depIdxs = []int32{ - 1, // 0: BaseKey.expire:type_name -> google.protobuf.Timestamp + 2, // 0: BaseKey.expire:type_name -> google.protobuf.Timestamp 1, // [1:1] is the sub-list for method output_type 1, // [1:1] is the sub-list for method input_type 1, // [1:1] is the sub-list for extension type_name @@ -144,6 +184,18 @@ func file_base_proto_init() { return nil } } + file_base_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*External); 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{ @@ -151,7 +203,7 @@ func file_base_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_base_proto_rawDesc, NumEnums: 0, - NumMessages: 1, + NumMessages: 2, NumExtensions: 0, NumServices: 0, }, diff --git a/pkg/proto/setx.pb.go b/pkg/proto/setx.pb.go index b0b33d2..cf083bf 100644 --- a/pkg/proto/setx.pb.go +++ b/pkg/proto/setx.pb.go @@ -267,7 +267,8 @@ type SDiffResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Resluts []string `protobuf:"bytes,2,rep,name=resluts,proto3" json:"resluts,omitempty"` + E *External `protobuf:"bytes,1,opt,name=e,proto3" json:"e,omitempty"` + Result []string `protobuf:"bytes,2,rep,name=result,proto3" json:"result,omitempty"` } func (x *SDiffResponse) Reset() { @@ -302,9 +303,16 @@ func (*SDiffResponse) Descriptor() ([]byte, []int) { return file_setx_proto_rawDescGZIP(), []int{5} } -func (x *SDiffResponse) GetResluts() []string { +func (x *SDiffResponse) GetE() *External { if x != nil { - return x.Resluts + return x.E + } + return nil +} + +func (x *SDiffResponse) GetResult() []string { + if x != nil { + return x.Result } return nil } @@ -376,6 +384,8 @@ type SDiffStoreResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + E *External `protobuf:"bytes,1,opt,name=e,proto3" json:"e,omitempty"` //加上 External 表示这个接口的返回值会对外调用 } func (x *SDiffStoreResponse) Reset() { @@ -410,6 +420,13 @@ func (*SDiffStoreResponse) Descriptor() ([]byte, []int) { return file_setx_proto_rawDescGZIP(), []int{7} } +func (x *SDiffStoreResponse) GetE() *External { + if x != nil { + return x.E + } + return nil +} + type SInterRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -470,7 +487,8 @@ type SInterResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Resluts []string `protobuf:"bytes,2,rep,name=resluts,proto3" json:"resluts,omitempty"` + E *External `protobuf:"bytes,1,opt,name=e,proto3" json:"e,omitempty"` + Result []string `protobuf:"bytes,2,rep,name=result,proto3" json:"result,omitempty"` } func (x *SInterResponse) Reset() { @@ -505,9 +523,16 @@ func (*SInterResponse) Descriptor() ([]byte, []int) { return file_setx_proto_rawDescGZIP(), []int{9} } -func (x *SInterResponse) GetResluts() []string { +func (x *SInterResponse) GetE() *External { if x != nil { - return x.Resluts + return x.E + } + return nil +} + +func (x *SInterResponse) GetResult() []string { + if x != nil { + return x.Result } return nil } @@ -579,6 +604,8 @@ type SInterStoreResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + E *External `protobuf:"bytes,1,opt,name=e,proto3" json:"e,omitempty"` } func (x *SInterStoreResponse) Reset() { @@ -613,6 +640,13 @@ func (*SInterStoreResponse) Descriptor() ([]byte, []int) { return file_setx_proto_rawDescGZIP(), []int{11} } +func (x *SInterStoreResponse) GetE() *External { + if x != nil { + return x.E + } + return nil +} + type SIsMemberRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -782,6 +816,8 @@ type SMoveResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + E *External `protobuf:"bytes,1,opt,name=e,proto3" json:"e,omitempty"` } func (x *SMoveResponse) Reset() { @@ -816,6 +852,13 @@ func (*SMoveResponse) Descriptor() ([]byte, []int) { return file_setx_proto_rawDescGZIP(), []int{15} } +func (x *SMoveResponse) GetE() *External { + if x != nil { + return x.E + } + return nil +} + type SPopRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1071,7 +1114,8 @@ type SUnionResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Results []string `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` + E *External `protobuf:"bytes,1,opt,name=e,proto3" json:"e,omitempty"` + Result []string `protobuf:"bytes,2,rep,name=result,proto3" json:"result,omitempty"` } func (x *SUnionResponse) Reset() { @@ -1106,9 +1150,16 @@ func (*SUnionResponse) Descriptor() ([]byte, []int) { return file_setx_proto_rawDescGZIP(), []int{21} } -func (x *SUnionResponse) GetResults() []string { +func (x *SUnionResponse) GetE() *External { if x != nil { - return x.Results + return x.E + } + return nil +} + +func (x *SUnionResponse) GetResult() []string { + if x != nil { + return x.Result } return nil } @@ -1180,6 +1231,8 @@ type SUnionStoreResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + E *External `protobuf:"bytes,1,opt,name=e,proto3" json:"e,omitempty"` } func (x *SUnionStoreResponse) Reset() { @@ -1214,13 +1267,20 @@ func (*SUnionStoreResponse) Descriptor() ([]byte, []int) { return file_setx_proto_rawDescGZIP(), []int{23} } +func (x *SUnionStoreResponse) GetE() *External { + if x != nil { + return x.E + } + return nil +} + type SScanRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Sursor int32 `protobuf:"varint,2,opt,name=sursor,proto3" json:"sursor,omitempty"` + Cursor int32 `protobuf:"varint,2,opt,name=cursor,proto3" json:"cursor,omitempty"` Regexp string `protobuf:"bytes,3,opt,name=regexp,proto3" json:"regexp,omitempty"` Count int32 `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"` } @@ -1264,9 +1324,9 @@ func (x *SScanRequest) GetKey() *BaseKey { return nil } -func (x *SScanRequest) GetSursor() int32 { +func (x *SScanRequest) GetCursor() int32 { if x != nil { - return x.Sursor + return x.Cursor } return 0 } @@ -1351,32 +1411,38 @@ var file_setx_proto_rawDesc = []byte{ 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, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x73, 0x4b, - 0x65, 0x79, 0x73, 0x22, 0x29, 0x0a, 0x0d, 0x53, 0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x6c, 0x75, 0x74, 0x73, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x73, 0x6c, 0x75, 0x74, 0x73, 0x22, 0x61, - 0x0a, 0x11, 0x53, 0x44, 0x69, 0x66, 0x66, 0x53, 0x74, 0x6f, 0x72, 0x65, 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, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x05, 0x73, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x61, 0x76, 0x65, 0x5f, 0x6b, - 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x61, 0x76, 0x65, 0x4b, 0x65, - 0x79, 0x22, 0x14, 0x0a, 0x12, 0x53, 0x44, 0x69, 0x66, 0x66, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x42, 0x0a, 0x0d, 0x53, 0x49, 0x6e, 0x74, 0x65, + 0x65, 0x79, 0x73, 0x22, 0x40, 0x0a, 0x0d, 0x53, 0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x17, 0x0a, 0x01, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x09, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x01, 0x65, 0x12, 0x16, 0x0a, + 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x72, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x61, 0x0a, 0x11, 0x53, 0x44, 0x69, 0x66, 0x66, 0x53, 0x74, + 0x6f, 0x72, 0x65, 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, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x73, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x73, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x19, 0x0a, + 0x08, 0x73, 0x61, 0x76, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x73, 0x61, 0x76, 0x65, 0x4b, 0x65, 0x79, 0x22, 0x2d, 0x0a, 0x12, 0x53, 0x44, 0x69, 0x66, + 0x66, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x17, + 0x0a, 0x01, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x45, 0x78, 0x74, 0x65, + 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x01, 0x65, 0x22, 0x42, 0x0a, 0x0d, 0x53, 0x49, 0x6e, 0x74, 0x65, 0x72, 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, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x73, 0x4b, 0x65, 0x79, 0x73, 0x22, 0x2a, 0x0a, 0x0e, 0x53, - 0x49, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, - 0x07, 0x72, 0x65, 0x73, 0x6c, 0x75, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, - 0x72, 0x65, 0x73, 0x6c, 0x75, 0x74, 0x73, 0x22, 0x62, 0x0a, 0x12, 0x53, 0x49, 0x6e, 0x74, 0x65, - 0x72, 0x53, 0x74, 0x6f, 0x72, 0x65, 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, 0x73, 0x5f, 0x6b, - 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x73, 0x4b, 0x65, 0x79, 0x73, - 0x12, 0x19, 0x0a, 0x08, 0x73, 0x61, 0x76, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x73, 0x61, 0x76, 0x65, 0x4b, 0x65, 0x79, 0x22, 0x15, 0x0a, 0x13, 0x53, - 0x49, 0x6e, 0x74, 0x65, 0x72, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x46, 0x0a, 0x10, 0x53, 0x49, 0x73, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x73, 0x4b, 0x65, 0x79, 0x73, 0x22, 0x41, 0x0a, 0x0e, 0x53, + 0x49, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x17, 0x0a, + 0x01, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, + 0x6e, 0x61, 0x6c, 0x52, 0x01, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x62, + 0x0a, 0x12, 0x53, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x53, 0x74, 0x6f, 0x72, 0x65, 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, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x05, 0x73, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x61, 0x76, 0x65, 0x5f, + 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x61, 0x76, 0x65, 0x4b, + 0x65, 0x79, 0x22, 0x2e, 0x0a, 0x13, 0x53, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x53, 0x74, 0x6f, 0x72, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x17, 0x0a, 0x01, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, + 0x01, 0x65, 0x22, 0x46, 0x0a, 0x10, 0x53, 0x49, 0x73, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 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, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, @@ -1389,45 +1455,50 @@ var file_setx_proto_rawDesc = []byte{ 0x79, 0x12, 0x19, 0x0a, 0x08, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x6f, 0x76, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6d, - 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x22, 0x0f, 0x0a, 0x0d, 0x53, 0x4d, 0x6f, 0x76, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3f, 0x0a, 0x0b, 0x53, 0x50, 0x6f, 0x70, 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, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x28, 0x0a, 0x0c, 0x53, 0x50, 0x6f, 0x70, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, - 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, - 0x72, 0x73, 0x22, 0x3f, 0x0a, 0x0b, 0x53, 0x52, 0x65, 0x6d, 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, 0x14, 0x0a, - 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x22, 0x0e, 0x0a, 0x0c, 0x53, 0x52, 0x65, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x42, 0x0a, 0x0d, 0x53, 0x55, 0x6e, 0x69, 0x6f, 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, - 0x12, 0x15, 0x0a, 0x06, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x05, 0x73, 0x4b, 0x65, 0x79, 0x73, 0x22, 0x2a, 0x0a, 0x0e, 0x53, 0x55, 0x6e, 0x69, 0x6f, - 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x73, 0x22, 0x62, 0x0a, 0x12, 0x53, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x6f, + 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x22, 0x28, 0x0a, 0x0d, 0x53, 0x4d, 0x6f, 0x76, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x17, 0x0a, 0x01, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x01, 0x65, + 0x22, 0x3f, 0x0a, 0x0b, 0x53, 0x50, 0x6f, 0x70, 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, 0x14, 0x0a, 0x05, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x22, 0x28, 0x0a, 0x0c, 0x53, 0x50, 0x6f, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x22, 0x3f, 0x0a, 0x0b, 0x53, + 0x52, 0x65, 0x6d, 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, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x0e, 0x0a, 0x0c, + 0x53, 0x52, 0x65, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x42, 0x0a, 0x0d, + 0x53, 0x55, 0x6e, 0x69, 0x6f, 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, 0x12, 0x15, 0x0a, 0x06, 0x73, 0x5f, 0x6b, + 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x73, 0x4b, 0x65, 0x79, 0x73, + 0x22, 0x41, 0x0a, 0x0e, 0x53, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x17, 0x0a, 0x01, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, + 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x01, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x22, 0x62, 0x0a, 0x12, 0x53, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x6f, 0x72, 0x65, 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, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x73, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x61, 0x76, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x73, 0x61, 0x76, 0x65, 0x4b, 0x65, 0x79, 0x22, 0x15, 0x0a, 0x13, 0x53, 0x55, 0x6e, 0x69, 0x6f, - 0x6e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x70, - 0x0a, 0x0c, 0x53, 0x53, 0x63, 0x61, 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, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x75, - 0x72, 0x73, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x75, 0x72, 0x73, - 0x6f, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x65, 0x78, 0x70, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x67, 0x65, 0x78, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x22, 0x29, 0x0a, 0x0d, 0x53, 0x53, 0x63, 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x42, 0x0b, 0x5a, 0x09, 0x70, - 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x61, 0x76, 0x65, 0x4b, 0x65, 0x79, 0x22, 0x2e, 0x0a, 0x13, 0x53, 0x55, 0x6e, 0x69, 0x6f, + 0x6e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x17, + 0x0a, 0x01, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x45, 0x78, 0x74, 0x65, + 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x01, 0x65, 0x22, 0x70, 0x0a, 0x0c, 0x53, 0x53, 0x63, 0x61, 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, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x06, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x72, + 0x65, 0x67, 0x65, 0x78, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x67, + 0x65, 0x78, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x29, 0x0a, 0x0d, 0x53, 0x53, 0x63, + 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, + 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x73, 0x42, 0x0b, 0x5a, 0x09, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1471,26 +1542,34 @@ var file_setx_proto_goTypes = []interface{}{ (*SScanRequest)(nil), // 24: SScanRequest (*SScanResponse)(nil), // 25: SScanResponse (*BaseKey)(nil), // 26: BaseKey + (*External)(nil), // 27: External } var file_setx_proto_depIdxs = []int32{ 26, // 0: SAddRequest.key:type_name -> BaseKey 26, // 1: SCardRequest.key:type_name -> BaseKey 26, // 2: SDiffRequest.key:type_name -> BaseKey - 26, // 3: SDiffStoreRequest.key:type_name -> BaseKey - 26, // 4: SInterRequest.key:type_name -> BaseKey - 26, // 5: SInterStoreRequest.key:type_name -> BaseKey - 26, // 6: SIsMemberRequest.key:type_name -> BaseKey - 26, // 7: SMoveRequest.key:type_name -> BaseKey - 26, // 8: SPopRequest.key:type_name -> BaseKey - 26, // 9: SRemRequest.key:type_name -> BaseKey - 26, // 10: SUnionRequest.key:type_name -> BaseKey - 26, // 11: SUnionStoreRequest.key:type_name -> BaseKey - 26, // 12: SScanRequest.key:type_name -> BaseKey - 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 + 27, // 3: SDiffResponse.e:type_name -> External + 26, // 4: SDiffStoreRequest.key:type_name -> BaseKey + 27, // 5: SDiffStoreResponse.e:type_name -> External + 26, // 6: SInterRequest.key:type_name -> BaseKey + 27, // 7: SInterResponse.e:type_name -> External + 26, // 8: SInterStoreRequest.key:type_name -> BaseKey + 27, // 9: SInterStoreResponse.e:type_name -> External + 26, // 10: SIsMemberRequest.key:type_name -> BaseKey + 26, // 11: SMoveRequest.key:type_name -> BaseKey + 27, // 12: SMoveResponse.e:type_name -> External + 26, // 13: SPopRequest.key:type_name -> BaseKey + 26, // 14: SRemRequest.key:type_name -> BaseKey + 26, // 15: SUnionRequest.key:type_name -> BaseKey + 27, // 16: SUnionResponse.e:type_name -> External + 26, // 17: SUnionStoreRequest.key:type_name -> BaseKey + 27, // 18: SUnionStoreResponse.e:type_name -> External + 26, // 19: SScanRequest.key:type_name -> BaseKey + 20, // [20:20] is the sub-list for method output_type + 20, // [20:20] is the sub-list for method input_type + 20, // [20:20] is the sub-list for extension type_name + 20, // [20:20] is the sub-list for extension extendee + 0, // [0:20] is the sub-list for field type_name } func init() { file_setx_proto_init() } diff --git a/protobuf/base.proto b/protobuf/base.proto index 4d0fd56..3dca372 100644 --- a/protobuf/base.proto +++ b/protobuf/base.proto @@ -7,4 +7,8 @@ message BaseKey { string key = 1; int64 ttl = 2; google.protobuf.Timestamp expire = 3; +} + +message External { + } \ No newline at end of file diff --git a/protobuf/setx.proto b/protobuf/setx.proto index 1cee993..a699b4a 100644 --- a/protobuf/setx.proto +++ b/protobuf/setx.proto @@ -24,7 +24,8 @@ message SDiffRequest { } message SDiffResponse { - repeated string resluts = 2; + External e = 1; + repeated string result = 2; } message SDiffStoreRequest { @@ -34,6 +35,7 @@ message SDiffStoreRequest { } message SDiffStoreResponse { + External e = 1; //加上 External 表示这个接口的返回值会对外调用 } message SInterRequest { @@ -42,7 +44,8 @@ message SInterRequest { } message SInterResponse { - repeated string resluts = 2; + External e = 1; + repeated string result = 2; } message SInterStoreRequest { @@ -52,6 +55,7 @@ message SInterStoreRequest { } message SInterStoreResponse { + External e = 1; } message SIsMemberRequest { @@ -70,6 +74,7 @@ message SMoveRequest { } message SMoveResponse { + External e = 1; } message SPopRequest { @@ -95,7 +100,8 @@ message SUnionRequest { } message SUnionResponse { - repeated string results = 1; + External e = 1; + repeated string result = 2; } message SUnionStoreRequest { @@ -105,11 +111,12 @@ message SUnionStoreRequest { } message SUnionStoreResponse { + External e = 1; } message SScanRequest { BaseKey key = 1; - int32 sursor = 2; + int32 cursor = 2; string regexp = 3; int32 count = 4; } diff --git a/shell/make_service.py b/shell/make_service.py index 83ffbba..6823c97 100644 --- a/shell/make_service.py +++ b/shell/make_service.py @@ -17,6 +17,7 @@ class ProtoOption(object): self.method = method self.option = [] self.ret = [] + self.external = False def add_option(self, opt: List[str]): self.option.extend(opt) @@ -38,10 +39,11 @@ def dist_to_ProOpt(req, resp) -> List[ProtoOption]: def parse_type(l: str) -> List[str]: l = l.strip() if l == "": - return [] + return [], False opt = l.split(";") result = [] + f = False for l_opt in opt: l_opt = l_opt.strip() l_list = l_opt.split() @@ -62,15 +64,23 @@ def dist_to_ProOpt(req, resp) -> List[ProtoOption]: if len(resMap[0]) == 3: mapKey, mapVal, var = resMap[0] result.append([to_camel(var), f"map[{mapKey}]{mapVal}"]) + + elif "External" in val: + f = True + else: result.append([to_camel(l_list[1]), val]) - return result + return result, f lists = [] for key, value in req.items(): p = ProtoOption(method=key) - p.add_option(parse_type(value)) - p.add_ret(parse_type(resp.get(key, ""))) + p.add_option(parse_type(value)[0]) + + ret, e = parse_type(resp.get(key, "")) + if e: + p.external = True + p.add_ret(ret) lists.append(p) return lists diff --git a/storage/dao/dao.gen.go b/storage/dao/dao.gen.go index 01d3de1..448f4c1 100644 --- a/storage/dao/dao.gen.go +++ b/storage/dao/dao.gen.go @@ -153,7 +153,7 @@ func (d *Dao) ExecMessage(message protobuf.Message) error { _, err := d.SUnionStore(req.Key, req.SKeys, req.SaveKey) return err case *proto.SScanRequest: - _, err := d.SScan(req.Key, req.Sursor, req.Regexp, req.Count) + _, err := d.SScan(req.Key, req.Cursor, req.Regexp, req.Count) return err default: return errorx.New("The type that is not registered exec err") diff --git a/storage/dao/interface.gen.go b/storage/dao/interface.gen.go index e9e6364..359db4c 100644 --- a/storage/dao/interface.gen.go +++ b/storage/dao/interface.gen.go @@ -42,16 +42,16 @@ type Interface interface { StrLen(*proto.BaseKey) (*proto.StrLenResponse, error) SAdd(*proto.BaseKey, []string) (*proto.SAddResponse, error) SCard(*proto.BaseKey) (*proto.SCardResponse, error) - SDiff(*proto.BaseKey, []string) (*proto.SDiffResponse, error) - SDiffStore(*proto.BaseKey, []string, string) (*proto.SDiffStoreResponse, error) - SInter(*proto.BaseKey, []string) (*proto.SInterResponse, error) - SInterStore(*proto.BaseKey, []string, string) (*proto.SInterStoreResponse, error) + SDiff(*proto.BaseKey, []string) (interface{}, error) + SDiffStore(*proto.BaseKey, []string, string) (interface{}, error) + SInter(*proto.BaseKey, []string) (interface{}, error) + SInterStore(*proto.BaseKey, []string, string) (interface{}, error) SIsMember(*proto.BaseKey, string) (*proto.SIsMemberResponse, error) - SMove(*proto.BaseKey, string, []string) (*proto.SMoveResponse, error) + SMove(*proto.BaseKey, string, []string) (interface{}, error) SPop(*proto.BaseKey, int32) (*proto.SPopResponse, error) SRem(*proto.BaseKey, int32) (*proto.SRemResponse, error) - SUnion(*proto.BaseKey, []string) (*proto.SUnionResponse, error) - SUnionStore(*proto.BaseKey, []string, string) (*proto.SUnionStoreResponse, error) + SUnion(*proto.BaseKey, []string) (interface{}, error) + SUnionStore(*proto.BaseKey, []string, string) (interface{}, error) SScan(*proto.BaseKey, int32, string, int32) (*proto.SScanResponse, error) ExecMessage(message protobuf.Message) error } diff --git a/storage/service/single_service.gen.go b/storage/service/single_service.gen.go index 9dfdf7c..bce6dfe 100644 --- a/storage/service/single_service.gen.go +++ b/storage/service/single_service.gen.go @@ -1219,7 +1219,7 @@ func (s *singleService) SScan( req *proto.SScanRequest, ) (*proto.SScanResponse, error) { work := event2.EventWorkFunc(func() (interface{}, error) { - resp, err := s.dao.SScan(req.Key, req.Sursor, req.Regexp, req.Count) + resp, err := s.dao.SScan(req.Key, req.Cursor, req.Regexp, req.Count) if err != nil { return nil, err } diff --git a/storage/temp/dao.template b/storage/temp/dao.template index 0ea1134..d657c3e 100644 --- a/storage/temp/dao.template +++ b/storage/temp/dao.template @@ -10,7 +10,7 @@ import ( type Interface interface { {%for key in keys %} - {{key.method}}({% for req in key.option %} {{req[1]}}, {% endfor %}) (*proto.{{key.method}}Response, error) + {{key.method}}({% for req in key.option %} {{req[1]}}, {% endfor %}) ({% if key.external == False %} *proto.{{key.method}}Response {% else %} interface{} {% endif %}, error) {%- endfor %} ExecMessage(message protobuf.Message) error } From 594f8acf32850c40c0a315657551fb13ed3b3613 Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Mon, 15 Nov 2021 23:57:39 +0800 Subject: [PATCH 15/18] feat(structure-hashx): add hashx range --- pkg/structure/define.go | 1 + pkg/structure/hashx/hashx.go | 37 ++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/pkg/structure/define.go b/pkg/structure/define.go index 375e941..e3078bd 100644 --- a/pkg/structure/define.go +++ b/pkg/structure/define.go @@ -65,4 +65,5 @@ type HashXInterface interface { Add(renewal int, key ...string) (int, []string, error) // 访问影响成功的结果 SetX(key string, val string) (bool, UpdateLength) // 不存在才插入 Length() int + Range(consur, count int, regex string) []string } diff --git a/pkg/structure/hashx/hashx.go b/pkg/structure/hashx/hashx.go index 8d6862b..0cb7f36 100644 --- a/pkg/structure/hashx/hashx.go +++ b/pkg/structure/hashx/hashx.go @@ -1,6 +1,8 @@ package hashx import ( + "regexp" + "gitee.com/wheat-os/wheatCache/pkg/errorx" "gitee.com/wheat-os/wheatCache/pkg/structure" ) @@ -118,3 +120,38 @@ func (h HashX) SetX(key string, val string) (bool, structure.UpdateLength) { func (h HashX) Length() int { return len(h) } + +func (h HashX) Range(consur, count int, regex string) []string { + + var reComp *regexp.Regexp + if regex == "" { + reComp = nil + } else { + reComp = regexp.MustCompile(regex) + } + + result := make([]string, 0) + for _, val := range h { + if consur > 0 { + consur-- + continue + } + + if count == 0 && count != -1 { + break + } + + s := val.ToString() + if reComp == nil { + count-- + result = append(result, s) + continue + } + if reComp.MatchString(s) { + count-- + result = append(result, s) + } + } + + return result +} From 60cf8f5eb1565cfbbc96197a597d19902850cb32 Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Mon, 15 Nov 2021 23:58:27 +0800 Subject: [PATCH 16/18] test(structure-hashx): add hashx range test --- pkg/structure/hashx/hashx_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/pkg/structure/hashx/hashx_test.go b/pkg/structure/hashx/hashx_test.go index 8aa5eac..5913b13 100644 --- a/pkg/structure/hashx/hashx_test.go +++ b/pkg/structure/hashx/hashx_test.go @@ -3,6 +3,7 @@ package hashx import ( "fmt" "reflect" + "regexp" "testing" "unsafe" @@ -87,3 +88,26 @@ func string2bytes(s string) []byte { } return *(*[]byte)(unsafe.Pointer(&result)) } + +func TestHashX_Range(t *testing.T) { + + reComp := regexp.MustCompile("a.+") + require.True(t, reComp.MatchString("abbs")) + + h := NewHashXSingle() + h.Set("abbs", "abbs") + h.Set("ppp", "ppp") + h.Set("accs", "accs") + + result := h.Range(0, 3, "") + require.Len(t, result, 3) + + result = h.Range(0, -1, "") + require.Len(t, result, 3) + + result = h.Range(0, -1, "a.+") + require.Len(t, result, 2) + + result = h.Range(1, -1, "a.+") + require.Len(t, result, 1) +} From d68209c94ccd32c6bf3fd2049308a360aac86bfd Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Tue, 16 Nov 2021 00:17:47 +0800 Subject: [PATCH 17/18] feat(external-gateway): add external gateway call --- storage/external/define.go | 12 ++++++++++++ storage/external/gateway.go | 24 ++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 storage/external/define.go create mode 100644 storage/external/gateway.go diff --git a/storage/external/define.go b/storage/external/define.go new file mode 100644 index 0000000..af328de --- /dev/null +++ b/storage/external/define.go @@ -0,0 +1,12 @@ +package external + +import ( + "sync" + + "gitee.com/wheat-os/wheatCache/pkg/proto" +) + +var ( + oneGatewayClient sync.Once + gatewayClient proto.CommServerClient +) diff --git a/storage/external/gateway.go b/storage/external/gateway.go new file mode 100644 index 0000000..3b8fe63 --- /dev/null +++ b/storage/external/gateway.go @@ -0,0 +1,24 @@ +package external + +import ( + "errors" + + "gitee.com/wheat-os/wheatCache/client" + "gitee.com/wheat-os/wheatCache/client/middle" + "gitee.com/wheat-os/wheatCache/pkg/proto" +) + +func NewGatewayClient() (proto.CommServerClient, error) { + oneGatewayClient.Do(func() { + cli, err := client.NewWheatClient("127.0.0.1:5891", middle.WithUnaryColonyClient) + if err == nil { + gatewayClient = cli + } + }) + + if gatewayClient != nil { + return gatewayClient, nil + } + + return nil, errors.New("get gateway err") +} From af6426f83b0326357c228285823ffb2d017bdb1e Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Tue, 16 Nov 2021 00:18:12 +0800 Subject: [PATCH 18/18] feay(storage-dao): add setx type dao --- storage/dao/setx.go | 469 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 442 insertions(+), 27 deletions(-) diff --git a/storage/dao/setx.go b/storage/dao/setx.go index e4dd9af..9247b95 100644 --- a/storage/dao/setx.go +++ b/storage/dao/setx.go @@ -1,55 +1,470 @@ package dao -import "gitee.com/wheat-os/wheatCache/pkg/proto" +import ( + "context" -func (d *Dao) SAdd(_ *proto.BaseKey, _ []string) (*proto.SAddResponse, error) { - panic("not implemented") // TODO: Implement + "gitee.com/wheat-os/wheatCache/pkg/errorx" + "gitee.com/wheat-os/wheatCache/pkg/event2" + "gitee.com/wheat-os/wheatCache/pkg/proto" + "gitee.com/wheat-os/wheatCache/pkg/structure" + "gitee.com/wheat-os/wheatCache/pkg/structure/hashx" + "gitee.com/wheat-os/wheatCache/storage/external" +) + +func (d *Dao) SAdd(key *proto.BaseKey, setVal []string) (*proto.SAddResponse, error) { + value, ok := d.lru.Get(key) + if !ok { + hashVal := hashx.NewHashXSingle() + for _, sv := range setVal { + hashVal.SetX(sv, sv) + } + d.lru.Add(key, hashVal) + } + + hashVal, ok := value.(structure.HashXInterface) + if !ok { + return nil, errorx.DaoTypeErr("setx") + } + + for _, sv := range setVal { + b, up := hashVal.SetX(sv, sv) + if b { + d.lru.UpdateLruSize(up) + } + } + + return &proto.SAddResponse{}, nil } -func (d *Dao) SCard(_ *proto.BaseKey) (*proto.SCardResponse, error) { - panic("not implemented") // TODO: Implement +func (d *Dao) SCard(key *proto.BaseKey) (*proto.SCardResponse, error) { + value, ok := d.lru.Get(key) + if !ok { + return nil, errorx.KeyBaseIsNilErr() + } + hashVal, ok := value.(structure.HashXInterface) + if !ok { + return nil, errorx.DaoTypeErr("setx") + } + + return &proto.SCardResponse{Length: int32(hashVal.Length())}, nil } -func (d *Dao) SDiff(_ *proto.BaseKey, _ []string) (*proto.SDiffResponse, error) { - panic("not implemented") // TODO: Implement +func mathSDiff(masterItem []string, extKey []string) ([]string, error) { + cli, err := external.NewGatewayClient() + if err != nil { + return nil, err + } + + m := make(map[string]struct{}) + for _, bVal := range masterItem { + m[bVal] = struct{}{} + } + + setItem := make([]string, 0, len(extKey)) + ctx := context.Background() + for _, sKey := range extKey { + baseKey := proto.NewBaseKey(sKey) + resp, err := cli.SScan(ctx, &proto.SScanRequest{ + Key: baseKey, + Count: -1, + }) + + if err != nil { + continue + } + + for _, item := range resp.Results { + if _, ok := m[item]; !ok { + setItem = append(setItem, item) + m[item] = struct{}{} + } + } + } + + return setItem, nil } -func (d *Dao) SDiffStore(_ *proto.BaseKey, _ []string, _ string) (*proto.SDiffStoreResponse, error) { - panic("not implemented") // TODO: Implement +func (d *Dao) SDiff(key *proto.BaseKey, setKey []string) (interface{}, error) { + value, ok := d.lru.Get(key) + if !ok { + return nil, errorx.KeyBaseIsNilErr() + } + + hashVal, ok := value.(structure.HashXInterface) + if !ok { + return nil, errorx.DaoTypeErr("setx") + } + + baseItem := hashVal.Key() + + // await 挂起 + return event2.EventAwaitFunc(func() (interface{}, error) { + setItem, err := mathSDiff(baseItem, setKey) + if err != nil { + return nil, err + } + + return &proto.SDiffResponse{Result: setItem}, nil + + }), nil } -func (d *Dao) SInter(_ *proto.BaseKey, _ []string) (*proto.SInterResponse, error) { - panic("not implemented") // TODO: Implement +func (d *Dao) SDiffStore(key *proto.BaseKey, setKey []string, saveKey string) (interface{}, error) { + value, ok := d.lru.Get(key) + if !ok { + return nil, errorx.KeyBaseIsNilErr() + } + + hashVal, ok := value.(structure.HashXInterface) + if !ok { + return nil, errorx.DaoTypeErr("setx") + } + + baseItem := hashVal.Key() + + // await 挂起 + return event2.EventAwaitFunc(func() (interface{}, error) { + setItem, err := mathSDiff(baseItem, setKey) + if err != nil { + return nil, err + } + + cli, err := external.NewGatewayClient() + if err != nil { + return nil, err + } + + ctx := context.Background() + _, err = cli.SAdd(ctx, &proto.SAddRequest{ + Key: proto.NewBaseKey(saveKey), + Member: setItem, + }) + + if err != nil { + return nil, err + } + + return &proto.SDiffStoreResponse{}, nil + + }), nil } -func (d *Dao) SInterStore(_ *proto.BaseKey, _ []string, _ string) (*proto.SInterStoreResponse, error) { - panic("not implemented") // TODO: Implement +func mathSInter(masterItem []string, extKey []string) ([]string, error) { + cli, err := external.NewGatewayClient() + if err != nil { + return nil, err + } + + m := make(map[string]struct{}) + for _, bVal := range masterItem { + m[bVal] = struct{}{} + } + + setItem := make([]string, 0, len(extKey)) + ctx := context.Background() + for _, sKey := range extKey { + + resp, err := cli.SScan(ctx, &proto.SScanRequest{ + Key: proto.NewBaseKey(sKey), + Count: -1, + }) + + if err != nil { + continue + } + + for _, item := range resp.Results { + if _, ok := m[item]; ok { + setItem = append(setItem, item) + delete(m, item) + } + } + } + + return setItem, nil } -func (d *Dao) SIsMember(_ *proto.BaseKey, _ string) (*proto.SIsMemberResponse, error) { - panic("not implemented") // TODO: Implement +func (d *Dao) SInter(key *proto.BaseKey, setKey []string) (interface{}, error) { + value, ok := d.lru.Get(key) + if !ok { + return nil, errorx.KeyBaseIsNilErr() + } + + hashVal, ok := value.(structure.HashXInterface) + if !ok { + return nil, errorx.DaoTypeErr("setx") + } + + baseItem := hashVal.Key() + + // await 挂起 + return event2.EventAwaitFunc(func() (interface{}, error) { + setItem, err := mathSInter(baseItem, setKey) + if err != nil { + return nil, err + } + + return &proto.SInterResponse{Result: setItem}, nil + + }), nil } -func (d *Dao) SMove(_ *proto.BaseKey, _ string, _ []string) (*proto.SMoveResponse, error) { - panic("not implemented") // TODO: Implement +func (d *Dao) SInterStore(key *proto.BaseKey, setKey []string, saveKey string) (interface{}, error) { + value, ok := d.lru.Get(key) + if !ok { + return nil, errorx.KeyBaseIsNilErr() + } + + hashVal, ok := value.(structure.HashXInterface) + if !ok { + return nil, errorx.DaoTypeErr("setx") + } + + baseItem := hashVal.Key() + + // await 挂起 + return event2.EventAwaitFunc(func() (interface{}, error) { + setItem, err := mathSInter(baseItem, setKey) + if err != nil { + return nil, err + } + + cli, err := external.NewGatewayClient() + if err != nil { + return nil, err + } + + ctx := context.Background() + _, err = cli.SAdd(ctx, &proto.SAddRequest{ + Key: proto.NewBaseKey(saveKey), + Member: setItem, + }) + + if err != nil { + return nil, err + } + + return &proto.SInterStoreResponse{}, nil + }), nil } -func (d *Dao) SPop(_ *proto.BaseKey, _ int32) (*proto.SPopResponse, error) { - panic("not implemented") // TODO: Implement +func (d *Dao) SIsMember(key *proto.BaseKey, member string) (*proto.SIsMemberResponse, error) { + value, ok := d.lru.Get(key) + if !ok { + return nil, errorx.KeyBaseIsNilErr() + } + + hashVal, ok := value.(structure.HashXInterface) + if !ok { + return nil, errorx.DaoTypeErr("setx") + } + + _, err := hashVal.Get(member) + if err != nil { + return &proto.SIsMemberResponse{Exist: false}, nil + } + + return &proto.SIsMemberResponse{Exist: true}, nil } -func (d *Dao) SRem(_ *proto.BaseKey, _ int32) (*proto.SRemResponse, error) { - panic("not implemented") // TODO: Implement +func (d *Dao) SMove(key *proto.BaseKey, moveKey string, members []string) (interface{}, error) { + value, ok := d.lru.Get(key) + if !ok { + return nil, errorx.KeyBaseIsNilErr() + } + + hashVal, ok := value.(structure.HashXInterface) + if !ok { + return nil, errorx.DaoTypeErr("setx") + } + + moveMembers := make([]string, 0, len(members)) + for _, member := range members { + up, err := hashVal.Del(member) + if err == nil { + d.lru.UpdateLruSize(up) + moveMembers = append(moveMembers, member) + } + } + + return event2.EventAwaitFunc(func() (interface{}, error) { + cli, err := external.NewGatewayClient() + if err != nil { + return nil, err + } + + ctx := context.Background() + _, err = cli.SAdd(ctx, &proto.SAddRequest{ + Key: proto.NewBaseKey(moveKey), + Member: moveMembers, + }) + if err != nil { + return nil, err + } + + return &proto.SMoveResponse{}, nil + }), nil + } -func (d *Dao) SUnion(_ *proto.BaseKey, _ []string) (*proto.SUnionResponse, error) { - panic("not implemented") // TODO: Implement +func (d *Dao) SPop(key *proto.BaseKey, count int32) (*proto.SPopResponse, error) { + value, ok := d.lru.Get(key) + if !ok { + return nil, errorx.KeyBaseIsNilErr() + } + + hashVal, ok := value.(structure.HashXInterface) + if !ok { + return nil, errorx.DaoTypeErr("setx") + } + + members := make([]string, 0, count) + + result := hashVal.Range(0, int(count), "") + for _, res := range result { + up, err := hashVal.Del(res) + if err != nil { + return nil, err + } + d.lru.UpdateLruSize(up) + members = append(members, res) + } + + return &proto.SPopResponse{Members: members}, nil } -func (d *Dao) SUnionStore(_ *proto.BaseKey, _ []string, _ string) (*proto.SUnionStoreResponse, error) { - panic("not implemented") // TODO: Implement +func (d *Dao) SRem(key *proto.BaseKey, count int32) (*proto.SRemResponse, error) { + value, ok := d.lru.Get(key) + if !ok { + return nil, errorx.KeyBaseIsNilErr() + } + + hashVal, ok := value.(structure.HashXInterface) + if !ok { + return nil, errorx.DaoTypeErr("setx") + } + + result := hashVal.Range(0, int(count), "") + for _, res := range result { + up, err := hashVal.Del(res) + if err != nil { + return nil, err + } + d.lru.UpdateLruSize(up) + } + + return &proto.SRemResponse{}, nil } -func (d *Dao) SScan(_ *proto.BaseKey, _ int32, _ string, _ int32) (*proto.SScanResponse, error) { - panic("not implemented") // TODO: Implement +func mathSUnion(masterItem []string, extKey []string) ([]string, error) { + cli, err := external.NewGatewayClient() + if err != nil { + return nil, err + } + + m := make(map[string]struct{}) + for _, bVal := range masterItem { + m[bVal] = struct{}{} + } + + ctx := context.Background() + for _, sKey := range extKey { + + resp, err := cli.SScan(ctx, &proto.SScanRequest{ + Key: proto.NewBaseKey(sKey), + Count: -1, + }) + + if err != nil { + continue + } + + for _, item := range resp.Results { + if _, ok := m[item]; !ok { + masterItem = append(masterItem, item) + m[item] = struct{}{} + } + } + } + + return masterItem, nil +} + +func (d *Dao) SUnion(key *proto.BaseKey, setKey []string) (interface{}, error) { + value, ok := d.lru.Get(key) + if !ok { + return nil, errorx.KeyBaseIsNilErr() + } + + hashVal, ok := value.(structure.HashXInterface) + if !ok { + return nil, errorx.DaoTypeErr("setx") + } + + baseItem := hashVal.Key() + + // await 挂起 + return event2.EventAwaitFunc(func() (interface{}, error) { + setItem, err := mathSUnion(baseItem, setKey) + if err != nil { + return nil, err + } + + return &proto.SUnionResponse{Result: setItem}, nil + + }), nil +} + +func (d *Dao) SUnionStore(key *proto.BaseKey, setKey []string, saveKey string) (interface{}, error) { + value, ok := d.lru.Get(key) + if !ok { + return nil, errorx.KeyBaseIsNilErr() + } + + hashVal, ok := value.(structure.HashXInterface) + if !ok { + return nil, errorx.DaoTypeErr("setx") + } + + baseItem := hashVal.Key() + + // await 挂起 + return event2.EventAwaitFunc(func() (interface{}, error) { + setItem, err := mathSUnion(baseItem, setKey) + if err != nil { + return nil, err + } + + cli, err := external.NewGatewayClient() + if err != nil { + return nil, err + } + + ctx := context.Background() + _, err = cli.SAdd(ctx, &proto.SAddRequest{ + Key: proto.NewBaseKey(saveKey), + Member: setItem, + }) + + if err != nil { + return nil, err + } + + return &proto.SUnionStoreResponse{}, nil + }), nil +} + +func (d *Dao) SScan(key *proto.BaseKey, cursor int32, regex string, count int32) (*proto.SScanResponse, error) { + value, ok := d.lru.Get(key) + if !ok { + return nil, errorx.KeyBaseIsNilErr() + } + + hashVal, ok := value.(structure.HashXInterface) + if !ok { + return nil, errorx.DaoTypeErr("setx") + } + + result := hashVal.Range(int(cursor), int(count), regex) + return &proto.SScanResponse{Results: result}, nil }