use of com.apple.foundationdb.ReadTransactionContext in project fdb-record-layer by FoundationDB.
the class IndexingByRecords method buildRange.
@Nonnull
private CompletableFuture<Void> buildRange(@Nonnull SubspaceProvider subspaceProvider, @Nullable Key.Evaluated start, @Nullable Key.Evaluated end) {
return getRunner().runAsync(context -> context.getReadVersionAsync().thenCompose(vignore -> subspaceProvider.getSubspaceAsync(context).thenCompose(subspace -> {
RangeSet rangeSet = new RangeSet(subspace.subspace(Tuple.from(FDBRecordStore.INDEX_RANGE_SPACE_KEY, common.getIndex().getSubspaceKey())));
byte[] startBytes = packOrNull(convertOrNull(start));
byte[] endBytes = packOrNull(convertOrNull(end));
Queue<Range> rangeDeque = new ArrayDeque<>();
ReadTransactionContext rtc = context.ensureActive();
return rangeSet.missingRanges(rtc, startBytes, endBytes).thenAccept(rangeDeque::addAll).thenCompose(vignore2 -> buildRanges(subspaceProvider, subspace, rangeSet, rangeDeque));
})));
}
Aggregations