diff --git a/pkg/proto/storage.pb.go b/pkg/proto/storage.pb.go index 4187ebc0dbe76c522d8dcf8d82b63c4406988716..8fce5eac3bb02711ec504d72774765387cae7e78 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 f0935e113b1bb18de403ae377bf51cdcec82018b..0cffbde46b4569273c6c57586864884d5019a245 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 0000000000000000000000000000000000000000..653ddc2f61de5a4161aafceded14ebcd10096499 --- /dev/null +++ b/pkg/structure/stringx/string.go @@ -0,0 +1 @@ +package stringx diff --git a/protobuf/storage.proto b/protobuf/storage.proto index c795937f32885c8f75aa6299e9bb24d30597a6f3..45b4e2b068ddfc95aca7da969f1248af3d1be127 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 0a6b2011095c7a6c0fedefb9cd34a3d65c281fe6..b08b1c662e765aff9eb4b66bdf0cf5f8c9dbe8bf 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 76de968323bb3fd69f26ec190eb91e459bd89af3..485d858cb230764b73127c149eb1f6db5d1053eb 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 34ab783131c24027c2f4ac6cd89750760edfd6e9..0000000000000000000000000000000000000000 --- 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 -}