Search in sources :

Example 1 with SubspaceSplitter

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();
}
Also used : Nonnull(javax.annotation.Nonnull) Subspace(com.apple.foundationdb.subspace.Subspace) ArrayList(java.util.ArrayList) List(java.util.List) Matchers.containsString(org.hamcrest.Matchers.containsString) PlanMatchers.hasTupleString(com.apple.foundationdb.record.query.plan.match.PlanMatchers.hasTupleString) SubspaceSplitter(com.apple.foundationdb.map.SubspaceSplitter) Tuple(com.apple.foundationdb.tuple.Tuple) Nonnull(javax.annotation.Nonnull)

Aggregations

SubspaceSplitter (com.apple.foundationdb.map.SubspaceSplitter)1 PlanMatchers.hasTupleString (com.apple.foundationdb.record.query.plan.match.PlanMatchers.hasTupleString)1 Subspace (com.apple.foundationdb.subspace.Subspace)1 Tuple (com.apple.foundationdb.tuple.Tuple)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Nonnull (javax.annotation.Nonnull)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1