Simple entry iterator#209
Closed
MarcialRosales wants to merge 5 commits intostream_offset_landmarksfrom
Closed
Conversation
WIP: Test different read/skip scnearios
Where the read number of bytes < requested bytes
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.
What is the entry iterator?
When iterating over stream chunks with new
entry_iteratormode created by this PR, the log can return an entry iterator instead of a full in-memory entry. An entry iterator is a handle to read the current entry’s bytes in bounded chunks via entry_iterator_read/2 (and to skip bytes via entry_iterator_skip/2).Why do we need it?
The stream protocol limits a single message to the frame size (typically 1 MiB), so normally an entry can be returned as one Entry. Other protocols (e.g. AMQP 0-9-1) can publish much larger messages into a stream. Loading those as a single Entry would be unsafe. Returning an entry iterator lets callers read a fixed number of bytes at a time (e.g. the AMQP 1.0 section descriptor and size), then decide whether to read or skip the rest of the section.