diff --git a/src/main/java/net/spy/memcached/v2/AsyncArcusCommands.java b/src/main/java/net/spy/memcached/v2/AsyncArcusCommands.java index cd089262a..6c343c18e 100644 --- a/src/main/java/net/spy/memcached/v2/AsyncArcusCommands.java +++ b/src/main/java/net/spy/memcached/v2/AsyncArcusCommands.java @@ -111,6 +111,8 @@ import net.spy.memcached.v2.vo.BTreeUpdateElement; import net.spy.memcached.v2.vo.BopDeleteArgs; import net.spy.memcached.v2.vo.BopGetArgs; +import net.spy.memcached.v2.vo.BopRangeGetArgs; +import net.spy.memcached.v2.vo.BopSMGetArgs; import net.spy.memcached.v2.vo.GetOption; public class AsyncArcusCommands implements AsyncArcusCommandsIF { @@ -1353,7 +1355,8 @@ public void gotData(String bKey, int flags, byte[] data, byte[] eFlag) { } @Override - public ArcusFuture> bopGet(String key, BKey from, BKey to, BopGetArgs args) { + public ArcusFuture> bopGet(String key, BKey from, BKey to, + BopRangeGetArgs args) { verifyBKeyTypesMatch(from, to); AbstractArcusResult> result = @@ -1405,34 +1408,33 @@ public void gotData(String bKey, int flags, byte[] data, byte[] eFlag) { private static BTreeGet createBTreeGet(BKey bKey, BopGetArgs args) { if (bKey.getType() == BKey.BKeyType.LONG) { - return new BTreeGet((long) bKey.getData(), args.getElementFlagFilter(), + return new BTreeGet((long) bKey.getData(), args.getEFlagFilter(), args.isWithDelete(), args.isDropIfEmpty()); } - return new BTreeGet((byte[]) bKey.getData(), args.getElementFlagFilter(), + return new BTreeGet((byte[]) bKey.getData(), args.getEFlagFilter(), args.isWithDelete(), args.isDropIfEmpty()); } - private static BTreeGet createBTreeGet(BKey from, BKey to, BopGetArgs args) { + private static BTreeGet createBTreeGet(BKey from, BKey to, BopRangeGetArgs args) { if (from.getType() == BKey.BKeyType.LONG) { return new BTreeGet((long) from.getData(), (long) to.getData(), - args.getElementFlagFilter(), args.getOffset(), args.getCount(), + args.getEFlagFilter(), args.getOffset(), args.getCount(), args.isWithDelete(), args.isDropIfEmpty()); } return new BTreeGet((byte[]) from.getData(), (byte[]) to.getData(), - args.getElementFlagFilter(), args.getOffset(), args.getCount(), + args.getEFlagFilter(), args.getOffset(), args.getCount(), args.isWithDelete(), args.isDropIfEmpty()); } @Override public ArcusFuture>> bopMultiGet(List keys, BKey from, BKey to, - BopGetArgs args) { + BopRangeGetArgs args) { keyValidator.validateKey(keys); keyValidator.checkDupKey(keys); verifyBKeyTypesMatch(from, to); - verifyPositiveCountArg(args, ArcusClient.MAX_GETBULK_ELEMENT_COUNT); ArcusClient client = arcusClientSupplier.get(); Collection>> arrangedKeys = @@ -1542,25 +1544,24 @@ public void gotElement(String key, int flags, Object bKey, byte[] eFlag, byte[] } private BTreeGetBulk createBTreeGetBulk(MemcachedNode node, List keys, - BKey from, BKey to, BopGetArgs args) { + BKey from, BKey to, BopRangeGetArgs args) { if (from.getType() == BKey.BKeyType.LONG) { return new BTreeGetBulkWithLongTypeBkey<>(node, keys, - (long) from.getData(), (long) to.getData(), args.getElementFlagFilter(), + (long) from.getData(), (long) to.getData(), args.getEFlagFilter(), args.getOffset(), args.getCount()); } return new BTreeGetBulkWithByteTypeBkey<>(node, keys, - (byte[]) from.getData(), (byte[]) to.getData(), args.getElementFlagFilter(), + (byte[]) from.getData(), (byte[]) to.getData(), args.getEFlagFilter(), args.getOffset(), args.getCount()); } @Override public ArcusFuture> bopSortMergeGet(List keys, BKey from, BKey to, - boolean unique, BopGetArgs args) { + BopSMGetArgs args) { keyValidator.validateKey(keys); keyValidator.checkDupKey(keys); verifyBKeyTypesMatch(from, to); - verifyPositiveCountArg(args, ArcusClient.MAX_SMGET_COUNT); ArcusClient client = arcusClientSupplier.get(); Collection>> arrangedKeys = @@ -1569,7 +1570,7 @@ public ArcusFuture> bopSortMergeGet(List keys, BKey List>> smGetFutures = new ArrayList<>(); for (Map.Entry> entry : arrangedKeys) { - BTreeSMGet smGet = createBTreeSMGet(from, to, args, unique, entry); + BTreeSMGet smGet = createBTreeSMGet(from, to, args, entry); CompletableFuture> future = bopSortMergeGetPerNode(client, smGet).toCompletableFuture(); smGetFutures.add(future); @@ -1585,8 +1586,8 @@ public ArcusFuture> bopSortMergeGet(List keys, BKey results.add(future.join()); } } - return BTreeSMGetResult.mergeSMGetElements(results, from.compareTo(to) <= 0, unique, - args.getCount()); + return BTreeSMGetResult.mergeSMGetElements(results, from.compareTo(to) <= 0, + args.isUnique(), args.getCount()); }); } @@ -1656,18 +1657,17 @@ public void gotTrimmedKey(String key, Object bKey) { return future; } - private BTreeSMGet createBTreeSMGet(BKey from, BKey to, BopGetArgs args, - boolean unique, + private BTreeSMGet createBTreeSMGet(BKey from, BKey to, BopSMGetArgs args, Map.Entry> entry) { if (from.getType() == BKey.BKeyType.LONG) { return new BTreeSMGetWithLongTypeBkey<>(entry.getKey(), entry.getValue(), - (long) from.getData(), (long) to.getData(), args.getElementFlagFilter(), - args.getCount(), unique); + (long) from.getData(), (long) to.getData(), + args.getEFlagFilter(), args.getCount(), args.isUnique()); } return new BTreeSMGetWithByteTypeBkey<>(entry.getKey(), entry.getValue(), - (byte[]) from.getData(), (byte[]) to.getData(), args.getElementFlagFilter(), - args.getCount(), unique); + (byte[]) from.getData(), (byte[]) to.getData(), + args.getEFlagFilter(), args.getCount(), args.isUnique()); } @Override @@ -1933,13 +1933,6 @@ private static void verifyBKeyTypesMatch(BKey from, BKey to) { } } - private static void verifyPositiveCountArg(BopGetArgs args, int maxCount) { - int count = args.getCount(); - if (count <= 0 || count > maxCount) { - throw new IllegalArgumentException("Count should be between 1 to " + maxCount); - } - } - private ArcusFuture collectionCreate(String key, CollectionCreate collectionCreate) { AbstractArcusResult result = new AbstractArcusResult<>(new AtomicReference<>()); ArcusFutureImpl future = new ArcusFutureImpl<>(result); diff --git a/src/main/java/net/spy/memcached/v2/AsyncArcusCommandsIF.java b/src/main/java/net/spy/memcached/v2/AsyncArcusCommandsIF.java index b196a7e15..27029abca 100644 --- a/src/main/java/net/spy/memcached/v2/AsyncArcusCommandsIF.java +++ b/src/main/java/net/spy/memcached/v2/AsyncArcusCommandsIF.java @@ -35,6 +35,8 @@ import net.spy.memcached.v2.vo.BTreeUpdateElement; import net.spy.memcached.v2.vo.BopDeleteArgs; import net.spy.memcached.v2.vo.BopGetArgs; +import net.spy.memcached.v2.vo.BopRangeGetArgs; +import net.spy.memcached.v2.vo.BopSMGetArgs; import net.spy.memcached.v2.vo.GetOption; public interface AsyncArcusCommandsIF { @@ -694,7 +696,7 @@ ArcusFuture>> bopUpsertAndGetTrimmed( * empty {@code BTreeGetResult} if no elements are found in the range but key exists, * {@code null} if key is not found */ - ArcusFuture> bopGet(String key, BKey from, BKey to, BopGetArgs args); + ArcusFuture> bopGet(String key, BKey from, BKey to, BopRangeGetArgs args); /** * Get elements from multiple btree items. @@ -708,7 +710,7 @@ ArcusFuture>> bopUpsertAndGetTrimmed( * no {@code Map.Entry} in the map if the key is not found */ ArcusFuture>> bopMultiGet( - List keys, BKey from, BKey to, BopGetArgs args); + List keys, BKey from, BKey to, BopRangeGetArgs args); /** * Get sort-merged elements from multiple btree items. @@ -716,13 +718,12 @@ ArcusFuture>> bopMultiGet( * @param keys list of keys to get * @param from BKey range start * @param to BKey range end - * @param unique whether to return unique elements only - * @param args arguments for get operation + * @param args arguments for get operation {@link BopSMGetArgs} * @return {@code BTreeSMGetResult} containing sort-merged elements, * empty {@code BTreeSMGetResult} if no matching elements exist */ ArcusFuture> bopSortMergeGet( - List keys, BKey from, BKey to, boolean unique, BopGetArgs args); + List keys, BKey from, BKey to, BopSMGetArgs args); /** * Get the position of an element with the given bKey in a btree item. diff --git a/src/main/java/net/spy/memcached/v2/vo/BopGetArgs.java b/src/main/java/net/spy/memcached/v2/vo/BopGetArgs.java index 0f12faf98..341fe04d9 100644 --- a/src/main/java/net/spy/memcached/v2/vo/BopGetArgs.java +++ b/src/main/java/net/spy/memcached/v2/vo/BopGetArgs.java @@ -4,97 +4,30 @@ public final class BopGetArgs { - public static final BopGetArgs DEFAULT = new BopGetArgs.Builder().build(); + public static final BopGetArgs DEFAULT + = new BopGetArgs(ElementFlagFilter.DO_NOT_FILTER, GetOption.NONE); private final ElementFlagFilter eFlagFilter; - private final int offset; - private final int count; - private final boolean withDelete; - private final boolean dropIfEmpty; + private final GetOption option; + + public BopGetArgs(ElementFlagFilter eFlagFilter, GetOption option) { + if (option == null) { + throw new IllegalArgumentException("option cannot be null"); + } - private BopGetArgs(ElementFlagFilter eFlagFilter, int offset, int count, - boolean withDelete, boolean dropIfEmpty) { this.eFlagFilter = eFlagFilter; - this.offset = offset; - this.count = count; - this.withDelete = withDelete; - this.dropIfEmpty = dropIfEmpty; + this.option = option; } - public ElementFlagFilter getElementFlagFilter() { + public ElementFlagFilter getEFlagFilter() { return eFlagFilter; } - public int getOffset() { - return offset; - } - - public int getCount() { - return count; - } - public boolean isWithDelete() { - return withDelete; + return option.isWithDelete(); } public boolean isDropIfEmpty() { - return dropIfEmpty; - } - - public static final class Builder { - private ElementFlagFilter eFlagFilter = null; - private int offset = 0; - private int count = 50; - private boolean withDelete = false; - private boolean dropIfEmpty = false; - - public Builder eFlagFilter(ElementFlagFilter eFlagFilter) { - this.eFlagFilter = eFlagFilter; - return this; - } - - /** - * Set the offset only for {@code AsyncArcusCommands#bopGet} - * or {@code AsyncArcusCommands#bopMultiGet} - * - * @param offset to skip elements that match condition from the 'from' BKey - */ - public Builder offset(int offset) { - if (offset < 0) { - throw new IllegalArgumentException("offset cannot be negative"); - } - this.offset = offset; - return this; - } - - /** - * Set the count of elements to retrieve. - * - * @param count For bopGet or bopMultiGet method, - * set the number of elements to retrieve from each BTree item. - * For bopSortMergeGet method, - * set the total number of elements to retrieve across all BTree items. - */ - public Builder count(int count) { - if (count < 0) { - throw new IllegalArgumentException("count cannot be negative"); - } - this.count = count; - return this; - } - - public Builder withDelete() { - this.withDelete = true; - return this; - } - - public Builder dropIfEmpty() { - this.dropIfEmpty = true; - return this; - } - - public BopGetArgs build() { - return new BopGetArgs(eFlagFilter, offset, count, withDelete, dropIfEmpty); - } + return option.isDropIfEmpty(); } } diff --git a/src/main/java/net/spy/memcached/v2/vo/BopRangeGetArgs.java b/src/main/java/net/spy/memcached/v2/vo/BopRangeGetArgs.java new file mode 100644 index 000000000..6cd889148 --- /dev/null +++ b/src/main/java/net/spy/memcached/v2/vo/BopRangeGetArgs.java @@ -0,0 +1,53 @@ +package net.spy.memcached.v2.vo; + +import net.spy.memcached.collection.ElementFlagFilter; + +public class BopRangeGetArgs { + + public static final BopRangeGetArgs DEFAULT + = new BopRangeGetArgs(ElementFlagFilter.DO_NOT_FILTER, 0, 50, GetOption.NONE); + + private final ElementFlagFilter eFlagFilter; + private final int offset; + private final int count; + private final GetOption option; + + public BopRangeGetArgs(ElementFlagFilter eFlagFilter, int offset, int count, GetOption option) { + if (offset < 0) { + throw new IllegalArgumentException("offset cannot be negative"); + } + + if (count < 1 || count > 50) { + throw new IllegalArgumentException("count must be between 1 and 50"); + } + + if (option == null) { + throw new IllegalArgumentException("option cannot be null"); + } + + this.eFlagFilter = eFlagFilter; + this.offset = offset; + this.count = count; + this.option = option; + } + + public ElementFlagFilter getEFlagFilter() { + return eFlagFilter; + } + + public int getOffset() { + return offset; + } + + public int getCount() { + return count; + } + + public boolean isWithDelete() { + return option.isWithDelete(); + } + + public boolean isDropIfEmpty() { + return option.isDropIfEmpty(); + } +} diff --git a/src/main/java/net/spy/memcached/v2/vo/BopSMGetArgs.java b/src/main/java/net/spy/memcached/v2/vo/BopSMGetArgs.java new file mode 100644 index 000000000..c4be4f14d --- /dev/null +++ b/src/main/java/net/spy/memcached/v2/vo/BopSMGetArgs.java @@ -0,0 +1,35 @@ +package net.spy.memcached.v2.vo; + +import net.spy.memcached.collection.ElementFlagFilter; + +public class BopSMGetArgs { + + public static final BopSMGetArgs DEFAULT + = new BopSMGetArgs(ElementFlagFilter.DO_NOT_FILTER, 1000, false); + + private final ElementFlagFilter eFlagFilter; + private final int count; + private final boolean unique; + + public BopSMGetArgs(ElementFlagFilter eFlagFilter, int count, boolean unique) { + if (count < 1 || count > 1000) { + throw new IllegalArgumentException("count must be between 1 and 1000"); + } + + this.eFlagFilter = eFlagFilter; + this.count = count; + this.unique = unique; + } + + public ElementFlagFilter getEFlagFilter() { + return eFlagFilter; + } + + public int getCount() { + return count; + } + + public boolean isUnique() { + return unique; + } +} diff --git a/src/test/java/net/spy/memcached/v2/BTreeAsyncArcusCommandsTest.java b/src/test/java/net/spy/memcached/v2/BTreeAsyncArcusCommandsTest.java index c2de00aaf..24cdf3a88 100644 --- a/src/test/java/net/spy/memcached/v2/BTreeAsyncArcusCommandsTest.java +++ b/src/test/java/net/spy/memcached/v2/BTreeAsyncArcusCommandsTest.java @@ -22,6 +22,9 @@ import net.spy.memcached.v2.vo.BTreeUpdateElement; import net.spy.memcached.v2.vo.BopDeleteArgs; import net.spy.memcached.v2.vo.BopGetArgs; +import net.spy.memcached.v2.vo.BopRangeGetArgs; +import net.spy.memcached.v2.vo.BopSMGetArgs; +import net.spy.memcached.v2.vo.GetOption; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -216,7 +219,7 @@ void bopGet() throws Exception { async.bopInsert(key, ELEMENTS.get(0), attrs) .thenCompose(result -> async.bopInsert(key, ELEMENTS.get(1))) .thenCompose(result -> async.bopInsert(key, ELEMENTS.get(2))) - .thenCompose(result -> async.bopGet(key, BKey.of(1L), BKey.of(3L), BopGetArgs.DEFAULT)) + .thenCompose(result -> async.bopGet(key, BKey.of(1L), BKey.of(3L), BopRangeGetArgs.DEFAULT)) // then .thenAccept(elements -> { assertEquals(3, elements.getElements().size()); @@ -235,10 +238,8 @@ void bopGetWithDelete() throws Exception { // given String key = keys.get(0); CollectionAttributes attrs = new CollectionAttributes(); - BopGetArgs getArgsWithDelete = new BopGetArgs.Builder() - .withDelete() - .count(10) - .build(); + BopGetArgs getArgsWithDelete + = new BopGetArgs(ElementFlagFilter.DO_NOT_FILTER, GetOption.DELETE); // when async.bopInsert(key, ELEMENTS.get(0), attrs) @@ -263,15 +264,11 @@ void bopGetWithDelete() throws Exception { void bopGetWithDeleteAndDropIfEmpty() throws Exception { // given String key = keys.get(0); - BopGetArgs getArgsWithDeleteAndDrop = new BopGetArgs.Builder() - .withDelete() - .dropIfEmpty() - .count(10) - .build(); + BopGetArgs getARgsWithDrop = new BopGetArgs(ElementFlagFilter.DO_NOT_FILTER, GetOption.DROP); // when async.bopInsert(key, ELEMENTS.get(0), new CollectionAttributes()) - .thenCompose(result -> async.bopGet(key, BKey.of(1L), getArgsWithDeleteAndDrop)) + .thenCompose(result -> async.bopGet(key, BKey.of(1L), getARgsWithDrop)) // then .thenAccept(element -> assertEquals(ELEMENTS.get(0), element)) .thenCompose(v -> async.bopInsert(key, ELEMENTS.get(1))) @@ -286,7 +283,7 @@ void bopGetRangeNotExistKey() { String key = keys.get(0); // when - async.bopGet(key, BKey.of(1L), BKey.of(10L), BopGetArgs.DEFAULT) + async.bopGet(key, BKey.of(1L), BKey.of(10L), BopRangeGetArgs.DEFAULT) // then .thenAccept(Assertions::assertNull) // NOT FOUND (key miss) .toCompletableFuture() @@ -303,7 +300,7 @@ void bopGetRangeNotExistElements() throws Exception { .thenCompose(result -> async.bopInsert(key, ELEMENTS.get(1))) .thenCompose(result -> async.bopInsert(key, ELEMENTS.get(2))) .thenCompose(result -> async.bopGet(key, - BKey.of(10L), BKey.of(20L), BopGetArgs.DEFAULT)) + BKey.of(10L), BKey.of(20L), BopRangeGetArgs.DEFAULT)) // then .thenAccept(elements -> { // NOT FOUND ELEMENT @@ -319,10 +316,8 @@ void bopGetRangeWithDelete() throws Exception { // given String key = keys.get(0); CollectionAttributes attrs = new CollectionAttributes(); - BopGetArgs getArgsWithDelete = new BopGetArgs.Builder() - .withDelete() - .count(10) - .build(); + BopRangeGetArgs getArgsWithDelete + = new BopRangeGetArgs(ElementFlagFilter.DO_NOT_FILTER, 0, 10, GetOption.DELETE); // when async.bopInsert(key, ELEMENTS.get(0), attrs) @@ -337,7 +332,7 @@ void bopGetRangeWithDelete() throws Exception { assertEquals(ELEMENTS.get(1), elements.getElements().get(0)); assertEquals(ELEMENTS.get(2), elements.getElements().get(1)); }) - .thenCompose(v -> async.bopGet(key, BKey.of(2L), BKey.of(3L), BopGetArgs.DEFAULT)) + .thenCompose(v -> async.bopGet(key, BKey.of(2L), BKey.of(3L), BopRangeGetArgs.DEFAULT)) .thenAccept(elements -> { assertNotNull(elements); assertTrue(elements.getElements().isEmpty()); @@ -356,7 +351,8 @@ void bopGetRangeDescending() throws Exception { .thenCompose(result -> async.bopInsert(key, ELEMENTS.get(1))) .thenCompose(result -> async.bopInsert(key, ELEMENTS.get(2))) .thenCompose(result -> async.bopInsert(key, ELEMENTS.get(3))) - .thenCompose(result -> async.bopGet(key, BKey.of(10L), BKey.of(1L), BopGetArgs.DEFAULT)) + .thenCompose(result -> async.bopGet(key, BKey.of(10L), BKey.of(1L), + BopRangeGetArgs.DEFAULT)) // then .thenAccept(elements -> { assertNotNull(elements); @@ -383,7 +379,7 @@ void bopMultiGet() throws Exception { .thenCompose(result -> async.bopInsert(testKeys.get(2), ELEMENTS.get(4), attr)) // then .thenCompose(result -> async - .bopMultiGet(testKeys, BKey.of(1L), BKey.of(10L), BopGetArgs.DEFAULT)) + .bopMultiGet(testKeys, BKey.of(1L), BKey.of(10L), BopRangeGetArgs.DEFAULT)) .thenAccept(map -> { assertEquals(3, map.size()); @@ -419,7 +415,7 @@ void bopMultiGetDescending() throws Exception { .thenCompose(result -> async.bopInsert(testKeys.get(2), ELEMENTS.get(4), attr)) // then .thenCompose(result -> async - .bopMultiGet(testKeys, BKey.of(10L), BKey.of(1L), BopGetArgs.DEFAULT)) + .bopMultiGet(testKeys, BKey.of(10L), BKey.of(1L), BopRangeGetArgs.DEFAULT)) .thenAccept(map -> { assertEquals(3, map.size()); @@ -455,7 +451,7 @@ void bopMultiGetNotFoundElement() throws Exception { // when async.bopInsert(testKeys.get(0), ELEMENTS.get(0), attrs) .thenCompose(result -> async - .bopMultiGet(testKeys, BKey.of(10L), BKey.of(20L), BopGetArgs.DEFAULT)) + .bopMultiGet(testKeys, BKey.of(10L), BKey.of(20L), BopRangeGetArgs.DEFAULT)) // then .thenAccept(map -> { assertEquals(1, map.size()); @@ -477,6 +473,7 @@ void bopSortMergeGetAscendingUnique() throws Exception { // given List testKeys = Arrays.asList(keys.get(0), keys.get(1), keys.get(2)); CollectionAttributes attrs = new CollectionAttributes(); + BopSMGetArgs getArgs = new BopSMGetArgs(ElementFlagFilter.DO_NOT_FILTER, 1000, true); async.bopInsert(testKeys.get(0), ELEMENTS.get(0), attrs) .thenCompose(result -> async.bopInsert(testKeys.get(0), ELEMENTS.get(2))) @@ -486,7 +483,7 @@ void bopSortMergeGetAscendingUnique() throws Exception { .thenCompose(result -> async.bopInsert(testKeys.get(2), ELEMENTS.get(3))) // when .thenCompose(result -> async.bopSortMergeGet(testKeys, - BKey.of(1L), BKey.of(10L), true, BopGetArgs.DEFAULT)) + BKey.of(1L), BKey.of(10L), getArgs)) // then .thenAccept(smGetElements -> { assertNotNull(smGetElements); @@ -511,6 +508,7 @@ void bopSortMergeGetDescendingUnique() throws Exception { // given List testKeys = Arrays.asList(keys.get(0), keys.get(1), keys.get(2)); CollectionAttributes attrs = new CollectionAttributes(); + BopSMGetArgs getArgs = new BopSMGetArgs(ElementFlagFilter.DO_NOT_FILTER, 1000, true); async.bopInsert(testKeys.get(0), ELEMENTS.get(0), attrs) .thenCompose(result -> async.bopInsert(testKeys.get(0), ELEMENTS.get(2))) @@ -520,7 +518,7 @@ void bopSortMergeGetDescendingUnique() throws Exception { .thenCompose(result -> async.bopInsert(testKeys.get(2), ELEMENTS.get(3))) // when .thenCompose(result -> async.bopSortMergeGet(testKeys, - BKey.of(10L), BKey.of(1L), true, BopGetArgs.DEFAULT)) + BKey.of(10L), BKey.of(1L), getArgs)) // then .thenAccept(smGetElements -> { assertNotNull(smGetElements); @@ -552,7 +550,7 @@ void bopSortMergeGetAscendingDuplicated() throws Exception { .thenCompose(result -> async.bopInsert(testKeys.get(1), ELEMENTS.get(1))) // when .thenCompose(result -> async.bopSortMergeGet(testKeys, - BKey.of(1L), BKey.of(2L), false, BopGetArgs.DEFAULT)) + BKey.of(1L), BKey.of(2L), BopSMGetArgs.DEFAULT)) // then .thenAccept(smGetElements -> { assertNotNull(smGetElements); @@ -590,7 +588,7 @@ void bopSortMergeGetDescendingDuplicated() throws Exception { .thenCompose(result -> async.bopInsert(testKeys.get(1), ELEMENTS.get(1))) // when .thenCompose(result -> async.bopSortMergeGet(testKeys, - BKey.of(2L), BKey.of(1L), false, BopGetArgs.DEFAULT)) + BKey.of(2L), BKey.of(1L), BopSMGetArgs.DEFAULT)) // then .thenAccept(smGetElements -> { assertNotNull(smGetElements); @@ -620,6 +618,7 @@ void bopSortMergeGetDescendingDuplicated() throws Exception { void bopSortMergeGetUnique() throws Exception { // given CollectionAttributes attrs = new CollectionAttributes(); + BopSMGetArgs getArgs = new BopSMGetArgs(ElementFlagFilter.DO_NOT_FILTER, 1000, true); async.bopInsert(keys.get(0), ELEMENTS.get(0), attrs) .thenCompose(result -> async.bopInsert(keys.get(1), ELEMENTS.get(0), attrs)) @@ -627,7 +626,7 @@ void bopSortMergeGetUnique() throws Exception { .thenCompose(result -> async.bopInsert(keys.get(3), ELEMENTS.get(0), attrs)) // when .thenCompose(result -> async.bopSortMergeGet(keys, - BKey.of(1L), BKey.of(3L), true, BopGetArgs.DEFAULT)) + BKey.of(1L), BKey.of(3L), getArgs)) // then .thenAccept(smGetElements -> { assertNotNull(smGetElements); @@ -650,7 +649,7 @@ void bopSortMergeGetWithMissedKeys() throws Exception { async.bopInsert(testKeys.get(0), ELEMENTS.get(0), attrs) // when .thenCompose(result -> async.bopSortMergeGet(testKeys, - BKey.of(1L), BKey.of(10L), false, BopGetArgs.DEFAULT)) + BKey.of(1L), BKey.of(10L), BopSMGetArgs.DEFAULT)) // then .thenAccept(smGetElements -> { assertNotNull(smGetElements); @@ -676,7 +675,7 @@ void bopSortMergeGetNotFound() throws Exception { // when async.bopSortMergeGet(testKeys, - BKey.of(10L), BKey.of(20L), false, BopGetArgs.DEFAULT) + BKey.of(10L), BKey.of(20L), BopSMGetArgs.DEFAULT) // then .thenAccept(smGetElements -> { assertNotNull(smGetElements); @@ -701,7 +700,7 @@ void bopSortMergeGetNotFoundElement() throws Exception { .thenCompose(result -> async.bopInsert(testKeys.get(0), ELEMENTS.get(1), attrs)) .thenCompose(result -> async.bopInsert(testKeys.get(1), ELEMENTS.get(2), attrs)) .thenCompose(result -> async.bopSortMergeGet(testKeys, - BKey.of(10L), BKey.of(20L), false, BopGetArgs.DEFAULT)) + BKey.of(10L), BKey.of(20L), BopSMGetArgs.DEFAULT)) // then .thenAccept(smGetElements -> { assertNotNull(smGetElements); @@ -732,7 +731,7 @@ void bopSortMergeGetWithTrimmedKeys() throws Exception { .thenCompose(result -> async.bopInsert(testKeys.get(1), ELEMENTS.get(1), attrs)) .thenCompose(result -> async.bopInsert(testKeys.get(1), ELEMENTS.get(2))) .thenCompose(result -> async.bopSortMergeGet(testKeys, - BKey.of(10L), BKey.of(1L), false, BopGetArgs.DEFAULT)) + BKey.of(10L), BKey.of(1L), BopSMGetArgs.DEFAULT)) // then .thenAccept(smGetElements -> { assertNotNull(smGetElements); @@ -773,8 +772,7 @@ void bopSortMergeGetNotHaveTrimmedKeysOutOfElementsRangeDescending() throws Exce .thenCompose(result -> async.bopInsert(testKeys.get(1), ELEMENTS.get(2), attrs)) .thenCompose(result -> async.bopInsert(testKeys.get(1), ELEMENTS.get(3))) .thenCompose(result -> async.bopSortMergeGet(testKeys, - BKey.of(10L), BKey.of(1L), false, - new BopGetArgs.Builder().build())) + BKey.of(10L), BKey.of(1L), BopSMGetArgs.DEFAULT)) // then .thenAccept(smGetElements -> { assertNotNull(smGetElements); @@ -812,8 +810,7 @@ void bopSortMergeGetNotHaveTrimmedKeysOutOfElementsRangeAscending() throws Excep .thenCompose(result -> async.bopInsert(testKeys.get(1), ELEMENTS.get(1), attrs)) .thenCompose(result -> async.bopInsert(testKeys.get(1), ELEMENTS.get(0))) .thenCompose(result -> async.bopSortMergeGet(testKeys, - BKey.of(1L), BKey.of(10L), false, - new BopGetArgs.Builder().build())) + BKey.of(1L), BKey.of(10L), BopSMGetArgs.DEFAULT)) // then .thenAccept(smGetElements -> { assertNotNull(smGetElements); @@ -1837,7 +1834,7 @@ void bopDeleteByRangeSuccess() throws ExecutionException, InterruptedException, async.bopDelete(key, from, to, deleteArgs) .thenCompose(result -> { assertTrue(result); - return async.bopGet(key, from, to, BopGetArgs.DEFAULT); + return async.bopGet(key, from, to, BopRangeGetArgs.DEFAULT); }) .thenAccept(result -> { List> elements = result.getElements(); @@ -1876,7 +1873,7 @@ void bopDeleteByRangeCountZero() throws ExecutionException, InterruptedException async.bopDelete(key, from, to, args) .thenCompose(result -> { assertTrue(result); - return async.bopGet(key, from, to, BopGetArgs.DEFAULT); + return async.bopGet(key, from, to, BopRangeGetArgs.DEFAULT); }) .thenAccept(result -> { assertNotNull(result); @@ -1916,7 +1913,7 @@ void bopDeleteByRangeEFlag() throws ExecutionException, InterruptedException, Ti // then .thenCompose(result -> { assertTrue(result); - return async.bopGet(key, from, to, BopGetArgs.DEFAULT); + return async.bopGet(key, from, to, BopRangeGetArgs.DEFAULT); }) .thenAccept(result -> { assertNotNull(result);