packs) {
odb = null;
packNames = null;
- this.packs = packs.toArray(new PackFile[0]);
+ this.packs = packs.toArray(new Pack[0]);
}
/** {@inheritDoc} */
@Override
public long getObjectCount() throws IOException {
long cnt = 0;
- for (PackFile pack : getPacks())
+ for (Pack pack : getPacks())
cnt += pack.getObjectCount();
return cnt;
}
void copyAsIs(PackOutputStream out, WindowCursor wc)
throws IOException {
- for (PackFile pack : getPacks())
+ for (Pack pack : getPacks())
pack.copyPackAsIs(out, wc);
}
@@ -58,7 +58,7 @@ void copyAsIs(PackOutputStream out, WindowCursor wc)
public boolean hasObject(ObjectToPack obj, StoredObjectRepresentation rep) {
try {
LocalObjectRepresentation local = (LocalObjectRepresentation) rep;
- for (PackFile pack : getPacks()) {
+ for (Pack pack : getPacks()) {
if (local.pack == pack)
return true;
}
@@ -68,9 +68,9 @@ public boolean hasObject(ObjectToPack obj, StoredObjectRepresentation rep) {
}
}
- private PackFile[] getPacks() throws FileNotFoundException {
+ private Pack[] getPacks() throws FileNotFoundException {
if (packs == null) {
- PackFile[] p = new PackFile[packNames.length];
+ Pack[] p = new Pack[packNames.length];
for (int i = 0; i < packNames.length; i++)
p[i] = getPackFile(packNames[i]);
packs = p;
@@ -78,8 +78,8 @@ private PackFile[] getPacks() throws FileNotFoundException {
return packs;
}
- private PackFile getPackFile(String packName) throws FileNotFoundException {
- for (PackFile pack : odb.getPacks()) {
+ private Pack getPackFile(String packName) throws FileNotFoundException {
+ for (Pack pack : odb.getPacks()) {
if (packName.equals(pack.getPackName()))
return pack;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LocalObjectRepresentation.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LocalObjectRepresentation.java
index 3950dde4a..559718af3 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LocalObjectRepresentation.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LocalObjectRepresentation.java
@@ -16,40 +16,40 @@
import org.eclipse.jgit.lib.ObjectId;
class LocalObjectRepresentation extends StoredObjectRepresentation {
- static LocalObjectRepresentation newWhole(PackFile f, long p, long length) {
+ static LocalObjectRepresentation newWhole(Pack pack, long offset, long length) {
LocalObjectRepresentation r = new LocalObjectRepresentation() {
@Override
public int getFormat() {
return PACK_WHOLE;
}
};
- r.pack = f;
- r.offset = p;
+ r.pack = pack;
+ r.offset = offset;
r.length = length;
return r;
}
- static LocalObjectRepresentation newDelta(PackFile f, long p, long n,
+ static LocalObjectRepresentation newDelta(Pack pack, long offset, long length,
ObjectId base) {
LocalObjectRepresentation r = new Delta();
- r.pack = f;
- r.offset = p;
- r.length = n;
+ r.pack = pack;
+ r.offset = offset;
+ r.length = length;
r.baseId = base;
return r;
}
- static LocalObjectRepresentation newDelta(PackFile f, long p, long n,
+ static LocalObjectRepresentation newDelta(Pack pack, long offset, long length,
long base) {
LocalObjectRepresentation r = new Delta();
- r.pack = f;
- r.offset = p;
- r.length = n;
+ r.pack = pack;
+ r.offset = offset;
+ r.length = length;
r.baseOffset = base;
return r;
}
- PackFile pack;
+ Pack pack;
long offset;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LocalObjectToPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LocalObjectToPack.java
index 4a0ac1fd8..ac6cd212d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LocalObjectToPack.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LocalObjectToPack.java
@@ -17,7 +17,7 @@
/** {@link ObjectToPack} for {@link ObjectDirectory}. */
class LocalObjectToPack extends ObjectToPack {
/** Pack to reuse compressed data from, otherwise null. */
- PackFile pack;
+ Pack pack;
/** Offset of the object's header in {@link #pack}. */
long offset;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java
index 4a40db68d..e71a96060 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java
@@ -51,7 +51,7 @@
* This is the classical object database representation for a Git repository,
* where objects are stored loose by hashing them into directories by their
* {@link org.eclipse.jgit.lib.ObjectId}, or are stored in compressed containers
- * known as {@link org.eclipse.jgit.internal.storage.file.PackFile}s.
+ * known as {@link org.eclipse.jgit.internal.storage.file.Pack}s.
*
* Optionally an object database can reference one or more alternates; other
* ObjectDatabase instances that are searched in addition to the current
@@ -206,7 +206,7 @@ public void close() {
/** {@inheritDoc} */
@Override
- public Collection getPacks() {
+ public Collection getPacks() {
return packed.getPacks();
}
@@ -216,7 +216,7 @@ public Collection getPacks() {
* Add a single existing pack to the list of available pack files.
*/
@Override
- public PackFile openPack(File pack)
+ public Pack openPack(File pack)
throws IOException {
final String p = pack.getName();
if (p.length() != 50 || !p.startsWith("pack-") || !p.endsWith(".pack")) //$NON-NLS-1$ //$NON-NLS-2$
@@ -235,7 +235,7 @@ public PackFile openPack(File pack)
}
}
- PackFile res = new PackFile(pack, extensions);
+ Pack res = new Pack(pack, extensions);
packed.insert(res);
return res;
}
@@ -509,7 +509,7 @@ void closeAllPackHandles(File packFile) {
// PackConfig) then make sure we get rid of all handles on the file.
// Windows will not allow for rename otherwise.
if (packFile.exists()) {
- for (PackFile p : packed.getPacks()) {
+ for (Pack p : packed.getPacks()) {
if (packFile.getPath().equals(p.getPackFile().getPath())) {
p.close();
break;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryPackParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryPackParser.java
index e27518690..04d2ff8ab 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryPackParser.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryPackParser.java
@@ -88,7 +88,7 @@ public class ObjectDirectoryPackParser extends PackParser {
private Deflater def;
/** The pack that was created, if parsing was successful. */
- private PackFile newPack;
+ private Pack newPack;
private PackConfig pconfig;
@@ -129,14 +129,14 @@ public void setKeepEmpty(boolean empty) {
}
/**
- * Get the imported {@link org.eclipse.jgit.internal.storage.file.PackFile}.
+ * Get the imported {@link org.eclipse.jgit.internal.storage.file.Pack}.
*
* This method is supplied only to support testing; applications shouldn't
* be using it directly to access the imported data.
*
* @return the imported PackFile, if parsing was successful.
*/
- public PackFile getPackFile() {
+ public Pack getPack() {
return newPack;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/Pack.java
similarity index 99%
rename from org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java
rename to org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/Pack.java
index e112fe744..d928633a7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/Pack.java
@@ -69,13 +69,13 @@
* delta packed format yielding high compression of lots of object where some
* objects are similar.
*/
-public class PackFile implements Iterable {
- private static final Logger LOG = LoggerFactory.getLogger(PackFile.class);
+public class Pack implements Iterable {
+ private static final Logger LOG = LoggerFactory.getLogger(Pack.class);
/**
* Sorts PackFiles to be most recently created to least recently created.
*/
- public static final Comparator SORT = (a, b) -> b.packLastModified
+ public static final Comparator SORT = (a, b) -> b.packLastModified
.compareTo(a.packLastModified);
private final File packFile;
@@ -136,7 +136,7 @@ public class PackFile implements Iterable {
* @param extensions
* additional pack file extensions with the same base as the pack
*/
- public PackFile(File packFile, int extensions) {
+ public Pack(File packFile, int extensions) {
this.packFile = packFile;
this.fileSnapshot = PackFileSnapshot.save(packFile);
this.packLastModified = fileSnapshot.lastModifiedInstant();
@@ -1201,7 +1201,7 @@ private boolean hasExt(PackExt ext) {
@SuppressWarnings("nls")
@Override
public String toString() {
- return "PackFile [packFileName=" + packFile.getName() + ", length="
+ return "Pack [packFileName=" + packFile.getName() + ", length="
+ packFile.length() + ", packChecksum="
+ ObjectId.fromRaw(packChecksum).name() + "]";
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackDirectory.java
index fd9da7c6c..b2ba36bf9 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackDirectory.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackDirectory.java
@@ -47,16 +47,17 @@
/**
* Traditional file system packed objects directory handler.
*
- * This is the {@code PackFile}s object representation for a Git object
- * database, where objects are stored in compressed containers known as
- * {@link org.eclipse.jgit.internal.storage.file.PackFile}s.
+ * This is the {@link org.eclipse.jgit.internal.storage.file.Pack}s object
+ * representation for a Git object database, where objects are stored in
+ * compressed containers known as
+ * {@link org.eclipse.jgit.internal.storage.file.Pack}s.
*/
class PackDirectory {
private final static Logger LOG = LoggerFactory
.getLogger(PackDirectory.class);
private static final PackList NO_PACKS = new PackList(FileSnapshot.DIRTY,
- new PackFile[0]);
+ new Pack[0]);
private final Config config;
@@ -94,18 +95,18 @@ void create() throws IOException {
void close() {
PackList packs = packList.get();
if (packs != NO_PACKS && packList.compareAndSet(packs, NO_PACKS)) {
- for (PackFile p : packs.packs) {
+ for (Pack p : packs.packs) {
p.close();
}
}
}
- Collection getPacks() {
+ Collection getPacks() {
PackList list = packList.get();
if (list == NO_PACKS) {
list = scanPacks(list);
}
- PackFile[] packs = list.packs;
+ Pack[] packs = list.packs;
return Collections.unmodifiableCollection(Arrays.asList(packs));
}
@@ -126,7 +127,7 @@ boolean has(AnyObjectId objectId) {
PackList pList;
do {
pList = packList.get();
- for (PackFile p : pList.packs) {
+ for (Pack p : pList.packs) {
try {
if (p.hasObject(objectId)) {
return true;
@@ -167,7 +168,7 @@ boolean resolve(Set matches, AbbreviatedObjectId id,
PackList pList;
do {
pList = packList.get();
- for (PackFile p : pList.packs) {
+ for (Pack p : pList.packs) {
try {
p.resolve(matches, id, matchLimit);
p.resetTransientErrorCount();
@@ -187,7 +188,7 @@ ObjectLoader open(WindowCursor curs, AnyObjectId objectId) {
do {
SEARCH: for (;;) {
pList = packList.get();
- for (PackFile p : pList.packs) {
+ for (Pack p : pList.packs) {
try {
ObjectLoader ldr = p.get(curs, objectId);
p.resetTransientErrorCount();
@@ -213,7 +214,7 @@ long getSize(WindowCursor curs, AnyObjectId id) {
do {
SEARCH: for (;;) {
pList = packList.get();
- for (PackFile p : pList.packs) {
+ for (Pack p : pList.packs) {
try {
long len = p.getObjectSize(curs, id);
p.resetTransientErrorCount();
@@ -239,7 +240,7 @@ void selectRepresentation(PackWriter packer, ObjectToPack otp,
WindowCursor curs) {
PackList pList = packList.get();
SEARCH: for (;;) {
- for (PackFile p : pList.packs) {
+ for (Pack p : pList.packs) {
try {
LocalObjectRepresentation rep = p.representation(curs, otp);
p.resetTransientErrorCount();
@@ -259,7 +260,7 @@ void selectRepresentation(PackWriter packer, ObjectToPack otp,
}
}
- private void handlePackError(IOException e, PackFile p) {
+ private void handlePackError(IOException e, Pack p) {
String warnTmpl = null;
int transientErrorCount = 0;
String errTmpl = JGitText.get().exceptionWhileReadingPack;
@@ -322,7 +323,7 @@ boolean searchPacksAgain(PackList old) {
&& old != scanPacks(old);
}
- void insert(PackFile pf) {
+ void insert(Pack pack) {
PackList o, n;
do {
o = packList.get();
@@ -331,33 +332,33 @@ void insert(PackFile pf) {
// (picked up by a concurrent thread that did a scan?) we
// do not want to insert it a second time.
//
- final PackFile[] oldList = o.packs;
- final String name = pf.getPackFile().getName();
- for (PackFile p : oldList) {
+ final Pack[] oldList = o.packs;
+ final String name = pack.getPackFile().getName();
+ for (Pack p : oldList) {
if (name.equals(p.getPackFile().getName())) {
return;
}
}
- final PackFile[] newList = new PackFile[1 + oldList.length];
- newList[0] = pf;
+ final Pack[] newList = new Pack[1 + oldList.length];
+ newList[0] = pack;
System.arraycopy(oldList, 0, newList, 1, oldList.length);
n = new PackList(o.snapshot, newList);
} while (!packList.compareAndSet(o, n));
}
- private void remove(PackFile deadPack) {
+ private void remove(Pack deadPack) {
PackList o, n;
do {
o = packList.get();
- final PackFile[] oldList = o.packs;
+ final Pack[] oldList = o.packs;
final int j = indexOf(oldList, deadPack);
if (j < 0) {
break;
}
- final PackFile[] newList = new PackFile[oldList.length - 1];
+ final Pack[] newList = new Pack[oldList.length - 1];
System.arraycopy(oldList, 0, newList, 0, j);
System.arraycopy(oldList, j + 1, newList, j, newList.length - j);
n = new PackList(o.snapshot, newList);
@@ -365,7 +366,7 @@ private void remove(PackFile deadPack) {
deadPack.close();
}
- private static int indexOf(PackFile[] list, PackFile pack) {
+ private static int indexOf(Pack[] list, Pack pack) {
for (int i = 0; i < list.length; i++) {
if (list[i] == pack) {
return i;
@@ -395,10 +396,10 @@ private PackList scanPacks(PackList original) {
}
private PackList scanPacksImpl(PackList old) {
- final Map forReuse = reuseMap(old);
+ final Map forReuse = reuseMap(old);
final FileSnapshot snapshot = FileSnapshot.save(directory);
final Set names = listPackDirectory();
- final List list = new ArrayList<>(names.size() >> 2);
+ final List list = new ArrayList<>(names.size() >> 2);
boolean foundNew = false;
for (String indexName : names) {
// Must match "pack-[0-9a-f]{40}.idx" to be an index.
@@ -425,7 +426,7 @@ private PackList scanPacksImpl(PackList old) {
final String packName = base + PACK.getExtension();
final File packFile = new File(directory, packName);
- final PackFile oldPack = forReuse.get(packName);
+ final Pack oldPack = forReuse.get(packName);
if (oldPack != null
&& !oldPack.getFileSnapshot().isModified(packFile)) {
forReuse.remove(packName);
@@ -433,7 +434,7 @@ private PackList scanPacksImpl(PackList old) {
continue;
}
- list.add(new PackFile(packFile, extensions));
+ list.add(new Pack(packFile, extensions));
foundNew = true;
}
@@ -447,7 +448,7 @@ private PackList scanPacksImpl(PackList old) {
return old;
}
- for (PackFile p : forReuse.values()) {
+ for (Pack p : forReuse.values()) {
p.close();
}
@@ -455,14 +456,14 @@ private PackList scanPacksImpl(PackList old) {
return new PackList(snapshot, NO_PACKS.packs);
}
- final PackFile[] r = list.toArray(new PackFile[0]);
- Arrays.sort(r, PackFile.SORT);
+ final Pack[] r = list.toArray(new Pack[0]);
+ Arrays.sort(r, Pack.SORT);
return new PackList(snapshot, r);
}
- private static Map reuseMap(PackList old) {
- final Map forReuse = new HashMap<>();
- for (PackFile p : old.packs) {
+ private static Map reuseMap(PackList old) {
+ final Map forReuse = new HashMap<>();
+ for (Pack p : old.packs) {
if (p.invalid()) {
// The pack instance is corrupted, and cannot be safely used
// again. Do not include it in our reuse map.
@@ -471,7 +472,7 @@ private static Map reuseMap(PackList old) {
continue;
}
- final PackFile prior = forReuse.put(p.getPackFile().getName(), p);
+ final Pack prior = forReuse.put(p.getPackFile().getName(), p);
if (prior != null) {
// This should never occur. It should be impossible for us
// to have two pack files with the same name, as all of them
@@ -504,10 +505,10 @@ static final class PackList {
/** State just before reading the pack directory. */
final FileSnapshot snapshot;
- /** All known packs, sorted by {@link PackFile#SORT}. */
- final PackFile[] packs;
+ /** All known packs, sorted by {@link Pack#SORT}. */
+ final Pack[] packs;
- PackList(FileSnapshot monitor, PackFile[] packs) {
+ PackList(FileSnapshot monitor, Pack[] packs) {
this.snapshot = monitor;
this.packs = packs;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndex.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndex.java
index 31686befc..942cc9674 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndex.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndex.java
@@ -34,7 +34,7 @@
/**
* Access path to locate objects by {@link org.eclipse.jgit.lib.ObjectId} in a
- * {@link org.eclipse.jgit.internal.storage.file.PackFile}.
+ * {@link org.eclipse.jgit.internal.storage.file.Pack}.
*
* Indexes are strictly redundant information in that we can rebuild all of the
* data held in the index file from the on disk representation of the pack file
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexWriter.java
index 612b12366..87e0b44d4 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexWriter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexWriter.java
@@ -25,7 +25,7 @@
/**
* Creates a table of contents to support random access by
- * {@link org.eclipse.jgit.internal.storage.file.PackFile}.
+ * {@link org.eclipse.jgit.internal.storage.file.Pack}.
*
* Pack index files (the .idx
suffix in a pack file pair) provides
* random access to any object in the pack by associating an ObjectId to the
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackInputStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackInputStream.java
index a9e058888..0bceca72e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackInputStream.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackInputStream.java
@@ -16,11 +16,11 @@
class PackInputStream extends InputStream {
private final WindowCursor wc;
- private final PackFile pack;
+ private final Pack pack;
private long pos;
- PackInputStream(PackFile pack, long pos, WindowCursor wc)
+ PackInputStream(Pack pack, long pos, WindowCursor wc)
throws IOException {
this.pack = pack;
this.pos = pos;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackLock.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackLock.java
index 2c2f7911a..482b143e3 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackLock.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackLock.java
@@ -18,7 +18,7 @@
import org.eclipse.jgit.util.FileUtils;
/**
- * Keeps track of a {@link org.eclipse.jgit.internal.storage.file.PackFile}'s
+ * Keeps track of a {@link org.eclipse.jgit.internal.storage.file.Pack}'s
* associated .keep
file.
*/
public class PackLock {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackReverseIndex.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackReverseIndex.java
index 4d80a0312..ee458e27b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackReverseIndex.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackReverseIndex.java
@@ -25,7 +25,7 @@
*
*
* @see PackIndex
- * @see PackFile
+ * @see Pack
*/
public class PackReverseIndex {
/** Index we were created from, and that has our ObjectId data. */
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WindowCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WindowCache.java
index 3e8cb3a3f..25653b3ce 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WindowCache.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WindowCache.java
@@ -33,7 +33,7 @@
import org.eclipse.jgit.util.Monitoring;
/**
- * Caches slices of a {@link org.eclipse.jgit.internal.storage.file.PackFile} in
+ * Caches slices of a {@link org.eclipse.jgit.internal.storage.file.Pack} in
* memory for faster read access.
*
* The WindowCache serves as a Java based "buffer cache", loading segments of a
@@ -41,7 +41,7 @@
* only tiny slices of a file, the WindowCache tries to smooth out these tiny
* reads into larger block-sized IO operations.
*
- * Whenever a cache miss occurs, {@link #load(PackFile, long)} is invoked by
+ * Whenever a cache miss occurs, {@link #load(Pack, long)} is invoked by
* exactly one thread for the given (PackFile,position)
key tuple.
* This is ensured by an array of locks, with the tuple hashed to a lock
* instance.
@@ -80,10 +80,10 @@
*
* This cache has an implementation rule such that:
*
- * - {@link #load(PackFile, long)} is invoked by at most one thread at a time
+ *
- {@link #load(Pack, long)} is invoked by at most one thread at a time
* for a given
(PackFile,position)
tuple.
* - For every
load()
invocation there is exactly one
- * {@link #createRef(PackFile, long, ByteWindow)} invocation to wrap a
+ * {@link #createRef(Pack, long, ByteWindow)} invocation to wrap a
* SoftReference or a StrongReference around the cached entity.
* - For every Reference created by
createRef()
there will be
* exactly one call to {@link #clear(PageRef)} to cleanup any resources associated
@@ -91,10 +91,10 @@
*
*
* Therefore, it is safe to perform resource accounting increments during the
- * {@link #load(PackFile, long)} or
- * {@link #createRef(PackFile, long, ByteWindow)} methods, and matching
+ * {@link #load(Pack, long)} or
+ * {@link #createRef(Pack, long, ByteWindow)} methods, and matching
* decrements during {@link #clear(PageRef)}. Implementors may need to override
- * {@link #createRef(PackFile, long, ByteWindow)} in order to embed additional
+ * {@link #createRef(Pack, long, ByteWindow)} in order to embed additional
* accounting information into an implementation specific
* {@link org.eclipse.jgit.internal.storage.file.WindowCache.PageRef} subclass, as
* the cached entity may have already been evicted by the JRE's garbage
@@ -170,7 +170,7 @@ static interface StatsRecorder {
* @param delta
* delta of cached bytes
*/
- void recordOpenBytes(PackFile pack, int delta);
+ void recordOpenBytes(Pack pack, int delta);
/**
* Returns a snapshot of this recorder's stats. Note that this may be an
@@ -242,7 +242,7 @@ public void recordOpenFiles(int delta) {
}
@Override
- public void recordOpenBytes(PackFile pack, int delta) {
+ public void recordOpenBytes(Pack pack, int delta) {
openByteCount.add(delta);
String repositoryId = repositoryId(pack);
LongAdder la = openByteCountPerRepository
@@ -254,9 +254,8 @@ public void recordOpenBytes(PackFile pack, int delta) {
}
}
- private static String repositoryId(PackFile pack) {
- // use repository's gitdir since packfile doesn't know its
- // repository
+ private static String repositoryId(Pack pack) {
+ // use repository's gitdir since Pack doesn't know its repository
return pack.getPackFile().getParentFile().getParentFile()
.getParent();
}
@@ -380,7 +379,7 @@ public static WindowCache getInstance() {
return cache.publishMBeanIfNeeded();
}
- static final ByteWindow get(PackFile pack, long offset)
+ static final ByteWindow get(Pack pack, long offset)
throws IOException {
final WindowCache c = cache;
final ByteWindow r = c.getOrLoad(pack, c.toStart(offset));
@@ -395,7 +394,7 @@ static final ByteWindow get(PackFile pack, long offset)
return r;
}
- static final void purge(PackFile pack) {
+ static final void purge(Pack pack) {
cache.removeAll(pack);
}
@@ -506,7 +505,7 @@ private int hash(int packHash, long off) {
return packHash + (int) (off >>> windowSizeShift);
}
- private ByteWindow load(PackFile pack, long offset) throws IOException {
+ private ByteWindow load(Pack pack, long offset) throws IOException {
long startTime = System.nanoTime();
if (pack.beginWindowCache())
statsRecorder.recordOpenFiles(1);
@@ -525,7 +524,7 @@ private ByteWindow load(PackFile pack, long offset) throws IOException {
}
}
- private PageRef createRef(PackFile p, long o, ByteWindow v) {
+ private PageRef createRef(Pack p, long o, ByteWindow v) {
final PageRef ref = useStrongRefs
? new StrongRef(p, o, v, queue)
: new SoftRef(p, o, v, (SoftCleanupQueue) queue);
@@ -539,7 +538,7 @@ private void clear(PageRef ref) {
close(ref.getPack());
}
- private void close(PackFile pack) {
+ private void close(Pack pack) {
if (pack.endWindowCache()) {
statsRecorder.recordOpenFiles(-1);
}
@@ -578,9 +577,9 @@ private static int lockCount(WindowCacheConfig cfg) {
* @return the object reference.
* @throws IOException
* the object reference was not in the cache and could not be
- * obtained by {@link #load(PackFile, long)}.
+ * obtained by {@link #load(Pack, long)}.
*/
- private ByteWindow getOrLoad(PackFile pack, long position)
+ private ByteWindow getOrLoad(Pack pack, long position)
throws IOException {
final int slot = slot(pack, position);
final Entry e1 = table.get(slot);
@@ -623,7 +622,7 @@ private ByteWindow getOrLoad(PackFile pack, long position)
return v;
}
- private ByteWindow scan(Entry n, PackFile pack, long position) {
+ private ByteWindow scan(Entry n, Pack pack, long position) {
for (; n != null; n = n.next) {
final PageRef r = n.ref;
if (r.getPack() == pack && r.getPosition() == position) {
@@ -704,7 +703,7 @@ private void removeAll() {
/**
* Clear all entries related to a single file.
*
- * Typically this method is invoked during {@link PackFile#close()}, when we
+ * Typically this method is invoked during {@link Pack#close()}, when we
* know the pack is never going to be useful to us again (for example, it no
* longer exists on disk). A concurrent reader loading an entry from this
* same pack may cause the pack to become stuck in the cache anyway.
@@ -712,7 +711,7 @@ private void removeAll() {
* @param pack
* the file to purge all entries of.
*/
- private void removeAll(PackFile pack) {
+ private void removeAll(Pack pack) {
for (int s = 0; s < tableSize; s++) {
final Entry e1 = table.get(s);
boolean hasDead = false;
@@ -733,11 +732,11 @@ private void gc() {
queue.gc();
}
- private int slot(PackFile pack, long position) {
+ private int slot(Pack pack, long position) {
return (hash(pack.hash, position) >>> 1) % tableSize;
}
- private Lock lock(PackFile pack, long position) {
+ private Lock lock(Pack pack, long position) {
return locks[(hash(pack.hash, position) >>> 1) % locks.length];
}
@@ -799,16 +798,20 @@ private static interface PageRef {
boolean kill();
/**
- * Get the packfile the referenced cache page is allocated for
+ * Get the {@link org.eclipse.jgit.internal.storage.file.Pack} the
+ * referenced cache page is allocated for
*
- * @return the packfile the referenced cache page is allocated for
+ * @return the {@link org.eclipse.jgit.internal.storage.file.Pack} the
+ * referenced cache page is allocated for
*/
- PackFile getPack();
+ Pack getPack();
/**
- * Get the position of the referenced cache page in the packfile
+ * Get the position of the referenced cache page in the
+ * {@link org.eclipse.jgit.internal.storage.file.Pack}
*
- * @return the position of the referenced cache page in the packfile
+ * @return the position of the referenced cache page in the
+ * {@link org.eclipse.jgit.internal.storage.file.Pack}
*/
long getPosition();
@@ -844,7 +847,7 @@ private static interface PageRef {
/** A soft reference wrapped around a cached object. */
private static class SoftRef extends SoftReference
implements PageRef {
- private final PackFile pack;
+ private final Pack pack;
private final long position;
@@ -852,7 +855,7 @@ private static class SoftRef extends SoftReference
private long lastAccess;
- protected SoftRef(final PackFile pack, final long position,
+ protected SoftRef(final Pack pack, final long position,
final ByteWindow v, final SoftCleanupQueue queue) {
super(v, queue);
this.pack = pack;
@@ -861,7 +864,7 @@ protected SoftRef(final PackFile pack, final long position,
}
@Override
- public PackFile getPack() {
+ public Pack getPack() {
return pack;
}
@@ -900,7 +903,7 @@ public boolean isStrongRef() {
private static class StrongRef implements PageRef {
private ByteWindow referent;
- private final PackFile pack;
+ private final Pack pack;
private final long position;
@@ -910,7 +913,7 @@ private static class StrongRef implements PageRef {
private CleanupQueue queue;
- protected StrongRef(final PackFile pack, final long position,
+ protected StrongRef(final Pack pack, final long position,
final ByteWindow v, final CleanupQueue queue) {
this.pack = pack;
this.position = position;
@@ -920,7 +923,7 @@ protected StrongRef(final PackFile pack, final long position,
}
@Override
- public PackFile getPack() {
+ public Pack getPack() {
return pack;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WindowCursor.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WindowCursor.java
index 6c975708a..e7fd7b9e7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WindowCursor.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WindowCursor.java
@@ -86,7 +86,7 @@ public ObjectReader newReader() {
/** {@inheritDoc} */
@Override
public BitmapIndex getBitmapIndex() throws IOException {
- for (PackFile pack : db.getPacks()) {
+ for (Pack pack : db.getPacks()) {
PackBitmapIndex index = pack.getBitmapIndex();
if (index != null)
return new BitmapIndexImpl(index);
@@ -98,7 +98,7 @@ public BitmapIndex getBitmapIndex() throws IOException {
@Override
public Collection getCachedPacksAndUpdate(
BitmapBuilder needBitmap) throws IOException {
- for (PackFile pack : db.getPacks()) {
+ for (Pack pack : db.getPacks()) {
PackBitmapIndex index = pack.getBitmapIndex();
if (needBitmap.removeAllOrNone(index))
return Collections. singletonList(
@@ -218,7 +218,7 @@ public void writeObjects(PackOutputStream out, List list)
* this cursor does not match the provider or id and the proper
* window could not be acquired through the provider's cache.
*/
- int copy(final PackFile pack, long position, final byte[] dstbuf,
+ int copy(final Pack pack, long position, final byte[] dstbuf,
int dstoff, final int cnt) throws IOException {
final long length = pack.length;
int need = cnt;
@@ -239,7 +239,7 @@ public void copyPackAsIs(PackOutputStream out, CachedPack pack)
((LocalCachedPack) pack).copyAsIs(out, this);
}
- void copyPackAsIs(final PackFile pack, final long length,
+ void copyPackAsIs(final Pack pack, final long length,
final PackOutputStream out) throws IOException {
long position = 12;
long remaining = length - (12 + 20);
@@ -275,7 +275,7 @@ void copyPackAsIs(final PackFile pack, final long length,
* the inflater encountered an invalid chunk of data. Data
* stream corruption is likely.
*/
- int inflate(final PackFile pack, long position, final byte[] dstbuf,
+ int inflate(final Pack pack, long position, final byte[] dstbuf,
boolean headerOnly) throws IOException, DataFormatException {
prepareInflater();
pin(pack, position);
@@ -293,7 +293,7 @@ int inflate(final PackFile pack, long position, final byte[] dstbuf,
}
}
- ByteArrayWindow quickCopy(PackFile p, long pos, long cnt)
+ ByteArrayWindow quickCopy(Pack p, long pos, long cnt)
throws IOException {
pin(p, pos);
if (window instanceof ByteArrayWindow
@@ -314,7 +314,7 @@ private void prepareInflater() {
inf.reset();
}
- void pin(PackFile pack, long position)
+ void pin(Pack pack, long position)
throws IOException {
final ByteWindow w = window;
if (w == null || !w.contains(pack, position)) {