]> source.dussan.org Git - jgit.git/commit
Redo PackWriter object reuse output 68/968/1
authorShawn O. Pearce <spearce@spearce.org>
Sat, 26 Jun 2010 21:46:05 +0000 (14:46 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Sat, 26 Jun 2010 21:46:05 +0000 (14:46 -0700)
commitece88b99eb2ea6541b667aa066573184c25b6a8b
tree2b0a8c55313905aed695e151c1efbef60663b36f
parentbf4ffff07fb5be4a405ca13ae8baa13dee693b10
Redo PackWriter object reuse output

Output of selected reuses is refactored to use a new ObjectReuseAsIs
interface that extends the ObjectReader.  This interface allows the
reader to control how it performs the reuse into the output stream,
but also allows it to throw an exception to request the writer to
find a different candidate representation.

The PackFile reuse code was overhauled, cleaning up the APIs so they
aren't exposed in the object loader, but instead are now a single
method on the PackFile itself.  The reuse algorithm was changed to do
a data verification pass, followed by the copy pass to the output.
This permits us to work around a corrupt object in a pack file by
seeking another copy of that object when this one is bad.

The reuse code was also optimized for the common case, where the
in-pack representation is under 16 KiB.  In these smaller cases
data is sent to the pack writer more directly, avoiding some copying.

Change-Id: I6350c2b444118305e8446ce1dfd049259832bcca
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
12 files changed:
org.eclipse.jgit/src/org/eclipse/jgit/errors/StoredObjectRepresentationNotAvailableException.java [new file with mode: 0644]
org.eclipse.jgit/src/org/eclipse/jgit/lib/ByteArrayWindow.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/ByteBufferWindow.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/ByteWindow.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/LocalObjectToPack.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectReuseAsIs.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/PackFile.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/PackOutputStream.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/PackedObjectLoader.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/WindowCursor.java
org.eclipse.jgit/src/org/eclipse/jgit/util/LongList.java