Skip to content

Commit e80fc3e

Browse files
committed
refactor(*): delete redundant code, etc.
- Remove redundant implementation of YomoCodec - Rename the package name of the Tag object
1 parent 9369971 commit e80fc3e

12 files changed

+17
-1118
lines changed

base_packet.go

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package y3
22

33
import (
4-
codec "github.com/yomorun/yomo-codec-golang/internal/codec"
4+
"github.com/yomorun/yomo-codec-golang/internal/mark"
55
"github.com/yomorun/yomo-codec-golang/internal/utils"
66
)
77

88
type basePacket struct {
9-
tag *codec.Tag
9+
tag *mark.Tag
1010
length uint32
1111
valbuf []byte
1212
}
@@ -15,10 +15,6 @@ func (bp *basePacket) Length() uint32 {
1515
return bp.length
1616
}
1717

18-
// func (bp *basePacket) Buffer() []byte {
19-
// return bp.valbuf
20-
// }
21-
2218
func (bp *basePacket) SeqID() byte {
2319
return bp.tag.SeqID()
2420
}

internal/codec/tag.go renamed to internal/mark/tag.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package codec
1+
package mark
22

33
import (
44
"fmt"

node_decoder.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55

66
"github.com/yomorun/yomo-codec-golang/pkg/spec/encoding"
77

8-
"github.com/yomorun/yomo-codec-golang/internal/codec"
8+
"github.com/yomorun/yomo-codec-golang/internal/mark"
99
)
1010

1111
func parsePayload(b []byte) (endPos int, ifNodePacket bool, np *NodePacket, pp *PrimitivePacket, err error) {
@@ -41,7 +41,7 @@ func DecodeNodePacket(b []byte) (pct *NodePacket, endPos int, err error) {
4141
pos := 0
4242

4343
// `Tag`
44-
tag := codec.NewTag(b[pos])
44+
tag := mark.NewTag(b[pos])
4545
pct.basePacket.tag = tag
4646
// fmt.Printf("pos=%d, n.Tag=%v\n", pos, pct.tag.String())
4747
pos++

pkg/codes/yomo.go

-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ type YomoCodec interface {
2323

2424
// NewCodec: create new `YomoCodec`
2525
func NewCodec(observe string) YomoCodec {
26-
//return NewCollectingCodec(observe)
27-
//return NewMergingCodec(packetutils.KeyOf(observe))
2826
return NewStreamingCodecNoInform(packetutils.KeyOf(observe))
2927
}
3028

pkg/codes/yomo_collecting.go

-262
This file was deleted.

0 commit comments

Comments
 (0)