aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/lib/WindowCursor.java
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2010-06-26 14:16:06 -0700
committerShawn O. Pearce <spearce@spearce.org>2010-06-26 14:16:06 -0700
commitbf4ffff07fb5be4a405ca13ae8baa13dee693b10 (patch)
tree0ea0fbe073b54cd43a9e34ae2c4b16b66175dbee /org.eclipse.jgit/src/org/eclipse/jgit/lib/WindowCursor.java
parente0c9368f3e7c3857b9b91d12f76dfa09b1540a24 (diff)
downloadjgit-bf4ffff07fb5be4a405ca13ae8baa13dee693b10.tar.gz
jgit-bf4ffff07fb5be4a405ca13ae8baa13dee693b10.zip
Redo PackWriter object reuse selection
The new selection implementation uses a public API on the ObjectReader, allowing the storage library to enumerate its candidates and select the best one for this packer without needing to build a temporary list of the candidates first. Change-Id: Ie01496434f7d3581d6d3bbb9e33c8f9fa649b6cd Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/lib/WindowCursor.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/WindowCursor.java18
1 files changed, 8 insertions, 10 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/WindowCursor.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/WindowCursor.java
index cf5bce73c0..e167354928 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/WindowCursor.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/WindowCursor.java
@@ -45,7 +45,6 @@
package org.eclipse.jgit.lib;
import java.io.IOException;
-import java.util.Collection;
import java.util.zip.DataFormatException;
import java.util.zip.Inflater;
@@ -53,7 +52,7 @@ import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.revwalk.RevObject;
/** Active handle to a ByteWindow. */
-final class WindowCursor extends ObjectReader {
+final class WindowCursor extends ObjectReader implements ObjectReuseAsIs {
/** Temporary buffer large enough for at least one raw object id. */
final byte[] tempId = new byte[Constants.OBJECT_ID_LENGTH];
@@ -82,14 +81,13 @@ final class WindowCursor extends ObjectReader {
return ldr;
}
- @Override
public LocalObjectToPack newObjectToPack(RevObject obj) {
return new LocalObjectToPack(obj);
}
- void openObjectInAllPacks(AnyObjectId otp,
- Collection<PackedObjectLoader> reuseLoaders) throws IOException {
- db.openObjectInAllPacks(reuseLoaders, this, otp);
+ public void selectObjectRepresentation(PackWriter packer, ObjectToPack otp)
+ throws IOException, MissingObjectException {
+ db.selectObjectRepresentation(packer, otp, this);
}
/**
@@ -108,8 +106,8 @@ final class WindowCursor extends ObjectReader {
* bytes remaining in the window starting at offset
* <code>pos</code>.
* @return number of bytes actually copied; this may be less than
- * <code>cnt</code> if <code>cnt</code> exceeded the number of
- * bytes available.
+ * <code>cnt</code> if <code>cnt</code> exceeded the number of bytes
+ * available.
* @throws IOException
* this cursor does not match the provider or id and the proper
* window could not be acquired through the provider's cache.
@@ -161,8 +159,8 @@ final class WindowCursor extends ObjectReader {
}
}
- void inflateVerify(final PackFile pack, long position)
- throws IOException, DataFormatException {
+ void inflateVerify(final PackFile pack, long position) throws IOException,
+ DataFormatException {
prepareInflater();
for (;;) {
pin(pack, position);