-
Notifications
You must be signed in to change notification settings - Fork 73
[API-338] Improve Ringbuffer#read_many #393
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
Conversation
Before this, read_many was returning an immutable lazy list of items read. However, there were more information sent by the server which we were omitting. Now, read_many returns an instance of ReadResult, which the user can get the read count, size, next sequence to read from and item sequences. Note that, this is not a breaking change. ReadResult inherits from the ImmutableLazyDataList and hence is a list. So, the users of this API can use their code as it is without any change when they upgrade to 4.1. New users might benefit from the new APIs provided. Also added a filter parameter to read_many, refactored the implementation and updated some docstrings.
|
Failed because of an unrelated test. The bug behind the failure is fixed in #394. I will restart tests after getting 394 merged. |
|
verify |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments.
Some tests that are missing that I would consider adding:
- Some unit tests for start_sequence, min_count and max_count assertions (I could not find any unit test for ringbuffer, maybe we can add them later together with readMany unit test)
- readyManyAsync_whenSomeWaitingForSingleItemNeeded
- readManyAsync_whenSomeWaitingNeeded
- readManyAsync_whenMinZeroAndItemAvailable
- readManyAsync_whenMinZeroAndNoItemAvailable
- readManyAsync_whenMoreAvailableThanMinimumLessThanMaximum
|
@srknzl added some of the tests you mentioned, not all of them because some of them feel unnecessary or already tested. As you said, lets add unit tests later, this is not the main concern of this PR |
srknzl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
verify |
Before this, read_many was returning an immutable lazy list of
items read. However, there were more information sent by the server
which we were omitting.
Now, read_many returns an instance of ReadResult, which the user
can get the read count, size, next sequence to read from and
item sequences. Note that, this is not a breaking change. ReadResult
inherits from the ImmutableLazyDataList and hence is a list. So, the
users of this API can use their code as it is without any change when
they upgrade to 4.1. New users might benefit from the new APIs provided.
Also added a filter parameter to read_many, refactored the implementation
and updated some docstrings.