@Test public void beginsWith() { fdb.run(context -> { KeyValueCursor cursor = KeyValueCursor.Builder.withSubspace(subspace) .setContext(context) .setRange(TupleRange.allOf(Tuple.from(3))) .setContinuation(null) .setScanProperties(ScanProperties.FORWARD_SCAN) .build(); for (int j = 0; j < 5; j++) { KeyValue kv = cursor.getNext().get(); assertArrayEquals(subspace.pack(Tuple.from(3, j)), kv.getKey()); assertArrayEquals(Tuple.from(3, j).pack(), kv.getValue()); } assertThat(cursor.getNext().hasNext(), is(false)); cursor = KeyValueCursor.Builder.withSubspace(subspace) .setContext(context) .setRange(TupleRange.allOf(Tuple.from(3))) .setContinuation(null) .setScanProperties(new ScanProperties(ExecuteProperties.newBuilder().setReturnedRowLimit(2).build())) .build(); assertEquals(2, (int)cursor.getCount().join()); cursor = KeyValueCursor.Builder.withSubspace(subspace) .setContext(context) .setRange(TupleRange.allOf(Tuple.from(3))) .setContinuation(cursor.getNext().getContinuation().toBytes()) .setScanProperties(new ScanProperties(ExecuteProperties.newBuilder().setReturnedRowLimit(3).build())) .build(); assertEquals(3, (int)cursor.getCount().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();  }