Search in sources :

Example 1 with BasicRecordFile

use of com.indeed.lsmtree.recordlog.BasicRecordFile in project invesdwin-context-persistence by subes.

the class BasicRecordFilePerformanceTest method readIterator.

private void readIterator(final File file) throws IOException, InterruptedException {
    final LoopInterruptedCheck loopCheck = new LoopInterruptedCheck();
    final Instant readsStart = new Instant();
    for (int reads = 1; reads <= READS; reads++) {
        FDate prevValue = null;
        int count = 0;
        try (BasicRecordFile<TimedDecimal> reader = new BasicRecordFile<>(file, IndeedSerializer.valueOf(TimedDecimalSerde.GET))) {
            final RecordFile.Reader<TimedDecimal> iterator = reader.reader();
            while (iterator.next()) {
                final FDate value = iterator.get().getTime();
                if (prevValue != null) {
                    Assertions.checkTrue(prevValue.isBefore(value));
                }
                prevValue = value;
                count++;
            }
            Assertions.checkEquals(count, VALUES);
            if (loopCheck.check()) {
                printProgress("Reads", readsStart, VALUES * reads, VALUES * READS);
            }
        }
    }
    printProgress("ReadsFinished", readsStart, VALUES * READS, VALUES * READS);
}
Also used : BasicRecordFile(com.indeed.lsmtree.recordlog.BasicRecordFile) RecordFile(com.indeed.lsmtree.recordlog.RecordFile) BasicRecordFile(com.indeed.lsmtree.recordlog.BasicRecordFile) Instant(de.invesdwin.util.time.Instant) LoopInterruptedCheck(de.invesdwin.util.concurrent.loop.LoopInterruptedCheck) TimedDecimal(de.invesdwin.util.math.decimal.TimedDecimal) FDate(de.invesdwin.util.time.date.FDate)

Aggregations

BasicRecordFile (com.indeed.lsmtree.recordlog.BasicRecordFile)1 RecordFile (com.indeed.lsmtree.recordlog.RecordFile)1 LoopInterruptedCheck (de.invesdwin.util.concurrent.loop.LoopInterruptedCheck)1 TimedDecimal (de.invesdwin.util.math.decimal.TimedDecimal)1 Instant (de.invesdwin.util.time.Instant)1 FDate (de.invesdwin.util.time.date.FDate)1