forked from p53841790/wheat-cache
!32 feat-stringx-struct
Merge pull request !32 from bandl/feat-stringx-struct
This commit is contained in:
commit
0458ed3d21
|
@ -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")
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package structure
|
||||
|
||||
const (
|
||||
defaultLen = 32 // 默认创建的 value 大小
|
||||
defaultLen = 8 // 默认创建的 value 大小
|
||||
)
|
||||
|
||||
type DynamicType int8
|
||||
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
@ -22,7 +22,7 @@ type KeyBaseInterface interface {
|
|||
type {{key}}Interface interface{
|
||||
KeyBaseInterface
|
||||
{% for val in value -%}
|
||||
{{val}}(*proto.{{val}}Request) (*ResultConn, error)
|
||||
{{val}}(*proto.{{val}}Request) (*proto.{{val}}Response, error)
|
||||
{% endfor %}
|
||||
}
|
||||
{% endfor -%}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package stringx
|
||||
|
||||
import (
|
||||
"gitee.com/timedb/wheatCache/pkg/errorx"
|
||||
"gitee.com/timedb/wheatCache/pkg/proto"
|
||||
"gitee.com/timedb/wheatCache/pkg/structure"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type StringSingle struct {
|
||||
|
@ -19,7 +21,7 @@ func (s *StringSingle) SizeByte() int64 {
|
|||
return int64(s.val.GetLength())
|
||||
}
|
||||
|
||||
// TODO RollBack 事务相关, V2 实现
|
||||
// RollBack TODO 事务相关, V2 实现
|
||||
func (s *StringSingle) RollBack() error {
|
||||
panic("not implemented") // TODO: Implement
|
||||
}
|
||||
|
@ -38,26 +40,90 @@ func (s *StringSingle) Encode() ([]byte, error) {
|
|||
panic("not implemented") // TODO: Implement
|
||||
}
|
||||
|
||||
func (s *StringSingle) Set(req *proto.SetRequest) (*structure.ResultConn, error) {
|
||||
return nil, nil
|
||||
func (s *StringSingle) Set(req *proto.SetRequest) (*proto.SetResponse, error) {
|
||||
length := s.val.ChangeValueLength(func() {
|
||||
s.val.InferValue(req.Val)
|
||||
})
|
||||
|
||||
return &proto.SetResponse{
|
||||
Result: req.Val,
|
||||
UpdateSize: length,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *StringSingle) Get(req *proto.GetRequest) (*structure.ResultConn, error) {
|
||||
panic("not implemented") // TODO: Implement
|
||||
func (s *StringSingle) Get(req *proto.GetRequest) (*proto.GetResponse, error) {
|
||||
return &proto.GetResponse{
|
||||
Result: s.val.ToString(),
|
||||
UpdateSize: 0,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *StringSingle) Add(req *proto.AddRequest) (*structure.ResultConn, error) {
|
||||
panic("not implemented") // TODO: Implement
|
||||
func updateValueNotString(s *StringSingle, val int32) (string, int64, error) {
|
||||
switch s.val.GetDynamicType() {
|
||||
case structure.DynamicNull:
|
||||
length := s.val.ChangeValueLength(func() {
|
||||
s.val.SetInt(int64(val))
|
||||
})
|
||||
return strconv.Itoa(int(val)), length, nil
|
||||
case structure.DynamicFloat:
|
||||
f, err := s.val.ToFloat64()
|
||||
if err != nil {
|
||||
return "", 0, err
|
||||
}
|
||||
s.val.SetFloat64(f + float64(val))
|
||||
return strconv.FormatFloat(f+1, 'f', 2, 64), 0, nil
|
||||
case structure.DynamicInt:
|
||||
i, err := s.val.ToInt()
|
||||
if err != nil {
|
||||
return "", 0, err
|
||||
}
|
||||
s.val.SetInt(int64(val) + i)
|
||||
return strconv.Itoa(int(i + int64(val))), 0, nil
|
||||
default:
|
||||
return "", 0, errorx.New("string cannot perform add operations")
|
||||
}
|
||||
}
|
||||
|
||||
func (s *StringSingle) Reduce(req *proto.ReduceRequest) (*structure.ResultConn, error) {
|
||||
panic("not implemented") // TODO: Implement
|
||||
func (s *StringSingle) Add(req *proto.AddRequest) (*proto.AddResponse, error) {
|
||||
result, length, err := updateValueNotString(s, req.Renewal)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &proto.AddResponse{
|
||||
UpdateSize: length,
|
||||
Result: result,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *StringSingle) Setbit(req *proto.SetbitRequest) (*structure.ResultConn, error) {
|
||||
panic("not implemented") // TODO: Implement
|
||||
func (s *StringSingle) Reduce(req *proto.ReduceRequest) (*proto.ReduceResponse, error) {
|
||||
result, length, err := updateValueNotString(s, req.Renewal*-1)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &proto.ReduceResponse{
|
||||
UpdateSize: length,
|
||||
Result: result,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *StringSingle) Getbit(req *proto.GetbitRequest) (*structure.ResultConn, error) {
|
||||
panic("not implemented") // TODO: Implement
|
||||
func (s *StringSingle) Setbit(req *proto.SetbitRequest) (*proto.SetbitResponse, error) {
|
||||
length := s.val.ChangeValueLength(func() {
|
||||
s.val.SetByte(int(req.Offer), req.Val)
|
||||
})
|
||||
return &proto.SetbitResponse{
|
||||
UpdateSize: length,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *StringSingle) Getbit(req *proto.GetbitRequest) (*proto.GetbitResponse, error) {
|
||||
b, err := s.val.GetByte(int(req.Offer))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &proto.GetbitResponse{
|
||||
Val: b,
|
||||
}, nil
|
||||
}
|
||||
|
|
|
@ -1,19 +1,140 @@
|
|||
package stringx
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gitee.com/timedb/wheatCache/pkg/proto"
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestStringSingle_Set(t *testing.T) {
|
||||
s := new(StringSingle)
|
||||
p := s.SizeByte()
|
||||
require.Equal(t, p, int64(16))
|
||||
s.Set(&proto.SetRequest{
|
||||
Val: "",
|
||||
s := NewStringSingle()
|
||||
resp, err := s.Set(&proto.SetRequest{
|
||||
Val: "189",
|
||||
})
|
||||
p = s.SizeByte()
|
||||
fmt.Println(p)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, resp.Result, "189")
|
||||
i, err := s.Get(&proto.GetRequest{})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, i.Result, "189")
|
||||
s.Set(&proto.SetRequest{
|
||||
Val: "1.25",
|
||||
})
|
||||
i, err = s.Get(&proto.GetRequest{})
|
||||
require.Equal(t, i.Result, "1.25")
|
||||
|
||||
s.Set(&proto.SetRequest{
|
||||
Val: "awdgiugaiuwdhoawd",
|
||||
})
|
||||
i, err = s.Get(&proto.GetRequest{})
|
||||
require.Equal(t, i.Result, "awdgiugaiuwdhoawd")
|
||||
}
|
||||
|
||||
func TestStringSingle_Add(t *testing.T) {
|
||||
s := NewStringSingle()
|
||||
_, err := s.Set(&proto.SetRequest{
|
||||
Val: "135",
|
||||
})
|
||||
require.NoError(t, err)
|
||||
s.Add(&proto.AddRequest{
|
||||
Renewal: 9,
|
||||
})
|
||||
resp, err := s.Get(&proto.GetRequest{})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, resp.Result, "144")
|
||||
|
||||
// float
|
||||
_, err = s.Set(&proto.SetRequest{
|
||||
Val: "135.33",
|
||||
})
|
||||
require.NoError(t, err)
|
||||
s.Add(&proto.AddRequest{
|
||||
Renewal: 3,
|
||||
})
|
||||
resp, err = s.Get(&proto.GetRequest{})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, resp.Result, "138.33")
|
||||
|
||||
// string
|
||||
_, err = s.Set(&proto.SetRequest{
|
||||
Val: "awjdwad",
|
||||
})
|
||||
require.NoError(t, err)
|
||||
_, err = s.Add(&proto.AddRequest{
|
||||
Renewal: 3,
|
||||
})
|
||||
require.Error(t, err)
|
||||
resp, err = s.Get(&proto.GetRequest{})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, resp.Result, "awjdwad")
|
||||
}
|
||||
|
||||
func TestStringSingle_Reduce(t *testing.T) {
|
||||
s := NewStringSingle()
|
||||
_, err := s.Set(&proto.SetRequest{
|
||||
Val: "135",
|
||||
})
|
||||
require.NoError(t, err)
|
||||
s.Reduce(&proto.ReduceRequest{
|
||||
Renewal: 5,
|
||||
})
|
||||
resp, err := s.Get(&proto.GetRequest{})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, resp.Result, "130")
|
||||
|
||||
// float
|
||||
_, err = s.Set(&proto.SetRequest{
|
||||
Val: "135.33",
|
||||
})
|
||||
require.NoError(t, err)
|
||||
s.Reduce(&proto.ReduceRequest{
|
||||
Renewal: 3,
|
||||
})
|
||||
resp, err = s.Get(&proto.GetRequest{})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, resp.Result, "132.33")
|
||||
|
||||
// string
|
||||
_, err = s.Set(&proto.SetRequest{
|
||||
Val: "awjdwad",
|
||||
})
|
||||
require.NoError(t, err)
|
||||
_, err = s.Reduce(&proto.ReduceRequest{
|
||||
Renewal: 3,
|
||||
})
|
||||
require.Error(t, err)
|
||||
resp, err = s.Get(&proto.GetRequest{})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, resp.Result, "awjdwad")
|
||||
}
|
||||
|
||||
func TestStringSingle_Getbit(t *testing.T) {
|
||||
s := NewStringSingle()
|
||||
_, err := s.Setbit(&proto.SetbitRequest{
|
||||
Offer: 1009,
|
||||
Val: true,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
res, err := s.Getbit(&proto.GetbitRequest{
|
||||
Offer: 1009,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, res.Val, true)
|
||||
res, err = s.Getbit(&proto.GetbitRequest{
|
||||
Offer: 1008,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, res.Val, false)
|
||||
|
||||
_, err = s.Setbit(&proto.SetbitRequest{
|
||||
Offer: 1009,
|
||||
Val: false,
|
||||
})
|
||||
|
||||
res, err = s.Getbit(&proto.GetbitRequest{
|
||||
Offer: 1009,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, res.Val, false)
|
||||
|
||||
}
|
||||
|
|
|
@ -3,10 +3,9 @@ package structure
|
|||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"gitee.com/timedb/wheatCache/pkg/errorx"
|
||||
"math"
|
||||
"strconv"
|
||||
|
||||
"gitee.com/timedb/wheatCache/pkg/errorx"
|
||||
)
|
||||
|
||||
// Value 提供一个基础的 动态类型
|
||||
|
@ -26,7 +25,7 @@ func NewValue() *Value {
|
|||
}
|
||||
|
||||
func (v *Value) GetLength() int {
|
||||
return v.length
|
||||
return len(v.val)
|
||||
}
|
||||
|
||||
func (v *Value) GetDynamicType() DynamicType {
|
||||
|
@ -38,6 +37,7 @@ func (v *Value) SetString(str string) {
|
|||
if len(v.val) >= len(str) {
|
||||
copy(v.val, str)
|
||||
v.length = len(str)
|
||||
v.val = v.val[:v.length]
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -55,6 +55,18 @@ func (v *Value) SetString(str string) {
|
|||
}
|
||||
|
||||
func (v *Value) ToString() string {
|
||||
switch v.onType {
|
||||
case DynamicNull:
|
||||
return ""
|
||||
case DynamicString:
|
||||
return string(v.val[:v.length])
|
||||
case DynamicInt:
|
||||
i, _ := v.ToInt()
|
||||
return strconv.FormatInt(i, 10)
|
||||
case DynamicFloat:
|
||||
f, _ := v.ToFloat64()
|
||||
return strconv.FormatFloat(f, 'f', 2, 64)
|
||||
}
|
||||
return string(v.val[:v.length])
|
||||
}
|
||||
|
||||
|
@ -85,6 +97,7 @@ func (v *Value) SetFloat64(f float64) {
|
|||
bits := math.Float64bits(f)
|
||||
v.length = 8
|
||||
binary.LittleEndian.PutUint64(v.val[:v.length], bits)
|
||||
v.val = v.val[:v.length]
|
||||
v.onType = DynamicFloat
|
||||
}
|
||||
|
||||
|
@ -113,3 +126,37 @@ func (v *Value) InferValue(str string) {
|
|||
|
||||
v.SetString(str)
|
||||
}
|
||||
|
||||
// ChangeValueLength 根据类型推断 change 的大小, 只用于 Set 操作不发生错误
|
||||
func (v *Value) ChangeValueLength(f func()) int64 {
|
||||
startLen := v.GetLength()
|
||||
f()
|
||||
return int64(v.GetLength() - startLen)
|
||||
}
|
||||
|
||||
func (v *Value) SetByte(offset int, val bool) {
|
||||
v.onType = DynamicNull // 位图使用无类型
|
||||
b := byte(0)
|
||||
if val {
|
||||
b = byte(1)
|
||||
}
|
||||
|
||||
if v.length >= offset {
|
||||
v.val[offset] = b
|
||||
return
|
||||
}
|
||||
|
||||
newByte := make([]byte, offset+1)
|
||||
newByte[offset] = b
|
||||
copy(newByte, v.val[:v.length])
|
||||
v.val = newByte
|
||||
v.length = len(newByte)
|
||||
}
|
||||
|
||||
func (v *Value) GetByte(offset int) (bool, error) {
|
||||
if v.length >= offset {
|
||||
return v.val[offset] == byte(1), nil
|
||||
}
|
||||
|
||||
return false, errorx.New("the maximum length is exceeded")
|
||||
}
|
||||
|
|
|
@ -84,3 +84,46 @@ func TestValue_InferValue(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
require.Equal(t, f, -1.2)
|
||||
}
|
||||
|
||||
func TestValue_ChangeValue(t *testing.T) {
|
||||
value := NewValue()
|
||||
oldLen := value.GetLength()
|
||||
chanageLen := value.ChangeValueLength(func() {
|
||||
value.SetString("小葵花课堂开课了")
|
||||
})
|
||||
require.Equal(t, chanageLen, int64(value.GetLength()-oldLen))
|
||||
|
||||
lens := value.ChangeValueLength(func() {
|
||||
value.SetInt(100)
|
||||
})
|
||||
require.Equal(t, lens, int64(-16))
|
||||
|
||||
lengs := value.ChangeValueLength(func() {
|
||||
value.SetFloat64(9.99)
|
||||
})
|
||||
require.Equal(t, lengs, int64(0))
|
||||
|
||||
value = NewValue()
|
||||
lengs = value.ChangeValueLength(func() {
|
||||
value.SetFloat64(10.99)
|
||||
})
|
||||
require.Equal(t, lengs, int64(0))
|
||||
|
||||
value = NewValue()
|
||||
value.SetString("909awdawdawd")
|
||||
lengs = value.ChangeValueLength(func() {
|
||||
value.SetString("9akjwbddddddddddddddddddddddddddddddddddddddddddddd")
|
||||
})
|
||||
require.Equal(t, lengs, int64(39))
|
||||
}
|
||||
|
||||
func TestValue_SetByte(t *testing.T) {
|
||||
value := NewValue()
|
||||
value.SetByte(10001, true)
|
||||
v, err := value.GetByte(123)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, v, false)
|
||||
v, err = value.GetByte(10001)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, v, true)
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -28,9 +28,7 @@ def load_conf():
|
|||
return cfg, cfg_camel
|
||||
|
||||
|
||||
'''生成对应的数据结构proto文件'''
|
||||
|
||||
|
||||
# 生成对应的数据结构proto文件
|
||||
def mk_structure(cfg_camel):
|
||||
path = "protobuf"
|
||||
storagePath = f"{protobufPath}/storage.proto"
|
||||
|
@ -59,8 +57,8 @@ def mk_structure(cfg_camel):
|
|||
if flag == 0:
|
||||
file = open(proto_path, 'a')
|
||||
file.write('\nmessage ' + v + 'Request ' + '{\n BaseKey key = 1;\n}\n')
|
||||
file.write("\nmessage %sResponse {\n int64 update_size = 1;\n}\n" % v)
|
||||
file.close()
|
||||
flag = 0
|
||||
|
||||
print(f"{key}.proto", "-> success")
|
||||
|
||||
|
@ -72,10 +70,10 @@ def mk_storage(cfg_camel):
|
|||
'// Code generated by gen-struct. DO NOT EDIT.\n// make gen-protobuf generated\n\nsyntax = "proto3";\n\noption go_package = "pkg/proto";\n\n')
|
||||
for key, value in cfg_camel.items():
|
||||
file.write('import "' + key + '.proto";\n')
|
||||
file.write('\nmessage CommendResponse {\n repeated string result = 1;\n}\n\nservice CommServer {\n')
|
||||
file.write('\n\nservice CommServer {\n')
|
||||
for key, value in cfg_camel.items():
|
||||
for v in value:
|
||||
file.write(' rpc ' + v + ' (' + v + 'Request) returns (CommendResponse);\n')
|
||||
file.write(' rpc ' + v + ' (' + v + 'Request) returns (%s);\n' % "{}Response".format(v))
|
||||
file.write('}')
|
||||
file.close()
|
||||
print("storage.proto", "-> success")
|
||||
|
|
|
@ -88,6 +88,5 @@ if __name__ == "__main__":
|
|||
conf, cfg_camel = load_conf()
|
||||
set_structure_const_template(conf)
|
||||
set_structure_interface(cfg_camel)
|
||||
|
||||
# 格式化代码
|
||||
format_code_go()
|
||||
|
|
Loading…
Reference in New Issue