forked from p93542168/wheat-cache
refactor(structure): refactor struct interface gen
This commit is contained in:
parent
ddd7a8a5ed
commit
a9ab92c16a
1
go.mod
1
go.mod
|
@ -6,7 +6,6 @@ require (
|
|||
github.com/spf13/cobra v1.2.1
|
||||
github.com/spf13/viper v1.8.1
|
||||
github.com/stretchr/testify v1.7.0
|
||||
golang.org/x/sys v0.0.0-20210903071746-97244b99971b // indirect
|
||||
google.golang.org/grpc v1.38.0
|
||||
google.golang.org/protobuf v1.26.0
|
||||
)
|
||||
|
|
3
go.sum
3
go.sum
|
@ -397,9 +397,8 @@ golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=
|
||||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210903071746-97244b99971b h1:3Dq0eVHn0uaQJmPO+/aYPI/fRMqdrVDbu7MQcku54gg=
|
||||
golang.org/x/sys v0.0.0-20210903071746-97244b99971b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
|
|
|
@ -0,0 +1,166 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.17.3
|
||||
// source: base.proto
|
||||
|
||||
package proto
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type BaseKey struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
|
||||
Ttl int64 `protobuf:"varint,2,opt,name=ttl,proto3" json:"ttl,omitempty"`
|
||||
Expire *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=expire,proto3" json:"expire,omitempty"`
|
||||
}
|
||||
|
||||
func (x *BaseKey) Reset() {
|
||||
*x = BaseKey{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_base_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *BaseKey) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*BaseKey) ProtoMessage() {}
|
||||
|
||||
func (x *BaseKey) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_base_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use BaseKey.ProtoReflect.Descriptor instead.
|
||||
func (*BaseKey) Descriptor() ([]byte, []int) {
|
||||
return file_base_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *BaseKey) GetKey() string {
|
||||
if x != nil {
|
||||
return x.Key
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *BaseKey) GetTtl() int64 {
|
||||
if x != nil {
|
||||
return x.Ttl
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *BaseKey) GetExpire() *timestamppb.Timestamp {
|
||||
if x != nil {
|
||||
return x.Expire
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_base_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_base_proto_rawDesc = []byte{
|
||||
0x0a, 0x0a, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f,
|
||||
0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69,
|
||||
0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x61, 0x0a,
|
||||
0x07, 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x74,
|
||||
0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, 0x32, 0x0a, 0x06,
|
||||
0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67,
|
||||
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54,
|
||||
0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x06, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65,
|
||||
0x42, 0x0b, 0x5a, 0x09, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_base_proto_rawDescOnce sync.Once
|
||||
file_base_proto_rawDescData = file_base_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_base_proto_rawDescGZIP() []byte {
|
||||
file_base_proto_rawDescOnce.Do(func() {
|
||||
file_base_proto_rawDescData = protoimpl.X.CompressGZIP(file_base_proto_rawDescData)
|
||||
})
|
||||
return file_base_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_base_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_base_proto_goTypes = []interface{}{
|
||||
(*BaseKey)(nil), // 0: BaseKey
|
||||
(*timestamppb.Timestamp)(nil), // 1: google.protobuf.Timestamp
|
||||
}
|
||||
var file_base_proto_depIdxs = []int32{
|
||||
1, // 0: BaseKey.expire:type_name -> google.protobuf.Timestamp
|
||||
1, // [1:1] is the sub-list for method output_type
|
||||
1, // [1:1] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
1, // [1:1] is the sub-list for extension extendee
|
||||
0, // [0:1] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_base_proto_init() }
|
||||
func file_base_proto_init() {
|
||||
if File_base_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_base_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*BaseKey); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_base_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_base_proto_goTypes,
|
||||
DependencyIndexes: file_base_proto_depIdxs,
|
||||
MessageInfos: file_base_proto_msgTypes,
|
||||
}.Build()
|
||||
File_base_proto = out.File
|
||||
file_base_proto_rawDesc = nil
|
||||
file_base_proto_goTypes = nil
|
||||
file_base_proto_depIdxs = nil
|
||||
}
|
|
@ -0,0 +1,445 @@
|
|||
// Code generated by gen-struct. DO NOT EDIT.
|
||||
// make gen-protobuf generated
|
||||
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.17.3
|
||||
// source: storage.proto
|
||||
|
||||
package proto
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type CommendResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Result []string `protobuf:"bytes,1,rep,name=result,proto3" json:"result,omitempty"`
|
||||
}
|
||||
|
||||
func (x *CommendResponse) Reset() {
|
||||
*x = CommendResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_storage_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *CommendResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CommendResponse) ProtoMessage() {}
|
||||
|
||||
func (x *CommendResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_storage_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use CommendResponse.ProtoReflect.Descriptor instead.
|
||||
func (*CommendResponse) Descriptor() ([]byte, []int) {
|
||||
return file_storage_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *CommendResponse) GetResult() []string {
|
||||
if x != nil {
|
||||
return x.Result
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_storage_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_storage_proto_rawDesc = []byte{
|
||||
0x0a, 0x0d, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a,
|
||||
0x0d, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x29,
|
||||
0x0a, 0x0f, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28,
|
||||
0x09, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x32, 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,
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
func init() { file_storage_proto_init() }
|
||||
func file_storage_proto_init() {
|
||||
if File_storage_proto != nil {
|
||||
return
|
||||
}
|
||||
file_stringx_proto_init()
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_storage_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*CommendResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_storage_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_storage_proto_goTypes,
|
||||
DependencyIndexes: file_storage_proto_depIdxs,
|
||||
MessageInfos: file_storage_proto_msgTypes,
|
||||
}.Build()
|
||||
File_storage_proto = out.File
|
||||
file_storage_proto_rawDesc = nil
|
||||
file_storage_proto_goTypes = nil
|
||||
file_storage_proto_depIdxs = nil
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConnInterface
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion6
|
||||
|
||||
// CommServerClient is the client API for CommServer service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type CommServerClient interface {
|
||||
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)
|
||||
}
|
||||
|
||||
type commServerClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
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)
|
||||
err := c.cc.Invoke(ctx, "/CommServer/Set", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *commServerClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*CommendResponse, error) {
|
||||
out := new(CommendResponse)
|
||||
err := c.cc.Invoke(ctx, "/CommServer/Get", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *commServerClient) Add(ctx context.Context, in *AddRequest, opts ...grpc.CallOption) (*CommendResponse, error) {
|
||||
out := new(CommendResponse)
|
||||
err := c.cc.Invoke(ctx, "/CommServer/Add", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *commServerClient) Reduce(ctx context.Context, in *ReduceRequest, opts ...grpc.CallOption) (*CommendResponse, error) {
|
||||
out := new(CommendResponse)
|
||||
err := c.cc.Invoke(ctx, "/CommServer/Reduce", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *commServerClient) Setbit(ctx context.Context, in *SetbitRequest, opts ...grpc.CallOption) (*CommendResponse, error) {
|
||||
out := new(CommendResponse)
|
||||
err := c.cc.Invoke(ctx, "/CommServer/Setbit", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *commServerClient) Getbit(ctx context.Context, in *GetbitRequest, opts ...grpc.CallOption) (*CommendResponse, error) {
|
||||
out := new(CommendResponse)
|
||||
err := c.cc.Invoke(ctx, "/CommServer/Getbit", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// CommServerServer is the server API for CommServer service.
|
||||
type CommServerServer interface {
|
||||
Set(context.Context, *SetRequest) (*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)
|
||||
}
|
||||
|
||||
// UnimplementedCommServerServer can be embedded to have forward compatible implementations.
|
||||
type UnimplementedCommServerServer struct {
|
||||
}
|
||||
|
||||
func (*UnimplementedCommServerServer) Set(context.Context, *SetRequest) (*CommendResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Set not implemented")
|
||||
}
|
||||
func (*UnimplementedCommServerServer) Get(context.Context, *GetRequest) (*CommendResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Get not implemented")
|
||||
}
|
||||
func (*UnimplementedCommServerServer) Add(context.Context, *AddRequest) (*CommendResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Add not implemented")
|
||||
}
|
||||
func (*UnimplementedCommServerServer) Reduce(context.Context, *ReduceRequest) (*CommendResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Reduce not implemented")
|
||||
}
|
||||
func (*UnimplementedCommServerServer) Setbit(context.Context, *SetbitRequest) (*CommendResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Setbit not implemented")
|
||||
}
|
||||
func (*UnimplementedCommServerServer) Getbit(context.Context, *GetbitRequest) (*CommendResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Getbit not implemented")
|
||||
}
|
||||
|
||||
func RegisterCommServerServer(s *grpc.Server, srv CommServerServer) {
|
||||
s.RegisterService(&_CommServer_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _CommServer_Set_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SetRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(CommServerServer).Set(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/CommServer/Set",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CommServerServer).Set(ctx, req.(*SetRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _CommServer_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(CommServerServer).Get(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/CommServer/Get",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CommServerServer).Get(ctx, req.(*GetRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _CommServer_Add_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(AddRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(CommServerServer).Add(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/CommServer/Add",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CommServerServer).Add(ctx, req.(*AddRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _CommServer_Reduce_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ReduceRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(CommServerServer).Reduce(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/CommServer/Reduce",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CommServerServer).Reduce(ctx, req.(*ReduceRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _CommServer_Setbit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SetbitRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(CommServerServer).Setbit(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/CommServer/Setbit",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CommServerServer).Setbit(ctx, req.(*SetbitRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _CommServer_Getbit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetbitRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(CommServerServer).Getbit(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/CommServer/Getbit",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CommServerServer).Getbit(ctx, req.(*GetbitRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _CommServer_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "CommServer",
|
||||
HandlerType: (*CommServerServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Set",
|
||||
Handler: _CommServer_Set_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Get",
|
||||
Handler: _CommServer_Get_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Add",
|
||||
Handler: _CommServer_Add_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Reduce",
|
||||
Handler: _CommServer_Reduce_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Setbit",
|
||||
Handler: _CommServer_Setbit_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Getbit",
|
||||
Handler: _CommServer_Getbit_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "storage.proto",
|
||||
}
|
|
@ -0,0 +1,464 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.17.3
|
||||
// source: stringx.proto
|
||||
|
||||
package proto
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type SetRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
|
||||
}
|
||||
|
||||
func (x *SetRequest) Reset() {
|
||||
*x = SetRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_stringx_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *SetRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SetRequest) ProtoMessage() {}
|
||||
|
||||
func (x *SetRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_stringx_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SetRequest.ProtoReflect.Descriptor instead.
|
||||
func (*SetRequest) Descriptor() ([]byte, []int) {
|
||||
return file_stringx_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *SetRequest) GetKey() *BaseKey {
|
||||
if x != nil {
|
||||
return x.Key
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetRequest) Reset() {
|
||||
*x = GetRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_stringx_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_stringx_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetRequest) Descriptor() ([]byte, []int) {
|
||||
return file_stringx_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *GetRequest) GetKey() *BaseKey {
|
||||
if x != nil {
|
||||
return x.Key
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type AddRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
|
||||
}
|
||||
|
||||
func (x *AddRequest) Reset() {
|
||||
*x = AddRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_stringx_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *AddRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AddRequest) ProtoMessage() {}
|
||||
|
||||
func (x *AddRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_stringx_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use AddRequest.ProtoReflect.Descriptor instead.
|
||||
func (*AddRequest) Descriptor() ([]byte, []int) {
|
||||
return file_stringx_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *AddRequest) GetKey() *BaseKey {
|
||||
if x != nil {
|
||||
return x.Key
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ReduceRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ReduceRequest) Reset() {
|
||||
*x = ReduceRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_stringx_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ReduceRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ReduceRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ReduceRequest) 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 ReduceRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ReduceRequest) Descriptor() ([]byte, []int) {
|
||||
return file_stringx_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *ReduceRequest) GetKey() *BaseKey {
|
||||
if x != nil {
|
||||
return x.Key
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type SetbitRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
|
||||
}
|
||||
|
||||
func (x *SetbitRequest) Reset() {
|
||||
*x = SetbitRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_stringx_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *SetbitRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SetbitRequest) ProtoMessage() {}
|
||||
|
||||
func (x *SetbitRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_stringx_proto_msgTypes[4]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SetbitRequest.ProtoReflect.Descriptor instead.
|
||||
func (*SetbitRequest) Descriptor() ([]byte, []int) {
|
||||
return file_stringx_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *SetbitRequest) GetKey() *BaseKey {
|
||||
if x != nil {
|
||||
return x.Key
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetbitRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Key *BaseKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetbitRequest) Reset() {
|
||||
*x = GetbitRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_stringx_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetbitRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetbitRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetbitRequest) 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 GetbitRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetbitRequest) Descriptor() ([]byte, []int) {
|
||||
return file_stringx_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *GetbitRequest) GetKey() *BaseKey {
|
||||
if x != nil {
|
||||
return x.Key
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_stringx_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_stringx_proto_rawDesc = []byte{
|
||||
0x0a, 0x0d, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a,
|
||||
0x0a, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x28, 0x0a, 0x0a, 0x53,
|
||||
0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x03, 0x6b, 0x65, 0x79,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79,
|
||||
0x52, 0x03, 0x6b, 0x65, 0x79, 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,
|
||||
0x28, 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, 0x22, 0x2b, 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, 0x22, 0x2b, 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, 0x22, 0x2b, 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,
|
||||
0x42, 0x0b, 0x5a, 0x09, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_stringx_proto_rawDescOnce sync.Once
|
||||
file_stringx_proto_rawDescData = file_stringx_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_stringx_proto_rawDescGZIP() []byte {
|
||||
file_stringx_proto_rawDescOnce.Do(func() {
|
||||
file_stringx_proto_rawDescData = protoimpl.X.CompressGZIP(file_stringx_proto_rawDescData)
|
||||
})
|
||||
return file_stringx_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_stringx_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
|
||||
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
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
func init() { file_stringx_proto_init() }
|
||||
func file_stringx_proto_init() {
|
||||
if File_stringx_proto != nil {
|
||||
return
|
||||
}
|
||||
file_base_proto_init()
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_stringx_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SetRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_stringx_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_stringx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*AddRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_stringx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ReduceRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_stringx_proto_msgTypes[4].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[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetbitRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_stringx_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 6,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_stringx_proto_goTypes,
|
||||
DependencyIndexes: file_stringx_proto_depIdxs,
|
||||
MessageInfos: file_stringx_proto_msgTypes,
|
||||
}.Build()
|
||||
File_stringx_proto = out.File
|
||||
file_stringx_proto_rawDesc = nil
|
||||
file_stringx_proto_goTypes = nil
|
||||
file_stringx_proto_depIdxs = nil
|
||||
}
|
|
@ -9,30 +9,27 @@ const (
|
|||
)
|
||||
|
||||
const (
|
||||
DEFAULT_COMM = iota
|
||||
SET
|
||||
DEFAULT_COMM = iota
|
||||
SET
|
||||
GET
|
||||
ADD
|
||||
REDUCE
|
||||
SETBIT
|
||||
GETBIT
|
||||
|
||||
)
|
||||
|
||||
var CommKeyString = map[string]int {"set": STRING_X,
|
||||
"get": STRING_X,
|
||||
"add": STRING_X,
|
||||
var CommKeyString = map[string]int{"set": STRING_X,
|
||||
"get": STRING_X,
|
||||
"add": STRING_X,
|
||||
"reduce": STRING_X,
|
||||
"setbit": STRING_X,
|
||||
"getbit": STRING_X,
|
||||
|
||||
}
|
||||
|
||||
var CommKey = map[int]int {SET: STRING_X,
|
||||
GET: STRING_X,
|
||||
ADD: STRING_X,
|
||||
var CommKey = map[int]int{SET: STRING_X,
|
||||
GET: STRING_X,
|
||||
ADD: STRING_X,
|
||||
REDUCE: STRING_X,
|
||||
SETBIT: STRING_X,
|
||||
GETBIT: STRING_X,
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
// Code generated by gen-struct-const. DO NOT EDIT.
|
||||
// make gen-struct generated
|
||||
|
||||
package structure
|
||||
|
||||
import "gitee.com/timedb/wheatCache/pkg/proto"
|
||||
|
||||
type KeyBaseInterface interface {
|
||||
SizeByte() int64
|
||||
|
||||
// TODO RollBack 事务相关, V2 实现
|
||||
RollBack() error
|
||||
// Begin 事务相关, V2 实现
|
||||
Begin() error
|
||||
// Comment 事务相关, V2 实现
|
||||
Comment() error
|
||||
|
||||
Encode() ([]byte, error)
|
||||
}
|
||||
|
||||
type StringXInterface interface {
|
||||
KeyBaseInterface
|
||||
Set(*proto.SetRequest) ([]string, error)
|
||||
Get(*proto.GetRequest) ([]string, error)
|
||||
Add(*proto.AddRequest) ([]string, error)
|
||||
Reduce(*proto.ReduceRequest) ([]string, error)
|
||||
Setbit(*proto.SetbitRequest) ([]string, error)
|
||||
Getbit(*proto.GetbitRequest) ([]string, error)
|
||||
}
|
|
@ -1,5 +1,51 @@
|
|||
package stringx
|
||||
|
||||
import "gitee.com/timedb/wheatCache/pkg/proto"
|
||||
|
||||
type StringX struct {
|
||||
Value string
|
||||
}
|
||||
|
||||
func (s *StringX) SizeByte() int64 {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *StringX) RollBack() error {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *StringX) Begin() error {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *StringX) Comment() error {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *StringX) Encode() ([]byte, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *StringX) Set(req *proto.SetRequest) ([]string, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *StringX) Get(req *proto.GetRequest) ([]string, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *StringX) Add(req *proto.AddRequest) ([]string, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *StringX) Reduce(req *proto.ReduceRequest) ([]string, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *StringX) Setbit(req *proto.SetbitRequest) ([]string, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *StringX) Getbit(req *proto.GetbitRequest) ([]string, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
// Code generated by gen-struct. DO NOT EDIT.
|
||||
// make gen-protobuf generated
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
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);
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
syntax = "proto3";
|
||||
import "base.proto";
|
||||
option go_package = "pkg/proto";
|
||||
|
||||
message SetRequest {
|
||||
BaseKey key = 1;
|
||||
}
|
||||
|
||||
message GetRequest {
|
||||
BaseKey key = 1;
|
||||
}
|
||||
|
||||
message AddRequest {
|
||||
BaseKey key = 1;
|
||||
}
|
||||
|
||||
message ReduceRequest {
|
||||
BaseKey key = 1;
|
||||
}
|
||||
|
||||
message SetbitRequest {
|
||||
BaseKey key = 1;
|
||||
}
|
||||
|
||||
message GetbitRequest {
|
||||
BaseKey key = 1;
|
||||
}
|
|
@ -16,6 +16,10 @@ class KeyMap(object):
|
|||
self.upper = [v.upper() for v in val]
|
||||
|
||||
|
||||
def go_fmt(path: str):
|
||||
os.system(f"go fmt {path}")
|
||||
|
||||
|
||||
def to_camel(val: str) -> str:
|
||||
return "".join([k.capitalize() for k in val.split('_')])
|
||||
|
||||
|
@ -61,8 +65,6 @@ def set_structure_const_template(conf: dict):
|
|||
|
||||
|
||||
# 生成接口
|
||||
|
||||
|
||||
def set_structure_interface(conf):
|
||||
text = load_template("interface.template")
|
||||
Dic = {}
|
||||
|
@ -77,7 +79,15 @@ def set_structure_interface(conf):
|
|||
f.write(text)
|
||||
|
||||
|
||||
def format_code_go():
|
||||
go_fmt(f"{structurePath}/interface.gen.go")
|
||||
go_fmt(f"{structurePath}/generate/structure.gen.go")
|
||||
|
||||
|
||||
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