Search in sources :

Example 1 with FirstDLSNNotLessThanSelector

use of org.apache.distributedlog.selector.FirstDLSNNotLessThanSelector in project bookkeeper by apache.

the class ReadUtils method asyncReadFirstUserRecord.

/**
 * Read first record from a log segment with a DLSN larger than that given.
 *
 * @param streamName
 *          fully qualified stream name (used for logging)
 * @param l
 *          log segment metadata.
 * @param scanStartBatchSize
 *          first num entries used for read last record scan
 * @param scanMaxBatchSize
 *          max num entries used for read last record scan
 * @param numRecordsScanned
 *          num of records scanned to get last record
 * @param executorService
 *          executor service used for processing entries
 * @param entryStore
 *          log segment entry store
 * @param dlsn
 *          threshold dlsn
 * @return a future with last record.
 */
public static CompletableFuture<LogRecordWithDLSN> asyncReadFirstUserRecord(final String streamName, final LogSegmentMetadata l, final int scanStartBatchSize, final int scanMaxBatchSize, final AtomicInteger numRecordsScanned, final ExecutorService executorService, final LogSegmentEntryStore entryStore, final DLSN dlsn) {
    long startEntryId = 0L;
    if (l.getLogSegmentSequenceNumber() == dlsn.getLogSegmentSequenceNo()) {
        startEntryId = dlsn.getEntryId();
    }
    final LogRecordSelector selector = new FirstDLSNNotLessThanSelector(dlsn);
    return asyncReadRecord(streamName, l, false, false, false, scanStartBatchSize, scanMaxBatchSize, numRecordsScanned, executorService, entryStore, selector, false, /* backward */
    startEntryId);
}
Also used : FirstDLSNNotLessThanSelector(org.apache.distributedlog.selector.FirstDLSNNotLessThanSelector) LogRecordSelector(org.apache.distributedlog.selector.LogRecordSelector)

Aggregations

FirstDLSNNotLessThanSelector (org.apache.distributedlog.selector.FirstDLSNNotLessThanSelector)1 LogRecordSelector (org.apache.distributedlog.selector.LogRecordSelector)1