- Notifications
You must be signed in to change notification settings - Fork 1k
Add Streams support #799
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
Add Streams support #799
Conversation
| ref: redis/redis-py#1040 |
byroot 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.
Just some minor nitpicky comments.
The code looks good, but I need to take some time to think about the API.
lib/redis.rb Outdated
| HashifyStreamEntries = | ||
| lambda { |reply| | ||
| reply.map do |entry_id, values| | ||
| [entry_id, Hash[values.each_slice(2).to_a]] |
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.
values.each_slice(2).to_h is simpler.
lib/redis.rb Outdated
| synchronize { |client| client.call([:xlen, key]) } | ||
| end | ||
| | ||
| # Fetches entries from one or multiple streams. You're able to use blocking if needed. |
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.
You're able to use blocking if needed. I think this needs to be phrased differently.
Maybe Optionally blocking ?
lib/redis.rb Outdated
| synchronize { |client| client.call(args, &HashifyStreamEntries) } | ||
| end | ||
| | ||
| # Fetches entries of the stream ordered by descending. |
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.
ordered by descending. -> in descending order.
2f9bdff to 5a9305b Compare | I have fixed the following additional things.
|
5a9305b to d1fc118 Compare | I have fixed as the following.
|
53105c4 to c17db7f Compare | end | ||
| end | ||
| | ||
| def omit_version(min_ver) |
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.
This isn't used anywhere. Can you remove it from the PR please?
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.
The above helper method is used by the following linter.
https://github.com/redis/redis-rb/pull/799/files#diff-a14ac8847c163e36437c11a9aa3c7643R8-R11
test/lint/streams.rb
Lint::Streams#setup
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.
Weird, that's a broken link for me and ctrl + F omit_version doesn't match anything.
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.
Argh, nvm, GitHub chose to hide that part of the diff.
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.
I'm sorry.
def setup super omit_version(MIN_REDIS_VERSION) end| I think this looks very good. It just need a rebase and some minor ajustement. I'd like to merge it and play with it a bit, and eventually release a 4.1.0 with this & the cluster support. |
| Can you rebase ? I'll merge afterward. |
c17db7f to 3a16a0e Compare | I have rebased. I appreciate for your review. |
I'd like to use Redis Streams.