@Test public void inclusiveRange() { fdb.run(context -> { KeyValueCursor cursor = KeyValueCursor.Builder.withSubspace(subspace) .setContext(context) .setLow(Tuple.from(3, 3), EndpointType.RANGE_INCLUSIVE) .setHigh(Tuple.from(4, 2), EndpointType.RANGE_INCLUSIVE) .setContinuation(null) .setScanProperties(ScanProperties.FORWARD_SCAN) .build(); assertEquals(Arrays.asList(Tuple.from(3L, 3L), Tuple.from(3L, 4L), Tuple.from(4L, 0L), Tuple.from(4L, 1L), Tuple.from(4L, 2L)), cursor.map(KeyValue::getValue).map(Tuple::fromBytes).asList().join()); cursor = KeyValueCursor.Builder.withSubspace(subspace) .setContext(context) .setLow(Tuple.from(3, 3), EndpointType.RANGE_INCLUSIVE) .setHigh(Tuple.from(4, 2), EndpointType.RANGE_INCLUSIVE) .setContinuation(null) .setScanProperties(new ScanProperties(ExecuteProperties.newBuilder().setReturnedRowLimit(2).build())) .build(); assertEquals(Arrays.asList(Tuple.from(3L, 3L), Tuple.from(3L, 4L)), cursor.map(KeyValue::getValue).map(Tuple::fromBytes).asList().join()); cursor = KeyValueCursor.Builder.withSubspace(subspace) .setContext(context) .setLow(Tuple.from(3, 3), EndpointType.RANGE_INCLUSIVE) .setHigh(Tuple.from(4, 2), EndpointType.RANGE_INCLUSIVE) .setContinuation(cursor.getNext().getContinuation().toBytes()) .setScanProperties(ScanProperties.FORWARD_SCAN) .build(); assertEquals(Arrays.asList(Tuple.from(4L, 0L), Tuple.from(4L, 1L), Tuple.from(4L, 2L)), cursor.map(KeyValue::getValue).map(Tuple::fromBytes).asList().join()); return null; }); }
@Override @Nonnull public RecordCursorResult<KeyValue> getNext() { return context.asyncToSync(FDBStoreTimer.Waits.WAIT_ADVANCE_CURSOR, onNext()); }
KeyValueCursor extends AsyncIteratorCursor<KeyValue> implements BaseCursor<KeyValue> { @Override @Nonnull public RecordCursorResult<KeyValue> getNext() { return context.asyncToSync(FDBStoreTimer.Waits.WAIT_ADVANCE_CURSOR, onNext()); } }
KeyValueCursor extends AsyncIteratorCursor<KeyValue> implements BaseCursor<KeyValue> { @Override @Nonnull public RecordCursorResult<KeyValue> getNext() { return context.asyncToSync(FDBStoreTimer.Waits.WAIT_ADVANCE_CURSOR, onNext()); } private  KeyValueCursor(@Nonnull final FDBRecordContext context,
                           @Nonnull final AsyncIterator<KeyValue> iterator,
                           int prefixLength,
                           @Nonnull final CursorLimitManager limitManager,
                           int valuesLimit); }
KeyValueCursor extends AsyncIteratorCursor<KeyValue> implements BaseCursor<KeyValue> { @Override @Nonnull public RecordCursorResult<KeyValue> getNext() { return context.asyncToSync(FDBStoreTimer.Waits.WAIT_ADVANCE_CURSOR, onNext()); } private  KeyValueCursor(@Nonnull final FDBRecordContext context,
                           @Nonnull final AsyncIterator<KeyValue> iterator,
                           int prefixLength,
                           @Nonnull final CursorLimitManager limitManager,
                           int valuesLimit); @Nonnull @Override CompletableFuture<RecordCursorResult<KeyValue>> onNext(); @Override @Nonnull RecordCursorResult<KeyValue> getNext(); }
KeyValueCursor extends AsyncIteratorCursor<KeyValue> implements BaseCursor<KeyValue> { @Override @Nonnull public RecordCursorResult<KeyValue> getNext() { return context.asyncToSync(FDBStoreTimer.Waits.WAIT_ADVANCE_CURSOR, onNext()); } private  KeyValueCursor(@Nonnull final FDBRecordContext context,
                           @Nonnull final AsyncIterator<KeyValue> iterator,
                           int prefixLength,
                           @Nonnull final CursorLimitManager limitManager,
                           int valuesLimit); @Nonnull @Override CompletableFuture<RecordCursorResult<KeyValue>> onNext(); @Override @Nonnull RecordCursorResult<KeyValue> getNext();  }