Skip to main content

epoch_and_offset_for_entries

Function epoch_and_offset_for_entries 

Source
pub fn epoch_and_offset_for_entries(
    entries: &[EpochEntry],
    requested_epoch: LeaderEpoch,
    log_end_offset: Offset,
) -> (LeaderEpoch, Offset)
Expand description

Resolve a requested leader epoch to (found_epoch, end_offset), exactly as Kafka’s LeaderEpochFileCache.endOffsetFor does (see kafka_end_offset_for for the case table).

(UNDEFINED_EPOCH, UNDEFINED_EPOCH_OFFSET) = (-1, -1) is the “cannot place this epoch” answer: UnifiedLog.endOffsetForEpoch turns it into None, which Partition.lastOffsetForLeaderEpoch answers with the schema defaults (-1, -1) and Partition.readRecords answers with OFFSET_OUT_OF_RANGE. Those two uses are the caller’s.

Entries must be strictly increasing in both fields.