Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,17 @@ default void skipNonRecoverableLedger(long ledgerId){}
* */
CompletableFuture<Position> asyncFindPosition(Predicate<Entry> predicate);

/**
* Optimized find position by offset with predicate.
* Uses first entry index metadata to skip ledgers where the target offset
* is smaller than the ledger's first entry index, improving performance.
*
* @param offset the target offset to find
* @param predicate the predicate to test entries
* @return CompletableFuture<Position> the position where the predicate matches
*/
CompletableFuture<Position> asyncFindPosition(long offset, Predicate<Entry> predicate);

/**
* Get the ManagedLedgerInterceptor for ManagedLedger.
* */
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ default void afterFailedAddEntry(int numberOfMessages){
*/
void onManagedLedgerPropertiesInitialize(Map<String, String> propertiesMap);

long getIndex();
/**
* A handle for reading the last ledger entry.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public ManagedLedgerInterceptorImpl(Set<BrokerEntryMetadataInterceptor> brokerEn
}
}

@Override
public long getIndex() {
long index = -1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,11 @@ public CompletableFuture<Position> asyncFindPosition(Predicate<Entry> predicate)
return delegate.asyncFindPosition(predicate);
}

@Override
public CompletableFuture<Position> asyncFindPosition(long offset, Predicate<Entry> predicate) {
return delegate.asyncFindPosition(offset, predicate);
}

@Override
public ManagedLedgerInterceptor getManagedLedgerInterceptor() {
return delegate.getManagedLedgerInterceptor();
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,9 @@ long generateSequenceId() {
long getCurrentSequenceId() {
return sequenceId.get();
}

@Override
public long getIndex() {
return -1L;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,11 @@ public CompletableFuture<Position> asyncFindPosition(Predicate<Entry> predicate)
return CompletableFuture.completedFuture(null);
}

@Override
public CompletableFuture<Position> asyncFindPosition(long offset, Predicate<Entry> predicate) {
return CompletableFuture.completedFuture(null);
}

@Override
public ManagedLedgerInterceptor getManagedLedgerInterceptor() {
return null;
Expand Down
Loading