diff --git a/pkg/proto/storage.pb.go b/pkg/proto/storage.pb.go index 45396a4..1a68965 100644 --- a/pkg/proto/storage.pb.go +++ b/pkg/proto/storage.pb.go @@ -17,7 +17,6 @@ import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" - sync "sync" ) const ( @@ -27,121 +26,62 @@ const ( _ = 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, 0x82, 0x02, 0x0a, 0x0a, 0x43, 0x6f, - 0x6d, 0x6d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 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, 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, 0x41, 0x64, 0x64, 0x12, 0x0b, 0x2e, 0x41, 0x64, - 0x64, 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, 0x2a, 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, 0x10, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x06, 0x53, 0x65, 0x74, 0x62, 0x69, 0x74, - 0x12, 0x0e, 0x2e, 0x53, 0x65, 0x74, 0x62, 0x69, 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, 0x2a, 0x0a, 0x06, 0x47, 0x65, 0x74, 0x62, 0x69, 0x74, 0x12, 0x0e, 0x2e, 0x47, - 0x65, 0x74, 0x62, 0x69, 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, + 0x0d, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xf3, + 0x01, 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, 0x62, 0x69, 0x74, 0x12, 0x0e, 0x2e, 0x53, 0x65, 0x74, 0x62, 0x69, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x53, 0x65, 0x74, 0x62, 0x69, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x47, 0x65, 0x74, + 0x62, 0x69, 0x74, 0x12, 0x0e, 0x2e, 0x47, 0x65, 0x74, 0x62, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x47, 0x65, 0x74, 0x62, 0x69, 0x74, 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 - (*SetRequest)(nil), // 1: SetRequest - (*GetRequest)(nil), // 2: GetRequest - (*AddRequest)(nil), // 3: AddRequest - (*ReduceRequest)(nil), // 4: ReduceRequest - (*SetbitRequest)(nil), // 5: SetbitRequest - (*GetbitRequest)(nil), // 6: GetbitRequest + (*SetRequest)(nil), // 0: SetRequest + (*GetRequest)(nil), // 1: GetRequest + (*AddRequest)(nil), // 2: AddRequest + (*ReduceRequest)(nil), // 3: ReduceRequest + (*SetbitRequest)(nil), // 4: SetbitRequest + (*GetbitRequest)(nil), // 5: GetbitRequest + (*SetResponse)(nil), // 6: SetResponse + (*GetResponse)(nil), // 7: GetResponse + (*AddResponse)(nil), // 8: AddResponse + (*ReduceResponse)(nil), // 9: ReduceResponse + (*SetbitResponse)(nil), // 10: SetbitResponse + (*GetbitResponse)(nil), // 11: GetbitResponse } var file_storage_proto_depIdxs = []int32{ - 1, // 0: CommServer.Set:input_type -> SetRequest - 2, // 1: CommServer.Get:input_type -> GetRequest - 3, // 2: CommServer.Add:input_type -> AddRequest - 4, // 3: CommServer.Reduce:input_type -> ReduceRequest - 5, // 4: CommServer.Setbit:input_type -> SetbitRequest - 6, // 5: CommServer.Getbit:input_type -> GetbitRequest - 0, // 6: CommServer.Set:output_type -> CommendResponse - 0, // 7: CommServer.Get:output_type -> CommendResponse - 0, // 8: CommServer.Add:output_type -> CommendResponse - 0, // 9: CommServer.Reduce:output_type -> CommendResponse - 0, // 10: CommServer.Setbit:output_type -> CommendResponse - 0, // 11: CommServer.Getbit:output_type -> CommendResponse - 6, // [6:12] is the sub-list for method output_type - 0, // [0:6] 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 + 0, // 0: CommServer.Set:input_type -> SetRequest + 1, // 1: CommServer.Get:input_type -> GetRequest + 2, // 2: CommServer.Add:input_type -> AddRequest + 3, // 3: CommServer.Reduce:input_type -> ReduceRequest + 4, // 4: CommServer.Setbit:input_type -> SetbitRequest + 5, // 5: CommServer.Getbit:input_type -> GetbitRequest + 6, // 6: CommServer.Set:output_type -> SetResponse + 7, // 7: CommServer.Get:output_type -> GetResponse + 8, // 8: CommServer.Add:output_type -> AddResponse + 9, // 9: CommServer.Reduce:output_type -> ReduceResponse + 10, // 10: CommServer.Setbit:output_type -> SetbitResponse + 11, // 11: CommServer.Getbit:output_type -> GetbitResponse + 6, // [6:12] is the sub-list for method output_type + 0, // [0:6] 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() } @@ -150,33 +90,18 @@ func file_storage_proto_init() { 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, + NumMessages: 0, 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 @@ -196,12 +121,12 @@ const _ = grpc.SupportPackageIsVersion6 // // 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 { - Set(ctx context.Context, in *SetRequest, opts ...grpc.CallOption) (*CommendResponse, error) - Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*CommendResponse, error) - Add(ctx context.Context, in *AddRequest, opts ...grpc.CallOption) (*CommendResponse, error) - Reduce(ctx context.Context, in *ReduceRequest, opts ...grpc.CallOption) (*CommendResponse, error) - Setbit(ctx context.Context, in *SetbitRequest, opts ...grpc.CallOption) (*CommendResponse, error) - Getbit(ctx context.Context, in *GetbitRequest, opts ...grpc.CallOption) (*CommendResponse, error) + Set(ctx context.Context, in *SetRequest, opts ...grpc.CallOption) (*SetResponse, error) + Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) + Add(ctx context.Context, in *AddRequest, opts ...grpc.CallOption) (*AddResponse, error) + Reduce(ctx context.Context, in *ReduceRequest, opts ...grpc.CallOption) (*ReduceResponse, error) + Setbit(ctx context.Context, in *SetbitRequest, opts ...grpc.CallOption) (*SetbitResponse, error) + Getbit(ctx context.Context, in *GetbitRequest, opts ...grpc.CallOption) (*GetbitResponse, error) } type commServerClient struct { @@ -212,8 +137,8 @@ func NewCommServerClient(cc grpc.ClientConnInterface) CommServerClient { return &commServerClient{cc} } -func (c *commServerClient) Set(ctx context.Context, in *SetRequest, opts ...grpc.CallOption) (*CommendResponse, error) { - out := new(CommendResponse) +func (c *commServerClient) Set(ctx context.Context, in *SetRequest, opts ...grpc.CallOption) (*SetResponse, error) { + out := new(SetResponse) err := c.cc.Invoke(ctx, "/CommServer/Set", in, out, opts...) if err != nil { return nil, err @@ -221,8 +146,8 @@ func (c *commServerClient) Set(ctx context.Context, in *SetRequest, opts ...grpc return out, nil } -func (c *commServerClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*CommendResponse, error) { - out := new(CommendResponse) +func (c *commServerClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) { + out := new(GetResponse) err := c.cc.Invoke(ctx, "/CommServer/Get", in, out, opts...) if err != nil { return nil, err @@ -230,8 +155,8 @@ func (c *commServerClient) Get(ctx context.Context, in *GetRequest, opts ...grpc return out, nil } -func (c *commServerClient) Add(ctx context.Context, in *AddRequest, opts ...grpc.CallOption) (*CommendResponse, error) { - out := new(CommendResponse) +func (c *commServerClient) Add(ctx context.Context, in *AddRequest, opts ...grpc.CallOption) (*AddResponse, error) { + out := new(AddResponse) err := c.cc.Invoke(ctx, "/CommServer/Add", in, out, opts...) if err != nil { return nil, err @@ -239,8 +164,8 @@ func (c *commServerClient) Add(ctx context.Context, in *AddRequest, opts ...grpc return out, nil } -func (c *commServerClient) Reduce(ctx context.Context, in *ReduceRequest, opts ...grpc.CallOption) (*CommendResponse, error) { - out := new(CommendResponse) +func (c *commServerClient) Reduce(ctx context.Context, in *ReduceRequest, opts ...grpc.CallOption) (*ReduceResponse, error) { + out := new(ReduceResponse) err := c.cc.Invoke(ctx, "/CommServer/Reduce", in, out, opts...) if err != nil { return nil, err @@ -248,8 +173,8 @@ func (c *commServerClient) Reduce(ctx context.Context, in *ReduceRequest, opts . return out, nil } -func (c *commServerClient) Setbit(ctx context.Context, in *SetbitRequest, opts ...grpc.CallOption) (*CommendResponse, error) { - out := new(CommendResponse) +func (c *commServerClient) Setbit(ctx context.Context, in *SetbitRequest, opts ...grpc.CallOption) (*SetbitResponse, error) { + out := new(SetbitResponse) err := c.cc.Invoke(ctx, "/CommServer/Setbit", in, out, opts...) if err != nil { return nil, err @@ -257,8 +182,8 @@ func (c *commServerClient) Setbit(ctx context.Context, in *SetbitRequest, opts . return out, nil } -func (c *commServerClient) Getbit(ctx context.Context, in *GetbitRequest, opts ...grpc.CallOption) (*CommendResponse, error) { - out := new(CommendResponse) +func (c *commServerClient) Getbit(ctx context.Context, in *GetbitRequest, opts ...grpc.CallOption) (*GetbitResponse, error) { + out := new(GetbitResponse) err := c.cc.Invoke(ctx, "/CommServer/Getbit", in, out, opts...) if err != nil { return nil, err @@ -268,34 +193,34 @@ func (c *commServerClient) Getbit(ctx context.Context, in *GetbitRequest, opts . // CommServerServer is the server API for CommServer service. type CommServerServer interface { - Set(context.Context, *SetRequest) (*CommendResponse, error) - Get(context.Context, *GetRequest) (*CommendResponse, error) - Add(context.Context, *AddRequest) (*CommendResponse, error) - Reduce(context.Context, *ReduceRequest) (*CommendResponse, error) - Setbit(context.Context, *SetbitRequest) (*CommendResponse, error) - Getbit(context.Context, *GetbitRequest) (*CommendResponse, error) + Set(context.Context, *SetRequest) (*SetResponse, error) + Get(context.Context, *GetRequest) (*GetResponse, error) + Add(context.Context, *AddRequest) (*AddResponse, error) + Reduce(context.Context, *ReduceRequest) (*ReduceResponse, error) + Setbit(context.Context, *SetbitRequest) (*SetbitResponse, error) + Getbit(context.Context, *GetbitRequest) (*GetbitResponse, error) } // UnimplementedCommServerServer can be embedded to have forward compatible implementations. type UnimplementedCommServerServer struct { } -func (*UnimplementedCommServerServer) Set(context.Context, *SetRequest) (*CommendResponse, error) { +func (*UnimplementedCommServerServer) Set(context.Context, *SetRequest) (*SetResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Set not implemented") } -func (*UnimplementedCommServerServer) Get(context.Context, *GetRequest) (*CommendResponse, error) { +func (*UnimplementedCommServerServer) Get(context.Context, *GetRequest) (*GetResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Get not implemented") } -func (*UnimplementedCommServerServer) Add(context.Context, *AddRequest) (*CommendResponse, error) { +func (*UnimplementedCommServerServer) Add(context.Context, *AddRequest) (*AddResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Add not implemented") } -func (*UnimplementedCommServerServer) Reduce(context.Context, *ReduceRequest) (*CommendResponse, error) { +func (*UnimplementedCommServerServer) Reduce(context.Context, *ReduceRequest) (*ReduceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Reduce not implemented") } -func (*UnimplementedCommServerServer) Setbit(context.Context, *SetbitRequest) (*CommendResponse, error) { +func (*UnimplementedCommServerServer) Setbit(context.Context, *SetbitRequest) (*SetbitResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Setbit not implemented") } -func (*UnimplementedCommServerServer) Getbit(context.Context, *GetbitRequest) (*CommendResponse, error) { +func (*UnimplementedCommServerServer) Getbit(context.Context, *GetbitRequest) (*GetbitResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Getbit not implemented") } diff --git a/pkg/proto/stringx.pb.go b/pkg/proto/stringx.pb.go index 07b5ab7..03461ce 100644 --- a/pkg/proto/stringx.pb.go +++ b/pkg/proto/stringx.pb.go @@ -75,6 +75,61 @@ func (x *SetRequest) GetVal() string { return "" } +type SetResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UpdateSize int64 `protobuf:"varint,1,opt,name=update_size,json=updateSize,proto3" json:"update_size,omitempty"` + Result string `protobuf:"bytes,2,opt,name=result,proto3" json:"result,omitempty"` +} + +func (x *SetResponse) Reset() { + *x = SetResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_stringx_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SetResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetResponse) ProtoMessage() {} + +func (x *SetResponse) 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 SetResponse.ProtoReflect.Descriptor instead. +func (*SetResponse) Descriptor() ([]byte, []int) { + return file_stringx_proto_rawDescGZIP(), []int{1} +} + +func (x *SetResponse) GetUpdateSize() int64 { + if x != nil { + return x.UpdateSize + } + return 0 +} + +func (x *SetResponse) GetResult() string { + if x != nil { + return x.Result + } + return "" +} + type GetRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -86,7 +141,7 @@ type GetRequest struct { func (x *GetRequest) Reset() { *x = GetRequest{} if protoimpl.UnsafeEnabled { - mi := &file_stringx_proto_msgTypes[1] + mi := &file_stringx_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -99,7 +154,7 @@ func (x *GetRequest) String() string { func (*GetRequest) ProtoMessage() {} func (x *GetRequest) ProtoReflect() protoreflect.Message { - mi := &file_stringx_proto_msgTypes[1] + mi := &file_stringx_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -112,7 +167,7 @@ func (x *GetRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetRequest.ProtoReflect.Descriptor instead. func (*GetRequest) Descriptor() ([]byte, []int) { - return file_stringx_proto_rawDescGZIP(), []int{1} + return file_stringx_proto_rawDescGZIP(), []int{2} } func (x *GetRequest) GetKey() *BaseKey { @@ -122,20 +177,74 @@ func (x *GetRequest) GetKey() *BaseKey { return nil } +type GetResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UpdateSize int64 `protobuf:"varint,1,opt,name=update_size,json=updateSize,proto3" json:"update_size,omitempty"` + Result string `protobuf:"bytes,2,opt,name=result,proto3" json:"result,omitempty"` +} + +func (x *GetResponse) Reset() { + *x = GetResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_stringx_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetResponse) ProtoMessage() {} + +func (x *GetResponse) 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 GetResponse.ProtoReflect.Descriptor instead. +func (*GetResponse) Descriptor() ([]byte, []int) { + return file_stringx_proto_rawDescGZIP(), []int{3} +} + +func (x *GetResponse) GetUpdateSize() int64 { + if x != nil { + return x.UpdateSize + } + return 0 +} + +func (x *GetResponse) GetResult() string { + if x != nil { + return x.Result + } + return "" +} + type AddRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // 自动增加 - Raise int32 `protobuf:"varint,2,opt,name=raise,proto3" json:"raise,omitempty"` + Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Renewal int32 `protobuf:"varint,2,opt,name=renewal,proto3" json:"renewal,omitempty"` } func (x *AddRequest) Reset() { *x = AddRequest{} if protoimpl.UnsafeEnabled { - mi := &file_stringx_proto_msgTypes[2] + mi := &file_stringx_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -148,7 +257,7 @@ func (x *AddRequest) String() string { func (*AddRequest) ProtoMessage() {} func (x *AddRequest) ProtoReflect() protoreflect.Message { - mi := &file_stringx_proto_msgTypes[2] + mi := &file_stringx_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -161,7 +270,7 @@ func (x *AddRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AddRequest.ProtoReflect.Descriptor instead. func (*AddRequest) Descriptor() ([]byte, []int) { - return file_stringx_proto_rawDescGZIP(), []int{2} + return file_stringx_proto_rawDescGZIP(), []int{4} } func (x *AddRequest) GetKey() *BaseKey { @@ -171,26 +280,81 @@ func (x *AddRequest) GetKey() *BaseKey { return nil } -func (x *AddRequest) GetRaise() int32 { +func (x *AddRequest) GetRenewal() int32 { if x != nil { - return x.Raise + return x.Renewal } return 0 } +type AddResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UpdateSize int64 `protobuf:"varint,1,opt,name=update_size,json=updateSize,proto3" json:"update_size,omitempty"` + Result string `protobuf:"bytes,2,opt,name=result,proto3" json:"result,omitempty"` +} + +func (x *AddResponse) Reset() { + *x = AddResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_stringx_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddResponse) ProtoMessage() {} + +func (x *AddResponse) ProtoReflect() protoreflect.Message { + mi := &file_stringx_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 AddResponse.ProtoReflect.Descriptor instead. +func (*AddResponse) Descriptor() ([]byte, []int) { + return file_stringx_proto_rawDescGZIP(), []int{5} +} + +func (x *AddResponse) GetUpdateSize() int64 { + if x != nil { + return x.UpdateSize + } + return 0 +} + +func (x *AddResponse) GetResult() string { + if x != nil { + return x.Result + } + return "" +} + type ReduceRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Cut int32 `protobuf:"varint,2,opt,name=cut,proto3" json:"cut,omitempty"` + Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Renewal int32 `protobuf:"varint,2,opt,name=renewal,proto3" json:"renewal,omitempty"` } func (x *ReduceRequest) Reset() { *x = ReduceRequest{} if protoimpl.UnsafeEnabled { - mi := &file_stringx_proto_msgTypes[3] + mi := &file_stringx_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -203,7 +367,7 @@ func (x *ReduceRequest) String() string { func (*ReduceRequest) ProtoMessage() {} func (x *ReduceRequest) ProtoReflect() protoreflect.Message { - mi := &file_stringx_proto_msgTypes[3] + mi := &file_stringx_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -216,7 +380,7 @@ func (x *ReduceRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ReduceRequest.ProtoReflect.Descriptor instead. func (*ReduceRequest) Descriptor() ([]byte, []int) { - return file_stringx_proto_rawDescGZIP(), []int{3} + return file_stringx_proto_rawDescGZIP(), []int{6} } func (x *ReduceRequest) GetKey() *BaseKey { @@ -226,27 +390,82 @@ func (x *ReduceRequest) GetKey() *BaseKey { return nil } -func (x *ReduceRequest) GetCut() int32 { +func (x *ReduceRequest) GetRenewal() int32 { if x != nil { - return x.Cut + return x.Renewal } return 0 } +type ReduceResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UpdateSize int64 `protobuf:"varint,1,opt,name=update_size,json=updateSize,proto3" json:"update_size,omitempty"` + Result string `protobuf:"bytes,2,opt,name=result,proto3" json:"result,omitempty"` +} + +func (x *ReduceResponse) Reset() { + *x = ReduceResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_stringx_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ReduceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReduceResponse) ProtoMessage() {} + +func (x *ReduceResponse) ProtoReflect() protoreflect.Message { + mi := &file_stringx_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 ReduceResponse.ProtoReflect.Descriptor instead. +func (*ReduceResponse) Descriptor() ([]byte, []int) { + return file_stringx_proto_rawDescGZIP(), []int{7} +} + +func (x *ReduceResponse) GetUpdateSize() int64 { + if x != nil { + return x.UpdateSize + } + return 0 +} + +func (x *ReduceResponse) GetResult() string { + if x != nil { + return x.Result + } + return "" +} + type SetbitRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Office int32 `protobuf:"varint,2,opt,name=office,proto3" json:"office,omitempty"` - Val bool `protobuf:"varint,3,opt,name=val,proto3" json:"val,omitempty"` + Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Val bool `protobuf:"varint,2,opt,name=val,proto3" json:"val,omitempty"` + Offer int32 `protobuf:"varint,3,opt,name=offer,proto3" json:"offer,omitempty"` } func (x *SetbitRequest) Reset() { *x = SetbitRequest{} if protoimpl.UnsafeEnabled { - mi := &file_stringx_proto_msgTypes[4] + mi := &file_stringx_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -259,7 +478,7 @@ func (x *SetbitRequest) String() string { func (*SetbitRequest) ProtoMessage() {} func (x *SetbitRequest) ProtoReflect() protoreflect.Message { - mi := &file_stringx_proto_msgTypes[4] + mi := &file_stringx_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -272,7 +491,7 @@ func (x *SetbitRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SetbitRequest.ProtoReflect.Descriptor instead. func (*SetbitRequest) Descriptor() ([]byte, []int) { - return file_stringx_proto_rawDescGZIP(), []int{4} + return file_stringx_proto_rawDescGZIP(), []int{8} } func (x *SetbitRequest) GetKey() *BaseKey { @@ -282,13 +501,6 @@ func (x *SetbitRequest) GetKey() *BaseKey { return nil } -func (x *SetbitRequest) GetOffice() int32 { - if x != nil { - return x.Office - } - return 0 -} - func (x *SetbitRequest) GetVal() bool { if x != nil { return x.Val @@ -296,19 +508,73 @@ func (x *SetbitRequest) GetVal() bool { return false } +func (x *SetbitRequest) GetOffer() int32 { + if x != nil { + return x.Offer + } + return 0 +} + +type SetbitResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UpdateSize int64 `protobuf:"varint,1,opt,name=update_size,json=updateSize,proto3" json:"update_size,omitempty"` +} + +func (x *SetbitResponse) Reset() { + *x = SetbitResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_stringx_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SetbitResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetbitResponse) ProtoMessage() {} + +func (x *SetbitResponse) ProtoReflect() protoreflect.Message { + mi := &file_stringx_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 SetbitResponse.ProtoReflect.Descriptor instead. +func (*SetbitResponse) Descriptor() ([]byte, []int) { + return file_stringx_proto_rawDescGZIP(), []int{9} +} + +func (x *SetbitResponse) GetUpdateSize() int64 { + if x != nil { + return x.UpdateSize + } + return 0 +} + type GetbitRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Office int32 `protobuf:"varint,2,opt,name=office,proto3" json:"office,omitempty"` + Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Offer int32 `protobuf:"varint,3,opt,name=offer,proto3" json:"offer,omitempty"` } func (x *GetbitRequest) Reset() { *x = GetbitRequest{} if protoimpl.UnsafeEnabled { - mi := &file_stringx_proto_msgTypes[5] + mi := &file_stringx_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -321,7 +587,7 @@ func (x *GetbitRequest) String() string { func (*GetbitRequest) ProtoMessage() {} func (x *GetbitRequest) ProtoReflect() protoreflect.Message { - mi := &file_stringx_proto_msgTypes[5] + mi := &file_stringx_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -334,7 +600,7 @@ func (x *GetbitRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetbitRequest.ProtoReflect.Descriptor instead. func (*GetbitRequest) Descriptor() ([]byte, []int) { - return file_stringx_proto_rawDescGZIP(), []int{5} + return file_stringx_proto_rawDescGZIP(), []int{10} } func (x *GetbitRequest) GetKey() *BaseKey { @@ -344,13 +610,68 @@ func (x *GetbitRequest) GetKey() *BaseKey { return nil } -func (x *GetbitRequest) GetOffice() int32 { +func (x *GetbitRequest) GetOffer() int32 { if x != nil { - return x.Office + return x.Offer } return 0 } +type GetbitResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UpdateSize int64 `protobuf:"varint,1,opt,name=update_size,json=updateSize,proto3" json:"update_size,omitempty"` + Val bool `protobuf:"varint,2,opt,name=val,proto3" json:"val,omitempty"` +} + +func (x *GetbitResponse) Reset() { + *x = GetbitResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_stringx_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetbitResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetbitResponse) ProtoMessage() {} + +func (x *GetbitResponse) ProtoReflect() protoreflect.Message { + mi := &file_stringx_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 GetbitResponse.ProtoReflect.Descriptor instead. +func (*GetbitResponse) Descriptor() ([]byte, []int) { + return file_stringx_proto_rawDescGZIP(), []int{11} +} + +func (x *GetbitResponse) GetUpdateSize() int64 { + if x != nil { + return x.UpdateSize + } + return 0 +} + +func (x *GetbitResponse) GetVal() bool { + if x != nil { + return x.Val + } + return false +} + var File_stringx_proto protoreflect.FileDescriptor var file_stringx_proto_rawDesc = []byte{ @@ -359,29 +680,55 @@ var file_stringx_proto_rawDesc = []byte{ 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, 0x10, 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x76, 0x61, 0x6c, 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, + 0x28, 0x09, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x22, 0x46, 0x0a, 0x0b, 0x53, 0x65, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x75, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 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, 0x46, 0x0a, 0x0b, 0x47, 0x65, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x75, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x22, 0x42, 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, 0x72, - 0x61, 0x69, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x61, 0x69, 0x73, - 0x65, 0x22, 0x3d, 0x0a, 0x0d, 0x52, 0x65, 0x64, 0x75, 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, 0x12, 0x10, - 0x0a, 0x03, 0x63, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x63, 0x75, 0x74, - 0x22, 0x55, 0x0a, 0x0d, 0x53, 0x65, 0x74, 0x62, 0x69, 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, 0x16, 0x0a, - 0x06, 0x6f, 0x66, 0x66, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6f, - 0x66, 0x66, 0x69, 0x63, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x22, 0x43, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x62, 0x69, + 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x72, + 0x65, 0x6e, 0x65, 0x77, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x65, + 0x6e, 0x65, 0x77, 0x61, 0x6c, 0x22, 0x46, 0x0a, 0x0b, 0x41, 0x64, 0x64, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x73, + 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x45, 0x0a, + 0x0d, 0x52, 0x65, 0x64, 0x75, 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, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, + 0x6e, 0x65, 0x77, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x65, 0x6e, + 0x65, 0x77, 0x61, 0x6c, 0x22, 0x49, 0x0a, 0x0e, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x75, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, + 0x53, 0x0a, 0x0d, 0x53, 0x65, 0x74, 0x62, 0x69, 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, 0x10, 0x0a, 0x03, + 0x76, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x12, 0x14, + 0x0a, 0x05, 0x6f, 0x66, 0x66, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6f, + 0x66, 0x66, 0x65, 0x72, 0x22, 0x31, 0x0a, 0x0e, 0x53, 0x65, 0x74, 0x62, 0x69, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x75, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x22, 0x41, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x62, 0x69, 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, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x69, 0x63, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x69, 0x63, 0x65, 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, 0x14, 0x0a, 0x05, 0x6f, 0x66, 0x66, 0x65, 0x72, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x05, 0x6f, 0x66, 0x66, 0x65, 0x72, 0x22, 0x43, 0x0a, 0x0e, 0x47, 0x65, + 0x74, 0x62, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x0b, + 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x10, 0x0a, + 0x03, 0x76, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x42, + 0x0b, 0x5a, 0x09, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -396,28 +743,34 @@ func file_stringx_proto_rawDescGZIP() []byte { return file_stringx_proto_rawDescData } -var file_stringx_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_stringx_proto_msgTypes = make([]protoimpl.MessageInfo, 12) var file_stringx_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 - (*BaseKey)(nil), // 6: BaseKey + (*SetRequest)(nil), // 0: SetRequest + (*SetResponse)(nil), // 1: SetResponse + (*GetRequest)(nil), // 2: GetRequest + (*GetResponse)(nil), // 3: GetResponse + (*AddRequest)(nil), // 4: AddRequest + (*AddResponse)(nil), // 5: AddResponse + (*ReduceRequest)(nil), // 6: ReduceRequest + (*ReduceResponse)(nil), // 7: ReduceResponse + (*SetbitRequest)(nil), // 8: SetbitRequest + (*SetbitResponse)(nil), // 9: SetbitResponse + (*GetbitRequest)(nil), // 10: GetbitRequest + (*GetbitResponse)(nil), // 11: GetbitResponse + (*BaseKey)(nil), // 12: BaseKey } var file_stringx_proto_depIdxs = []int32{ - 6, // 0: SetRequest.key:type_name -> BaseKey - 6, // 1: GetRequest.key:type_name -> BaseKey - 6, // 2: AddRequest.key:type_name -> BaseKey - 6, // 3: ReduceRequest.key:type_name -> BaseKey - 6, // 4: SetbitRequest.key:type_name -> BaseKey - 6, // 5: GetbitRequest.key:type_name -> BaseKey - 6, // [6:6] is the sub-list for method output_type - 6, // [6:6] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name + 12, // 0: SetRequest.key:type_name -> BaseKey + 12, // 1: GetRequest.key:type_name -> BaseKey + 12, // 2: AddRequest.key:type_name -> BaseKey + 12, // 3: ReduceRequest.key:type_name -> BaseKey + 12, // 4: SetbitRequest.key:type_name -> BaseKey + 12, // 5: GetbitRequest.key:type_name -> BaseKey + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name } func init() { file_stringx_proto_init() } @@ -440,7 +793,7 @@ func file_stringx_proto_init() { } } file_stringx_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetRequest); i { + switch v := v.(*SetResponse); i { case 0: return &v.state case 1: @@ -452,7 +805,7 @@ func file_stringx_proto_init() { } } file_stringx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddRequest); i { + switch v := v.(*GetRequest); i { case 0: return &v.state case 1: @@ -464,7 +817,7 @@ func file_stringx_proto_init() { } } file_stringx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReduceRequest); i { + switch v := v.(*GetResponse); i { case 0: return &v.state case 1: @@ -476,7 +829,7 @@ func file_stringx_proto_init() { } } file_stringx_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SetbitRequest); i { + switch v := v.(*AddRequest); i { case 0: return &v.state case 1: @@ -488,6 +841,66 @@ func file_stringx_proto_init() { } } file_stringx_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_stringx_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReduceRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_stringx_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReduceResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_stringx_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SetbitRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_stringx_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SetbitResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_stringx_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetbitRequest); i { case 0: return &v.state @@ -499,6 +912,18 @@ func file_stringx_proto_init() { return nil } } + file_stringx_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetbitResponse); 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{ @@ -506,7 +931,7 @@ func file_stringx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_stringx_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 12, NumExtensions: 0, NumServices: 0, }, diff --git a/pkg/structure/define.go b/pkg/structure/define.go index 7e160fb..cce5904 100644 --- a/pkg/structure/define.go +++ b/pkg/structure/define.go @@ -12,18 +12,3 @@ const ( DynamicFloat DynamicString ) - -type ResultConn struct { - Result []string - UpdateSize int64 // 操作以后发生变更的大小, 负数表示减小 -} - -func NewResult(s ...string) *ResultConn { - res := make([]string, len(s)) - - res = append(res, s...) - - return &ResultConn{ - Result: res, - } -} diff --git a/pkg/structure/interface.gen.go b/pkg/structure/interface.gen.go index b25cbe1..e09faba 100644 --- a/pkg/structure/interface.gen.go +++ b/pkg/structure/interface.gen.go @@ -8,7 +8,7 @@ import "gitee.com/timedb/wheatCache/pkg/proto" type KeyBaseInterface interface { SizeByte() int64 - // TODO RollBack 事务相关, V2 实现 + // RollBack TODO 事务相关, V2 实现 RollBack() error // Begin 事务相关, V2 实现 Begin() error @@ -20,10 +20,10 @@ type KeyBaseInterface interface { type StringXInterface interface { KeyBaseInterface - Set(*proto.SetRequest) (*ResultConn, error) - Get(*proto.GetRequest) (*ResultConn, error) - Add(*proto.AddRequest) (*ResultConn, error) - Reduce(*proto.ReduceRequest) (*ResultConn, error) - Setbit(*proto.SetbitRequest) (*ResultConn, error) - Getbit(*proto.GetbitRequest) (*ResultConn, error) + Set(*proto.SetRequest) (*proto.SetResponse, error) + Get(*proto.GetRequest) (*proto.GetResponse, error) + Add(*proto.AddRequest) (*proto.AddResponse, error) + Reduce(*proto.ReduceRequest) (*proto.ReduceResponse, error) + Setbit(*proto.SetbitRequest) (*proto.SetbitResponse, error) + Getbit(*proto.GetbitRequest) (*proto.GetbitResponse, error) } diff --git a/protobuf/storage.proto b/protobuf/storage.proto index d877215..94854d7 100644 --- a/protobuf/storage.proto +++ b/protobuf/storage.proto @@ -7,15 +7,12 @@ option go_package = "pkg/proto"; import "stringx.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 (SetResponse); + rpc Get (GetRequest) returns (GetResponse); + rpc Add (AddRequest) returns (AddResponse); + rpc Reduce (ReduceRequest) returns (ReduceResponse); + rpc Setbit (SetbitRequest) returns (SetbitResponse); + rpc Getbit (GetbitRequest) returns (GetbitResponse); } \ No newline at end of file diff --git a/protobuf/stringx.proto b/protobuf/stringx.proto index 01cb72b..665bc84 100644 --- a/protobuf/stringx.proto +++ b/protobuf/stringx.proto @@ -7,28 +7,56 @@ message SetRequest { string val = 2; } +message SetResponse { + int64 update_size = 1; + string result = 2; +} + message GetRequest { BaseKey key = 1; } +message GetResponse { + int64 update_size = 1; + string result = 2; +} + message AddRequest { BaseKey key = 1; - // 自动增加 - int32 raise = 2; + int32 renewal = 2; +} + +message AddResponse { + int64 update_size = 1; + string result = 2; } message ReduceRequest { BaseKey key = 1; - int32 cut = 2; + int32 renewal = 2; +} + +message ReduceResponse { + int64 update_size = 1; + string result = 2; } message SetbitRequest { BaseKey key = 1; - int32 office = 2; - bool val = 3; + bool val = 2; + int32 offer = 3; +} + +message SetbitResponse { + int64 update_size = 1; } message GetbitRequest { BaseKey key = 1; - int32 office = 2; + int32 offer = 3; +} + +message GetbitResponse { + int64 update_size = 1; + bool val = 2; }