Search in sources :

Example 1 with Store

use of com.indeed.lsmtree.core.Store in project invesdwin-context-persistence by subes.

the class LsmTreePerformanceTest method readGetLatest.

private void readGetLatest(final Store<FDate, FDate> table) throws InterruptedException, IOException {
    final LoopInterruptedCheck loopCheck = new LoopInterruptedCheck(Duration.ONE_SECOND);
    final List<FDate> values = Lists.toList(newValues());
    final Instant readsStart = new Instant();
    for (int reads = 1; reads <= READS; reads++) {
        FDate prevValue = null;
        for (int i = 0; i < values.size(); i++) {
            try {
                final Store.Entry<FDate, FDate> entry = table.floor(values.get(i));
                final FDate value = entry.getValue();
                if (prevValue != null) {
                    Assertions.checkTrue(prevValue.isBefore(value));
                }
                prevValue = value;
            } catch (final NoSuchElementException e) {
                break;
            }
        }
        if (loopCheck.check()) {
            printProgress("GetLatests", readsStart, VALUES * reads, VALUES * READS);
        }
    }
    printProgress("GetLatestsFinished", readsStart, VALUES * READS, VALUES * READS);
}
Also used : Instant(de.invesdwin.util.time.Instant) Store(com.indeed.lsmtree.core.Store) LoopInterruptedCheck(de.invesdwin.util.concurrent.loop.LoopInterruptedCheck) FDate(de.invesdwin.util.time.date.FDate) NoSuchElementException(java.util.NoSuchElementException)

Aggregations

Store (com.indeed.lsmtree.core.Store)1 LoopInterruptedCheck (de.invesdwin.util.concurrent.loop.LoopInterruptedCheck)1 Instant (de.invesdwin.util.time.Instant)1 FDate (de.invesdwin.util.time.date.FDate)1 NoSuchElementException (java.util.NoSuchElementException)1