use of com.apple.foundationdb.map.SubspaceSplitter in project fdb-record-layer by FoundationDB.
the class TextIndexTest method scanMulti.
@Nonnull
private List<BunchedMapScanEntry<Tuple, List<Integer>, String>> scanMulti(@Nonnull FDBRecordStore store, @Nonnull Subspace mapSubspace) throws ExecutionException, InterruptedException {
SubspaceSplitter<String> splitter = new SubspaceSplitter<String>() {
@Nonnull
@Override
public Subspace subspaceOf(@Nonnull byte[] keyBytes) {
Tuple t = mapSubspace.unpack(keyBytes);
return mapSubspace.subspace(TupleHelpers.subTuple(t, 0, 1));
}
@Nonnull
@Override
public String subspaceTag(@Nonnull Subspace subspace) {
return mapSubspace.unpack(subspace.getKey()).getString(0);
}
};
BunchedMapMultiIterator<Tuple, List<Integer>, String> iterator = BUNCHED_MAP.scanMulti(store.ensureContextActive(), mapSubspace, splitter);
return AsyncUtil.collectRemaining(iterator).get();
}
Aggregations