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

support clean encoder/decoder, discard decode buffer #242

Merged
merged 5 commits into from
Nov 19, 2020

Conversation

wongoo
Copy link
Contributor

@wongoo wongoo commented Nov 10, 2020

What this PR does:
support loop encoding&decoding

Which issue(s) this PR fixes:

Fixes #241

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

support loop encoding&decoding

@codecov-io
Copy link

Codecov Report

Merging #242 (94fc336) into master (aea2863) will increase coverage by 0.06%.
The diff coverage is 57.14%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #242      +/-   ##
==========================================
+ Coverage   66.18%   66.24%   +0.06%     
==========================================
  Files          25       25              
  Lines        2768     2770       +2     
==========================================
+ Hits         1832     1835       +3     
- Misses        708      709       +1     
+ Partials      228      226       -2     
Impacted Files Coverage Δ
encode.go 84.94% <0.00%> (-2.84%) ⬇️
decode.go 74.48% <100.00%> (+3.78%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update aea2863...94fc336. Read the comment docs.

@wongoo wongoo changed the title support loop encoding&decoding support encoder/decoder clean, decode buffer discard Nov 11, 2020
@wongoo wongoo changed the title support encoder/decoder clean, decode buffer discard support clean encoder/decoder, discard decode buffer Nov 11, 2020
assert.True(t, reflect.DeepEqual(u, res))

// -------- decode 2
d.Clean()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is' clean 'called once per decode.
If you have a complex object type, such as an object with multiple instance arrays, after the first instance is decoded, clean is called, will the decoding of subsequent instances fail?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a multiple instance arrays should be considered as a whole object, and will be all decoded in once.
A call fo Clean means a new start for a new object.

@wongoo
Copy link
Contributor Author

wongoo commented Nov 17, 2020

@AlexStocks there is a CI error Error: 缺少参数 access_token

@wongoo
Copy link
Contributor Author

wongoo commented Nov 17, 2020

@AlexStocks @zonghaishang this pr Expose the api ReadByte, add three new api Encoder.Clean , Decoder.Clean and Decoder.Discard. I think it can do more optimization for these api, but adding new api is big thing, i'd like to keep it simple, and we can do optimization afterwards.

@cityiron
Copy link
Contributor

@AlexStocks there is a CI error Error: 缺少参数 access_token

PR step can not get access_token

@AlexStocks AlexStocks merged commit 9d646eb into apache:master Nov 19, 2020
zhaoyunxing92 pushed a commit that referenced this pull request Sep 4, 2021
support clean encoder/decoder, discard decode buffer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

一个包含多个序列化值的字节数组进行反序列化的问题
5 participants