summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2011-01-25 17:20:08 -0800
committerShawn O. Pearce <spearce@spearce.org>2011-01-27 08:58:55 -0800
commita017fdf1124144228dd0395d8a36080212644ed5 (patch)
tree69da3d0d55c1aa41452db69f2cb68cc84c8accb9 /org.eclipse.jgit
parentc218a0760ddcdd9a392b0ae15f99fdccf823cd42 (diff)
downloadjgit-a017fdf1124144228dd0395d8a36080212644ed5.tar.gz
jgit-a017fdf1124144228dd0395d8a36080212644ed5.zip
Allow ObjectReuseAsIs to resort objects during writing
It can be very handy for the implementation to resort the object list based on data locality, improving prefetch in the operating system's buffer cache. Export the list to the implementation was a proper List, and document that its mutable and OK to be modified. The only caller in PackWriter is already OK with these rules. Change-Id: I3f51cf4388898917b2be36670587a5aee902ff10 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WindowCursor.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/ObjectReuseAsIs.java6
2 files changed, 6 insertions, 3 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WindowCursor.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WindowCursor.java
index 8679c0de10..86ee460b14 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WindowCursor.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WindowCursor.java
@@ -48,6 +48,7 @@ import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
+import java.util.List;
import java.util.zip.DataFormatException;
import java.util.zip.Inflater;
@@ -147,7 +148,7 @@ final class WindowCursor extends ObjectReader implements ObjectReuseAsIs {
src.pack.copyAsIs(out, src, this);
}
- public void writeObjects(PackOutputStream out, Iterable<ObjectToPack> list)
+ public void writeObjects(PackOutputStream out, List<ObjectToPack> list)
throws IOException {
for (ObjectToPack otp : list)
out.writeObject(otp);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/ObjectReuseAsIs.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/ObjectReuseAsIs.java
index bbd4e00349..ce4cd2c0e7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/ObjectReuseAsIs.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/ObjectReuseAsIs.java
@@ -44,6 +44,7 @@
package org.eclipse.jgit.storage.pack;
import java.io.IOException;
+import java.util.List;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.errors.StoredObjectRepresentationNotAvailableException;
@@ -135,12 +136,13 @@ public interface ObjectReuseAsIs {
* the stream to write each object to.
* @param list
* the list of objects to write. Objects should be written in
- * approximately this order.
+ * approximately this order. Implementors may resort the list
+ * elements in-place during writing if desired.
* @throws IOException
* the stream cannot be written to, or one or more required
* objects cannot be accessed from the object database.
*/
- public void writeObjects(PackOutputStream out, Iterable<ObjectToPack> list)
+ public void writeObjects(PackOutputStream out, List<ObjectToPack> list)
throws IOException;
/**