diff --git a/pkg/proto/storage.pb.go b/pkg/proto/storage.pb.go index 4187ebc..8fce5ea 100644 --- a/pkg/proto/storage.pb.go +++ b/pkg/proto/storage.pb.go @@ -95,7 +95,7 @@ type CommendRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Commends []*Comm `protobuf:"bytes,1,rep,name=commends,proto3" json:"commends,omitempty"` + Commends *Comm `protobuf:"bytes,1,opt,name=commends,proto3" json:"commends,omitempty"` } func (x *CommendRequest) Reset() { @@ -130,7 +130,7 @@ func (*CommendRequest) Descriptor() ([]byte, []int) { return file_storage_proto_rawDescGZIP(), []int{1} } -func (x *CommendRequest) GetCommends() []*Comm { +func (x *CommendRequest) GetCommends() *Comm { if x != nil { return x.Commends } @@ -195,7 +195,7 @@ var file_storage_proto_rawDesc = []byte{ 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x42, 0x0d, 0x0a, 0x0b, 0x63, 0x6f, 0x6d, 0x6d, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x33, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x6d, - 0x65, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x05, 0x2e, 0x43, 0x6f, 0x6d, + 0x65, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x05, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x73, 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, diff --git a/structure/define.go b/pkg/structure/define.go similarity index 100% rename from structure/define.go rename to pkg/structure/define.go diff --git a/structure/generate/structure.gen.go b/pkg/structure/generate/structure.gen.go similarity index 100% rename from structure/generate/structure.gen.go rename to pkg/structure/generate/structure.gen.go diff --git a/structure/generate/tem.yaml b/pkg/structure/generate/tem.yaml similarity index 100% rename from structure/generate/tem.yaml rename to pkg/structure/generate/tem.yaml diff --git a/structure/interface.go b/pkg/structure/interface.go similarity index 86% rename from structure/interface.go rename to pkg/structure/interface.go index f0935e1..0cffbde 100644 --- a/structure/interface.go +++ b/pkg/structure/interface.go @@ -4,7 +4,7 @@ type CacheValue interface { LengthByte() int64 } -type ParseComm func(comm string) ([]string, error) +type ParseComm func(comm interface{}) ([]string, error) type CacheStruct interface { SizeByte() int64 diff --git a/structure/stringx/option.go b/pkg/structure/stringx/option.go similarity index 100% rename from structure/stringx/option.go rename to pkg/structure/stringx/option.go diff --git a/pkg/structure/stringx/string.go b/pkg/structure/stringx/string.go new file mode 100644 index 0000000..653ddc2 --- /dev/null +++ b/pkg/structure/stringx/string.go @@ -0,0 +1 @@ +package stringx diff --git a/protobuf/storage.proto b/protobuf/storage.proto index c795937..45b4e2b 100644 --- a/protobuf/storage.proto +++ b/protobuf/storage.proto @@ -10,7 +10,7 @@ message Comm { } message CommendRequest { - repeated Comm commends = 1; + Comm commends = 1; } message CommendResponse { diff --git a/storage/cmd/root.go b/storage/cmd/root.go index 0a6b201..b08b1c6 100644 --- a/storage/cmd/root.go +++ b/storage/cmd/root.go @@ -10,7 +10,7 @@ import ( "syscall" _ "gitee.com/timedb/wheatCache/conf" - "gitee.com/timedb/wheatCache/storage/proto" + "gitee.com/timedb/wheatCache/pkg/proto" "gitee.com/timedb/wheatCache/storage/server" "github.com/spf13/cobra" "github.com/spf13/viper" diff --git a/storage/server/server.go b/storage/server/server.go index 76de968..485d858 100644 --- a/storage/server/server.go +++ b/storage/server/server.go @@ -2,7 +2,7 @@ package server import ( context "context" - "gitee.com/timedb/wheatCache/storage/proto" + "gitee.com/timedb/wheatCache/pkg/proto" ) type server struct{} diff --git a/structure/stringx/string.go b/structure/stringx/string.go deleted file mode 100644 index 34ab783..0000000 --- a/structure/stringx/string.go +++ /dev/null @@ -1,49 +0,0 @@ -package stringx - -import ( - "unsafe" - - "gitee.com/timedb/wheatCache/structure" -) - -type StringxInt struct { - val int -} - -type StringxFloat struct { - val float64 -} - -type Stringx struct { - ValFloat StringxFloat - ValInt StringxInt - ValString string -} - -func (s *Stringx) SizeByte() int64 { - size := unsafe.Sizeof(s) - return int64(size) -} - -// RollBack 事务相关, V2 实现 -func (s *Stringx) RollBack() error { - panic("not implemented") // TODO: Implement -} - -// Begin 事务相关, V2 实现 -func (s *Stringx) Begin() error { - panic("not implemented") // TODO: Implement -} - -// RollBack 事务相关, V2 实现 -func (s *Stringx) Comment() error { - panic("not implemented") // TODO: Implement -} - -func (s *Stringx) ParseCommend(comm structure.ParseComm) ([]string, error) { - panic("not implemented") // TODO: Implement -} - -func (s *Stringx) Encode() ([]byte, error) { - panic("not implemented") // TODO: Implement -}