feat(go): add go desrialization support via io streams#3374
Open
ayush00git wants to merge 6 commits intoapache:mainfrom
Open
feat(go): add go desrialization support via io streams#3374ayush00git wants to merge 6 commits intoapache:mainfrom
ayush00git wants to merge 6 commits intoapache:mainfrom
Conversation
Contributor
Author
|
Hey @chaokunyang |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why?
To enable stream-based deserialization in Fory's Go library, allowing for direct reading from
io.Readerwithout pre-buffering the entire payload. This improves efficiency for network and file-based transport.What does this PR do?
1. go/fory/buffer.go
Enhanced
ByteBufferto supportio.Readerwith an internal sliding window and automatic filling.reader io.ReaderandminCap intfields.fill(n int) boolfor on-demand data fetching and compaction.Read*methods (fixed-size, varint, tagged) to fetch data from the reader if not cached.2. go/fory/fory.go
Added the
DeserializeFromReadermethod as the primary public API for stream deserialization.iopackage.DeserializeFromReaderto reset the buffer state and initiate deserialization from a stream.3. go/fory/reader.go
Ensured
ReadContextcorrectly manages the buffer state when switching between memory-only and stream-backed modes.SetDatato reset thereaderfield.Related issues
Closes #3302
Does this PR introduce any user-facing change?
Benchmark
N/A