[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: perf(codec): optimize performance #615

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions pkg/generic/binarythrift_codec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,16 @@ type mockMessage struct {
PayloadLenFunc func() int
SetPayloadLenFunc func(size int)
TransInfoFunc func() remote.TransInfo
TagsFunc func() map[string]interface{}
ProtocolInfoFunc func() remote.ProtocolInfo
SetProtocolInfoFunc func(remote.ProtocolInfo)
PayloadCodecFunc func() remote.PayloadCodec
SetPayloadCodecFunc func(pc remote.PayloadCodec)
RecycleFunc func()
header remote.MessageHeader
}

func (m *mockMessage) Header() *remote.MessageHeader {
return &m.header
}

func (m *mockMessage) RPCInfo() rpcinfo.RPCInfo {
Expand Down Expand Up @@ -252,13 +256,6 @@ func (m *mockMessage) TransInfo() remote.TransInfo {
return nil
}

func (m *mockMessage) Tags() map[string]interface{} {
if m.TagsFunc != nil {
return m.TagsFunc()
}
return nil
}

func (m *mockMessage) ProtocolInfo() (pi remote.ProtocolInfo) {
if m.ProtocolInfoFunc != nil {
return m.ProtocolInfoFunc()
Expand Down
2 changes: 1 addition & 1 deletion pkg/remote/codec/default_codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func (c *defaultCodec) Decode(ctx context.Context, message remote.Message, in re
return perrors.NewProtocolErrorWithErrMsg(err, fmt.Sprintf("ttheader read payload first 8 byte failed: %s", err.Error()))
}
} else if isMeshHeader(flagBuf) {
message.Tags()[remote.MeshHeader] = true
message.Header().SetMagic(MeshHeaderMagic)
// MeshHeader
if err = meshHeaderCodec.decode(ctx, message, in); err != nil {
return err
Expand Down
Loading