You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2021/08/26 16:27:37 UTC
[GitHub] [geode] dschneider-pivotal commented on a change in pull request #6803: GEODE-9435: Implement ZREMRANGEBYRANK
dschneider-pivotal commented on a change in pull request #6803:
URL: https://github.com/apache/geode/pull/6803#discussion_r696791922
##########
File path: geode-apis-compatible-with-redis/src/main/java/org/apache/geode/redis/internal/data/RedisSortedSet.java
##########
@@ -437,6 +442,65 @@ long zrevrank(byte[] member) {
return getElementsFromSet(rangeOptions, startIndex, maxElementsToReturn);
}
+ private int removeEntriesByRange(Region<RedisKey, RedisData> region, RedisKey key,
+ SortedSetRankRangeOptions rangeOptions) {
+ int startIndex = getStartIndex(rangeOptions);
+
+ if (startIndex >= getSortedSetSize() && !rangeOptions.isRev()
+ || startIndex < 0 && rangeOptions.isRev()) {
+ return 0;
+ }
+
+ int maxElementsToReturn = getMaxElementsToReturn(rangeOptions, startIndex);
+
+ if (maxElementsToReturn <= 0) {
+ return 0;
+ }
+
+ Iterator<AbstractOrderedSetEntry> entryIterator =
+ scoreSet.getIndexRange(startIndex, maxElementsToReturn, rangeOptions.isRev());
+
+ int membersRemoved = 0;
+ RemsDeltaInfo deltaInfo = null;
+
+ while (entryIterator.hasNext()) {
+ AbstractOrderedSetEntry next = entryIterator.next();
+ if (deltaInfo == null) {
+ deltaInfo = new RemsDeltaInfo();
+ }
+ deltaInfo.add(next.member);
+ membersRemoved++;
+ }
+
+ if (deltaInfo != null) {
+ membersRemoveAll(deltaInfo);
+ storeChanges(region, key, deltaInfo);
+ }
+
+ return membersRemoved;
+ }
+
+ private List<byte[]> addLimitToRange(AbstractSortedSetRangeOptions<?> rangeOptions,
Review comment:
I couldn't find this method being used. It also seems odd that it only returns the canonical empty list or null.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@geode.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org