Browse Source

Merge "Expose some DFS APIs as public or protected"

stable-2.1
Shawn O. Pearce 12 years ago committed by Gerrit Code Review @ Eclipse.org
parent
commit
0be3b0f70e
  1. 3
      org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsObjDatabase.java
  2. 14
      org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackFile.java
  3. 8
      org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsReader.java

3
org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsObjDatabase.java

@ -423,7 +423,8 @@ public abstract class DfsObjDatabase extends ObjectDatabase {
return forReuse; return forReuse;
} }
void clearCache() { /** Clears the cached list of packs, forcing them to be scanned again. */
protected void clearCache() {
packList.set(NO_PACKS); packList.set(NO_PACKS);
} }

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

@ -272,7 +272,19 @@ public final class DfsPackFile {
} }
} }
boolean hasObject(DfsReader ctx, AnyObjectId id) throws IOException { /**
* Check if an object is stored within this pack.
*
* @param ctx
* reader context to support reading from the backing store if
* the index is not already loaded in memory.
* @param id
* object to be located.
* @return true if the object exists in this pack; false if it does not.
* @throws IOException
* the pack index is not available, or is corrupt.
*/
public boolean hasObject(DfsReader ctx, AnyObjectId id) throws IOException {
final long offset = idx(ctx).findOffset(id); final long offset = idx(ctx).findOffset(id);
return 0 < offset && !isCorrupt(offset); return 0 < offset && !isCorrupt(offset);
} }

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

@ -90,7 +90,13 @@ import org.eclipse.jgit.storage.pack.PackOutputStream;
import org.eclipse.jgit.storage.pack.PackWriter; import org.eclipse.jgit.storage.pack.PackWriter;
import org.eclipse.jgit.util.BlockList; import org.eclipse.jgit.util.BlockList;
final class DfsReader extends ObjectReader implements ObjectReuseAsIs { /**
* Reader to access repository content through.
* <p>
* See the base {@link ObjectReader} documentation for details. Notably, a
* reader is not thread safe.
*/
public final class DfsReader extends ObjectReader implements ObjectReuseAsIs {
/** Temporary buffer large enough for at least one raw object id. */ /** Temporary buffer large enough for at least one raw object id. */
final byte[] tempId = new byte[OBJECT_ID_LENGTH]; final byte[] tempId = new byte[OBJECT_ID_LENGTH];

Loading…
Cancel
Save