From 6eec18030687131470317e06f1e8af419da791ca Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Tue, 21 Sep 2021 19:28:14 +0800 Subject: [PATCH] refactor(proto-file): resume file --- pkg/log/define.go | 1 + pkg/log/define/define.go | 1 - pkg/lru/define.go | 3 + pkg/lru/define/define.go | 3 - pkg/middle/define.go | 1 + pkg/middle/define/define.go | 1 - pkg/proto/base.pb.go | 166 ----------------- pkg/proto/storage.pb.go | 275 ---------------------------- pkg/proto/stringx.pb.go | 355 ------------------------------------ pkg/structure/define.go | 24 --- protobuf/base.proto | 2 +- protobuf/listx.proto | 7 - protobuf/storage.proto | 23 --- protobuf/stringx.proto | 28 --- 14 files changed, 6 insertions(+), 884 deletions(-) create mode 100644 pkg/log/define.go delete mode 100644 pkg/log/define/define.go create mode 100644 pkg/lru/define.go delete mode 100644 pkg/lru/define/define.go create mode 100644 pkg/middle/define.go delete mode 100644 pkg/middle/define/define.go delete mode 100644 pkg/proto/base.pb.go delete mode 100644 pkg/proto/storage.pb.go delete mode 100644 pkg/proto/stringx.pb.go delete mode 100644 protobuf/listx.proto delete mode 100644 protobuf/storage.proto delete mode 100644 protobuf/stringx.proto diff --git a/pkg/log/define.go b/pkg/log/define.go new file mode 100644 index 0000000..7330d54 --- /dev/null +++ b/pkg/log/define.go @@ -0,0 +1 @@ +package log diff --git a/pkg/log/define/define.go b/pkg/log/define/define.go deleted file mode 100644 index 57c3969..0000000 --- a/pkg/log/define/define.go +++ /dev/null @@ -1 +0,0 @@ -package define diff --git a/pkg/lru/define.go b/pkg/lru/define.go new file mode 100644 index 0000000..2eb64ef --- /dev/null +++ b/pkg/lru/define.go @@ -0,0 +1,3 @@ +package lru + +// define diff --git a/pkg/lru/define/define.go b/pkg/lru/define/define.go deleted file mode 100644 index 8c5bf99..0000000 --- a/pkg/lru/define/define.go +++ /dev/null @@ -1,3 +0,0 @@ -package define - -// define diff --git a/pkg/middle/define.go b/pkg/middle/define.go new file mode 100644 index 0000000..94eaada --- /dev/null +++ b/pkg/middle/define.go @@ -0,0 +1 @@ +package middle diff --git a/pkg/middle/define/define.go b/pkg/middle/define/define.go deleted file mode 100644 index 57c3969..0000000 --- a/pkg/middle/define/define.go +++ /dev/null @@ -1 +0,0 @@ -package define diff --git a/pkg/proto/base.pb.go b/pkg/proto/base.pb.go deleted file mode 100644 index 7e14747..0000000 --- a/pkg/proto/base.pb.go +++ /dev/null @@ -1,166 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.17.3 -// source: base.proto - -package proto - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - timestamppb "google.golang.org/protobuf/types/known/timestamppb" - 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 BaseKey struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Ttl int64 `protobuf:"varint,2,opt,name=ttl,proto3" json:"ttl,omitempty"` - Expire *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=expire,proto3" json:"expire,omitempty"` -} - -func (x *BaseKey) Reset() { - *x = BaseKey{} - if protoimpl.UnsafeEnabled { - mi := &file_base_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BaseKey) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BaseKey) ProtoMessage() {} - -func (x *BaseKey) ProtoReflect() protoreflect.Message { - mi := &file_base_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 BaseKey.ProtoReflect.Descriptor instead. -func (*BaseKey) Descriptor() ([]byte, []int) { - return file_base_proto_rawDescGZIP(), []int{0} -} - -func (x *BaseKey) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -func (x *BaseKey) GetTtl() int64 { - if x != nil { - return x.Ttl - } - return 0 -} - -func (x *BaseKey) GetExpire() *timestamppb.Timestamp { - if x != nil { - return x.Expire - } - return nil -} - -var File_base_proto protoreflect.FileDescriptor - -var file_base_proto_rawDesc = []byte{ - 0x0a, 0x0a, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x61, 0x0a, - 0x07, 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x74, - 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, 0x32, 0x0a, 0x06, - 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, -} - -var ( - file_base_proto_rawDescOnce sync.Once - file_base_proto_rawDescData = file_base_proto_rawDesc -) - -func file_base_proto_rawDescGZIP() []byte { - file_base_proto_rawDescOnce.Do(func() { - file_base_proto_rawDescData = protoimpl.X.CompressGZIP(file_base_proto_rawDescData) - }) - return file_base_proto_rawDescData -} - -var file_base_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_base_proto_goTypes = []interface{}{ - (*BaseKey)(nil), // 0: BaseKey - (*timestamppb.Timestamp)(nil), // 1: google.protobuf.Timestamp -} -var file_base_proto_depIdxs = []int32{ - 1, // 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 - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_base_proto_init() } -func file_base_proto_init() { - if File_base_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_base_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BaseKey); 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_base_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_base_proto_goTypes, - DependencyIndexes: file_base_proto_depIdxs, - MessageInfos: file_base_proto_msgTypes, - }.Build() - File_base_proto = out.File - file_base_proto_rawDesc = nil - file_base_proto_goTypes = nil - file_base_proto_depIdxs = nil -} diff --git a/pkg/proto/storage.pb.go b/pkg/proto/storage.pb.go deleted file mode 100644 index 219e2dc..0000000 --- a/pkg/proto/storage.pb.go +++ /dev/null @@ -1,275 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.17.3 -// source: storage.proto - -package proto - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - 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 CommendResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Result []string `protobuf:"bytes,1,rep,name=result,proto3" json:"result,omitempty"` -} - -func (x *CommendResponse) Reset() { - *x = CommendResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_storage_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CommendResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CommendResponse) ProtoMessage() {} - -func (x *CommendResponse) ProtoReflect() protoreflect.Message { - mi := &file_storage_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 CommendResponse.ProtoReflect.Descriptor instead. -func (*CommendResponse) Descriptor() ([]byte, []int) { - return file_storage_proto_rawDescGZIP(), []int{0} -} - -func (x *CommendResponse) GetResult() []string { - if x != nil { - return x.Result - } - return nil -} - -var File_storage_proto protoreflect.FileDescriptor - -var file_storage_proto_rawDesc = []byte{ - 0x0a, 0x0d, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x0d, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x29, - 0x0a, 0x0f, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x09, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x32, 0x58, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, - 0x6d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x24, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x0b, - 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x43, 0x6f, - 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, - 0x03, 0x53, 0x65, 0x74, 0x12, 0x0b, 0x2e, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x10, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 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_rawDescOnce sync.Once - file_storage_proto_rawDescData = file_storage_proto_rawDesc -) - -func file_storage_proto_rawDescGZIP() []byte { - file_storage_proto_rawDescOnce.Do(func() { - file_storage_proto_rawDescData = protoimpl.X.CompressGZIP(file_storage_proto_rawDescData) - }) - return file_storage_proto_rawDescData -} - -var file_storage_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_storage_proto_goTypes = []interface{}{ - (*CommendResponse)(nil), // 0: CommendResponse - (*GetRequest)(nil), // 1: GetRequest - (*SetRequest)(nil), // 2: SetRequest -} -var file_storage_proto_depIdxs = []int32{ - 1, // 0: CommServer.Get:input_type -> GetRequest - 2, // 1: CommServer.Set:input_type -> SetRequest - 0, // 2: CommServer.Get:output_type -> CommendResponse - 0, // 3: CommServer.Set:output_type -> CommendResponse - 2, // [2:4] is the sub-list for method output_type - 0, // [0:2] 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 -} - -func init() { file_storage_proto_init() } -func file_storage_proto_init() { - if File_storage_proto != nil { - return - } - file_stringx_proto_init() - if !protoimpl.UnsafeEnabled { - file_storage_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CommendResponse); 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_storage_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_storage_proto_goTypes, - DependencyIndexes: file_storage_proto_depIdxs, - MessageInfos: file_storage_proto_msgTypes, - }.Build() - File_storage_proto = out.File - file_storage_proto_rawDesc = nil - file_storage_proto_goTypes = nil - file_storage_proto_depIdxs = nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// CommServerClient is the client API for CommServer service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type CommServerClient interface { - Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*CommendResponse, error) - Set(ctx context.Context, in *SetRequest, opts ...grpc.CallOption) (*CommendResponse, error) -} - -type commServerClient struct { - cc grpc.ClientConnInterface -} - -func NewCommServerClient(cc grpc.ClientConnInterface) CommServerClient { - return &commServerClient{cc} -} - -func (c *commServerClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*CommendResponse, error) { - out := new(CommendResponse) - err := c.cc.Invoke(ctx, "/CommServer/Get", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *commServerClient) Set(ctx context.Context, in *SetRequest, opts ...grpc.CallOption) (*CommendResponse, error) { - out := new(CommendResponse) - err := c.cc.Invoke(ctx, "/CommServer/Set", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// CommServerServer is the server API for CommServer service. -type CommServerServer interface { - Get(context.Context, *GetRequest) (*CommendResponse, error) - Set(context.Context, *SetRequest) (*CommendResponse, error) -} - -// UnimplementedCommServerServer can be embedded to have forward compatible implementations. -type UnimplementedCommServerServer struct { -} - -func (*UnimplementedCommServerServer) Get(context.Context, *GetRequest) (*CommendResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Get not implemented") -} -func (*UnimplementedCommServerServer) Set(context.Context, *SetRequest) (*CommendResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Set not implemented") -} - -func RegisterCommServerServer(s *grpc.Server, srv CommServerServer) { - s.RegisterService(&_CommServer_serviceDesc, srv) -} - -func _CommServer_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CommServerServer).Get(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/CommServer/Get", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CommServerServer).Get(ctx, req.(*GetRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _CommServer_Set_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SetRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CommServerServer).Set(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/CommServer/Set", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CommServerServer).Set(ctx, req.(*SetRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _CommServer_serviceDesc = grpc.ServiceDesc{ - ServiceName: "CommServer", - HandlerType: (*CommServerServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Get", - Handler: _CommServer_Get_Handler, - }, - { - MethodName: "Set", - Handler: _CommServer_Set_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "storage.proto", -} diff --git a/pkg/proto/stringx.pb.go b/pkg/proto/stringx.pb.go deleted file mode 100644 index b9dad31..0000000 --- a/pkg/proto/stringx.pb.go +++ /dev/null @@ -1,355 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.17.3 -// source: stringx.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 SetRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *SetRequest) Reset() { - *x = SetRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_stringx_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SetRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SetRequest) ProtoMessage() {} - -func (x *SetRequest) ProtoReflect() protoreflect.Message { - mi := &file_stringx_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 SetRequest.ProtoReflect.Descriptor instead. -func (*SetRequest) Descriptor() ([]byte, []int) { - return file_stringx_proto_rawDescGZIP(), []int{0} -} - -func (x *SetRequest) GetKey() *BaseKey { - if x != nil { - return x.Key - } - return nil -} - -func (x *SetRequest) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -type GetRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` -} - -func (x *GetRequest) Reset() { - *x = GetRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_stringx_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetRequest) ProtoMessage() {} - -func (x *GetRequest) ProtoReflect() protoreflect.Message { - mi := &file_stringx_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 GetRequest.ProtoReflect.Descriptor instead. -func (*GetRequest) Descriptor() ([]byte, []int) { - return file_stringx_proto_rawDescGZIP(), []int{1} -} - -func (x *GetRequest) GetKey() *BaseKey { - if x != nil { - return x.Key - } - return nil -} - -type AddRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value int64 `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *AddRequest) Reset() { - *x = AddRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_stringx_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AddRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddRequest) ProtoMessage() {} - -func (x *AddRequest) ProtoReflect() protoreflect.Message { - mi := &file_stringx_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 AddRequest.ProtoReflect.Descriptor instead. -func (*AddRequest) Descriptor() ([]byte, []int) { - return file_stringx_proto_rawDescGZIP(), []int{2} -} - -func (x *AddRequest) GetKey() *BaseKey { - if x != nil { - return x.Key - } - return nil -} - -func (x *AddRequest) GetValue() int64 { - if x != nil { - return x.Value - } - return 0 -} - -type RedceRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` -} - -func (x *RedceRequest) Reset() { - *x = RedceRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_stringx_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RedceRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RedceRequest) ProtoMessage() {} - -func (x *RedceRequest) ProtoReflect() protoreflect.Message { - mi := &file_stringx_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 RedceRequest.ProtoReflect.Descriptor instead. -func (*RedceRequest) Descriptor() ([]byte, []int) { - return file_stringx_proto_rawDescGZIP(), []int{3} -} - -func (x *RedceRequest) GetKey() *BaseKey { - if x != nil { - return x.Key - } - return nil -} - -var File_stringx_proto protoreflect.FileDescriptor - -var file_stringx_proto_rawDesc = []byte{ - 0x0a, 0x0d, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x0a, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3e, 0x0a, 0x0a, 0x53, - 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x03, 0x6b, 0x65, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, - 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x28, 0x0a, 0x0a, 0x47, - 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x03, 0x6b, 0x65, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, - 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x3e, 0x0a, 0x0a, 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, - 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x2a, 0x0a, 0x0c, 0x52, 0x65, 0x64, 0x63, 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, 0x42, 0x0b, 0x5a, 0x09, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_stringx_proto_rawDescOnce sync.Once - file_stringx_proto_rawDescData = file_stringx_proto_rawDesc -) - -func file_stringx_proto_rawDescGZIP() []byte { - file_stringx_proto_rawDescOnce.Do(func() { - file_stringx_proto_rawDescData = protoimpl.X.CompressGZIP(file_stringx_proto_rawDescData) - }) - return file_stringx_proto_rawDescData -} - -var file_stringx_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_stringx_proto_goTypes = []interface{}{ - (*SetRequest)(nil), // 0: SetRequest - (*GetRequest)(nil), // 1: GetRequest - (*AddRequest)(nil), // 2: AddRequest - (*RedceRequest)(nil), // 3: RedceRequest - (*BaseKey)(nil), // 4: BaseKey -} -var file_stringx_proto_depIdxs = []int32{ - 4, // 0: SetRequest.key:type_name -> BaseKey - 4, // 1: GetRequest.key:type_name -> BaseKey - 4, // 2: AddRequest.key:type_name -> BaseKey - 4, // 3: RedceRequest.key:type_name -> BaseKey - 4, // [4:4] is the sub-list for method output_type - 4, // [4:4] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name -} - -func init() { file_stringx_proto_init() } -func file_stringx_proto_init() { - if File_stringx_proto != nil { - return - } - file_base_proto_init() - if !protoimpl.UnsafeEnabled { - file_stringx_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SetRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_stringx_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_stringx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_stringx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RedceRequest); 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_stringx_proto_rawDesc, - NumEnums: 0, - NumMessages: 4, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_stringx_proto_goTypes, - DependencyIndexes: file_stringx_proto_depIdxs, - MessageInfos: file_stringx_proto_msgTypes, - }.Build() - File_stringx_proto = out.File - file_stringx_proto_rawDesc = nil - file_stringx_proto_goTypes = nil - file_stringx_proto_depIdxs = nil -} diff --git a/pkg/structure/define.go b/pkg/structure/define.go index 0f37810..d0d30e7 100644 --- a/pkg/structure/define.go +++ b/pkg/structure/define.go @@ -1,27 +1,3 @@ package structure -type KeyBase struct { -} -func (k *KeyBase) SizeByte() int64 { - panic("not implemented") // TODO: Implement -} - -// TODO RollBack 事务相关, V2 实现 -func (k *KeyBase) RollBack() error { - panic("not implemented") // TODO: Implement -} - -// Begin 事务相关, V2 实现 -func (k *KeyBase) Begin() error { - panic("not implemented") // TODO: Implement -} - -// Comment 事务相关, V2 实现 -func (k *KeyBase) Comment() error { - panic("not implemented") // TODO: Implement -} - -func (k *KeyBase) Encode() ([]byte, error) { - panic("not implemented") // TODO: Implement -} diff --git a/protobuf/base.proto b/protobuf/base.proto index 451bcb2..4d0fd56 100644 --- a/protobuf/base.proto +++ b/protobuf/base.proto @@ -6,5 +6,5 @@ import "google/protobuf/timestamp.proto"; message BaseKey { string key = 1; int64 ttl = 2; - google.protobuf.Timestamp expire = 3; + google.protobuf.Timestamp expire = 3; } \ No newline at end of file diff --git a/protobuf/listx.proto b/protobuf/listx.proto deleted file mode 100644 index 4305a13..0000000 --- a/protobuf/listx.proto +++ /dev/null @@ -1,7 +0,0 @@ -syntax = "proto3"; -import "base.proto"; -option go_package = "pkg/proto"; - -message SetRequest { - BaseKey key = 1; -} \ No newline at end of file diff --git a/protobuf/storage.proto b/protobuf/storage.proto deleted file mode 100644 index 634266f..0000000 --- a/protobuf/storage.proto +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by gen-struct. DO NOT EDIT. -// make gen-protobuf generated - -syntax = "proto3"; - -option go_package = "pkg/proto"; - -import "stringx.proto"; -import "listx.proto"; - -message CommendResponse { - repeated string result = 1; -} - -service CommServer { - rpc Set (SetRequest) returns (CommendResponse); - rpc Get (GetRequest) returns (CommendResponse); - rpc Add (AddRequest) returns (CommendResponse); - rpc Reduce (ReduceRequest) returns (CommendResponse); - rpc Setbit (SetbitRequest) returns (CommendResponse); - rpc Getbit (GetbitRequest) returns (CommendResponse); - rpc Set (SetRequest) returns (CommendResponse); -} \ No newline at end of file diff --git a/protobuf/stringx.proto b/protobuf/stringx.proto deleted file mode 100644 index f6ac035..0000000 --- a/protobuf/stringx.proto +++ /dev/null @@ -1,28 +0,0 @@ -syntax = "proto3"; -import "base.proto"; -option go_package = "pkg/proto"; - -message SetRequest { - BaseKey key = 1; - string value = 2; -} - -message GetRequest { - BaseKey key = 1; -} - -message AddRequest { - BaseKey key = 1; -} - -message ReduceRequest { - BaseKey key = 1; -} - -message SetbitRequest { - BaseKey key = 1; -} - -message GetbitRequest { - BaseKey key = 1; -}