]> source.dussan.org Git - jgit.git/commit
ObjectReader: New #isNotLargerThan method 80/191080/6
authorIvan Frade <ifrade@google.com>
Sat, 4 Dec 2021 00:11:10 +0000 (16:11 -0800)
committerIvan Frade <ifrade@google.com>
Tue, 18 Oct 2022 18:18:46 +0000 (11:18 -0700)
commitb58ea5c6c90533614600e7ca06fa779532c734bc
treeec983923a6cfe9c15476a6eb73da6d0066a764bf
parentb398bb91ab28b799ea39dc2d1b5bd0b849392443
ObjectReader: New #isNotLargerThan method

Partial clones filter the objects to send by size calling
ObjectReader#getObjectSize per object. This method reads the object from
storage to get the size, which can be expensive.

Offer a #isNotLargerThan method. The default implementation reads the
object, but subclasses can override it with more efficient lookups (e.g.
adding an index).

isNotLargerThan gives implementors more options to optimize than
getObjectIndex (e.g. can be implemented storing only object over certain
size).

Change-Id: Iefd4b1370cb9144f15cc0391286aeeb365e6ea87
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectReader.java