Search in sources :

Example 1 with FirstDLSNNotLessThanSelector

use of com.twitter.distributedlog.selector.FirstDLSNNotLessThanSelector in project distributedlog by twitter.

the class ReadUtils method asyncReadFirstUserRecord.

/**
     * Read first record from a ledger with a DLSN larger than that given.
     *
     * @param streamName
     *          fully qualified stream name (used for logging)
     * @param l
     *          ledger descriptor.
     * @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 dlsn
     *          threshold dlsn
     * @return a future with last record.
     */
public static Future<LogRecordWithDLSN> asyncReadFirstUserRecord(final String streamName, final LogSegmentMetadata l, final int scanStartBatchSize, final int scanMaxBatchSize, final AtomicInteger numRecordsScanned, final ExecutorService executorService, final LedgerHandleCache handleCache, 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, handleCache, selector, false, /* backward */
    startEntryId);
}
Also used : FirstDLSNNotLessThanSelector(com.twitter.distributedlog.selector.FirstDLSNNotLessThanSelector) LogRecordSelector(com.twitter.distributedlog.selector.LogRecordSelector)

Aggregations

FirstDLSNNotLessThanSelector (com.twitter.distributedlog.selector.FirstDLSNNotLessThanSelector)1 LogRecordSelector (com.twitter.distributedlog.selector.LogRecordSelector)1