Skip to content

Commit

Permalink
Optimize getActiveLedgersInRange (apache#4005)
Browse files Browse the repository at this point in the history
* Optimize getActiveLedgersInRange
  • Loading branch information
AnonHxy authored and Anup Ghatage committed Jul 12, 2024
1 parent b7bb3ae commit 717d360
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ public void delete(long ledgerId) throws IOException {

public Iterable<Long> getActiveLedgersInRange(final long firstLedgerId, final long lastLedgerId)
throws IOException {
if (firstLedgerId <= 0 && lastLedgerId == Long.MAX_VALUE) {
return ledgers.keys();
}
return Iterables.filter(ledgers.keys(), new Predicate<Long>() {
@Override
public boolean apply(Long ledgerId) {
Expand Down

0 comments on commit 717d360

Please sign in to comment.