From 170ba44d2d5b10c534cf8435d45cf9180c0bbc4e Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Mon, 1 Nov 2021 21:55:50 +0800 Subject: [PATCH] chore(aof): update aof codec --- storage/persisted/codec.gen.go | 6 +++--- storage/temp/aof.template | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/storage/persisted/codec.gen.go b/storage/persisted/codec.gen.go index 6247b74..7cafce2 100644 --- a/storage/persisted/codec.gen.go +++ b/storage/persisted/codec.gen.go @@ -12,10 +12,10 @@ import ( protobuf "google.golang.org/protobuf/proto" ) -type codec struct { +type codecProto struct { } -func (c codec) Encode(method string, m protobuf.Message) ([]byte, error) { +func (c *codecProto) Encode(method string, m protobuf.Message) ([]byte, error) { buf, err := protobuf.Marshal(m) if err != nil { return nil, err @@ -30,7 +30,7 @@ func (c codec) Encode(method string, m protobuf.Message) ([]byte, error) { return buffer.Bytes(), nil } -func (c codec) Decode(buf []byte) (protobuf.Message, error) { +func (c *codecProto) Decode(buf []byte) (protobuf.Message, error) { hexBuf := bytes.Split(buf, []byte(":")) if len(hexBuf) != 2 { return nil, errorx.New("decode aof err: not a valid aof") diff --git a/storage/temp/aof.template b/storage/temp/aof.template index 1fe2254..bececc4 100644 --- a/storage/temp/aof.template +++ b/storage/temp/aof.template @@ -12,10 +12,10 @@ import ( protobuf "google.golang.org/protobuf/proto" ) -type codec struct { +type codecProto struct { } -func (c codec) Encode(method string, m protobuf.Message) ([]byte, error) { +func (c *codecProto) Encode(method string, m protobuf.Message) ([]byte, error) { buf, err := protobuf.Marshal(m) if err != nil { return nil, err @@ -30,7 +30,7 @@ func (c codec) Encode(method string, m protobuf.Message) ([]byte, error) { return buffer.Bytes(), nil } -func (c codec) Decode(buf []byte) (protobuf.Message, error) { +func (c *codecProto) Decode(buf []byte) (protobuf.Message, error) { hexBuf := bytes.Split(buf, []byte(":")) if len(hexBuf) != 2 { return nil, errorx.New("decode aof err: not a valid aof")