-
Notifications
You must be signed in to change notification settings - Fork 70
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
Go: Fix XRange
and XRevRange
return data type
#3052
Go: Fix XRange
and XRevRange
return data type
#3052
Conversation
Signed-off-by: Edward Liang <[email protected]>
Signed-off-by: Edward Liang <[email protected]>
sort.Slice(xRangeResponseArray, func(i, j int) bool { | ||
return xRangeResponseArray[i].StreamId < xRangeResponseArray[j].StreamId | ||
}) |
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.
Why we need sort?
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 think since we get a map from the CommandResponse, the order of the entries are not guaranteed. Followed by that, the iteration I do to add these map entries to an array also would not guarantee the order is maintained. So I decided to add a sort to ensure the returned array is in order
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.
Not sure that we need it, but I don't mind
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 think adding sort would be helpful in the XRevRange
results but let me know your thoughts @jbrinkman
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 sounds like there is a problem with the Glide Core implementation. I think using sort here is warranted to guarantee that the sorting is maintained.
sort.Slice(xRangeResponseArray, func(i, j int) bool { | ||
return xRangeResponseArray[i].StreamId > xRangeResponseArray[j].StreamId | ||
}) |
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.
Same here
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.
Same reasoning as above but this time we return the order in reverse
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 is fine.
Signed-off-by: Edward Liang <[email protected]>
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.
Please resolve the discussions with Joe and Yury. The rest is LGTM.
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.
LG. Go ahead and merge.
sort.Slice(xRangeResponseArray, func(i, j int) bool { | ||
return xRangeResponseArray[i].StreamId < xRangeResponseArray[j].StreamId | ||
}) |
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 sounds like there is a problem with the Glide Core implementation. I think using sort here is warranted to guarantee that the sorting is maintained.
sort.Slice(xRangeResponseArray, func(i, j int) bool { | ||
return xRangeResponseArray[i].StreamId > xRangeResponseArray[j].StreamId | ||
}) |
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 is fine.
Issue link
This Pull Request is linked to issue (URL):
Checklist
Before submitting the PR make sure the following are checked: