@Override
    public void consumeEntries(final Predicate<RefStoreEntry> predicate,
                               final Predicate<RefStoreEntry> takeWhile,
                               final Consumer<RefStoreEntry> entryConsumer) {
        Objects.requireNonNull(entryConsumer);

        lmdbEnvironment.doWithReadTxn(readTxn -> {
            try (final CursorIterable<ByteBuffer> keyValueDbIterable = keyValueStoreDb.getLmdbDbi().iterate(
                    readTxn, KeyRange.all());
                    final CursorIterable<ByteBuffer> rangeValueDbIterable = rangeStoreDb.getLmdbDbi().iterate(
                            readTxn, KeyRange.all())) {

                // Transient caches of some of the low caridinality but high frequency lookups
                // Only provides limited performance gains.
                final Map<UID, MapDefinition> uidToMapDefMap = new HashMap<>();
                final Map<MapDefinition, RefDataProcessingInfo> mapDefToProcessingInfoMap = new HashMap<>();

                final Stream<RefStoreEntry> keyValueStream = buildKeyValueStoreEntryStream(
                        readTxn,
                        keyValueDbIterable,
                        uidToMapDefMap,
                        mapDefToProcessingInfoMap);

                final Stream<RefStoreEntry> rangeValueStream =
                        buildRangeValueStoreEntryStream(
                                readTxn,
                                rangeValueDbIterable,
                                uidToMapDefMap,
                                mapDefToProcessingInfoMap);

                final MutableLong entryCounter = new MutableLong();
                Stream<RefStoreEntry> combinedStream = Stream.concat(keyValueStream, rangeValueStream);
                if (LOGGER.isDebugEnabled()) {
                    combinedStream = combinedStream.peek(entry -> entryCounter.increment());
                }

                final DurationTimer timer = DurationTimer.start();
                if (predicate != null) {
                    combinedStream = combinedStream.filter(predicate);
                }
                if (takeWhile != null) {
                    combinedStream = combinedStream.takeWhile(predicate);
                }
                combinedStream.forEach(entryConsumer);
                LOGGER.debug("Scanned over {} entries in {}", entryCounter, timer);
            }
        });
    }
For use in testing at SMALL scale. Dumps the content of each DB to the logger.
stroom-pipeline/src/main/java/stroom/pipeline/refdata/store/offheapstore/RefDataOffHeapStore.java