Class LooseObjects
- java.lang.Object
-
- org.eclipse.jgit.internal.storage.file.LooseObjects
-
class LooseObjects extends java.lang.ObjectTraditional file system based loose objects handler.This is the loose object representation for a Git object database, where objects are stored loose by hashing them into directories by their
ObjectId.
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.Filedirectoryprivate static org.slf4j.LoggerLOGprivate UnpackedObjectCacheunpackedObjectCache
-
Constructor Summary
Constructors Constructor Description LooseObjects(java.io.File dir)Initialize a reference to an on-disk object directory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidclose()(package private) voidcreate()(package private) java.io.FilefileFor(AnyObjectId objectId)Compute the location of a loose object file.(package private) java.io.FilegetDirectory()Getter for the fielddirectory.(package private) longgetSize(WindowCursor curs, AnyObjectId id)(package private) booleanhas(AnyObjectId objectId)Does the requested object exist as a loose object?(package private) booleanhasCached(AnyObjectId id)(package private) FileObjectDatabase.InsertLooseObjectResultinsert(java.io.File tmp, ObjectId id)(package private) ObjectLoaderopen(WindowCursor curs, AnyObjectId id)(package private) booleanresolve(java.util.Set<ObjectId> matches, AbbreviatedObjectId id, int matchLimit)Find objects matching the prefix abbreviation.java.lang.StringtoString()private FileObjectDatabase.InsertLooseObjectResulttryMove(java.io.File tmp, java.io.File dst, ObjectId id)
-
-
-
Field Detail
-
LOG
private static final org.slf4j.Logger LOG
-
directory
private final java.io.File directory
-
unpackedObjectCache
private final UnpackedObjectCache unpackedObjectCache
-
-
Method Detail
-
getDirectory
java.io.File getDirectory()
Getter for the fielddirectory.- Returns:
- the location of the
objectsdirectory.
-
create
void create() throws java.io.IOException- Throws:
java.io.IOException
-
close
void close()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
hasCached
boolean hasCached(AnyObjectId id)
-
has
boolean has(AnyObjectId objectId)
Does the requested object exist as a loose object?- Parameters:
objectId- identity of the object to test for existence of.- Returns:
trueif the specified object is stored as a loose object.
-
resolve
boolean resolve(java.util.Set<ObjectId> matches, AbbreviatedObjectId id, int matchLimit)
Find objects matching the prefix abbreviation.- Parameters:
matches- set to add any located ObjectIds to. This is an output parameter.id- prefix to search for.matchLimit- maximum number of results to return. At most this many ObjectIds should be added to matches before returning.- Returns:
trueif the matches were exhausted before reachingmaxLimit.
-
open
ObjectLoader open(WindowCursor curs, AnyObjectId id) throws java.io.IOException
- Throws:
java.io.IOException
-
getSize
long getSize(WindowCursor curs, AnyObjectId id) throws java.io.IOException
- Throws:
java.io.IOException
-
insert
FileObjectDatabase.InsertLooseObjectResult insert(java.io.File tmp, ObjectId id) throws java.io.IOException
- Throws:
java.io.IOException
-
tryMove
private FileObjectDatabase.InsertLooseObjectResult tryMove(java.io.File tmp, java.io.File dst, ObjectId id) throws java.io.IOException
- Throws:
java.io.IOException
-
fileFor
java.io.File fileFor(AnyObjectId objectId)
Compute the location of a loose object file.- Parameters:
objectId- identity of the object to get the File location for.- Returns:
Filelocation of the specified loose object.
-
-