Browse Source

Expose the reverse index size in the DfsPackDescription

This is analogous to the getPackSize() and getIndexSize() methods.

Change-Id: I207c0c93f9145826d84b3610eb4319fca074ee0d
stable-1.2
Dave Borowitz 13 years ago committed by Shawn O. Pearce
parent
commit
d55eb35106
  1. 7
      org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackDescription.java
  2. 8
      org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackFile.java

7
org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackDescription.java

@ -164,6 +164,13 @@ public class DfsPackDescription implements Comparable<DfsPackDescription> {
return this;
}
/**
* @return size of the reverse index, in bytes.
*/
public int getReverseIndexSize() {
return (int) Math.min(objectCount * 8, Integer.MAX_VALUE);
}
/** @return number of objects in the pack. */
public long getObjectCount() {
return objectCount;

8
org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackFile.java

@ -265,11 +265,9 @@ public final class DfsPackFile {
return revidx;
}
PackIndex fwdidx = idx(ctx);
PackReverseIndex revidx = new PackReverseIndex(fwdidx);
long objCnt = fwdidx.getObjectCount();
int sz = (int) Math.min(objCnt * 8, Integer.MAX_VALUE);
reverseIndex = cache.put(key, POS_REVERSE_INDEX, sz, revidx);
PackReverseIndex revidx = new PackReverseIndex(idx(ctx));
reverseIndex = cache.put(key, POS_REVERSE_INDEX,
packDesc.getReverseIndexSize(), revidx);
return revidx;
}
}

Loading…
Cancel
Save