Class LooseObjects
java.lang.Object
org.eclipse.jgit.internal.storage.file.LooseObjects
Traditional 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
FieldsModifier and TypeFieldDescriptionprivate final File
private static final org.slf4j.Logger
private final UnpackedObjectCache
-
Constructor Summary
ConstructorsConstructorDescriptionLooseObjects
(File dir) Initialize a reference to an on-disk object directory. -
Method Summary
Modifier and TypeMethodDescription(package private) void
close()
(package private) void
create()
(package private) File
fileFor
(AnyObjectId objectId) Compute the location of a loose object file.(package private) File
Getter for the fielddirectory
.(package private) long
getSize
(WindowCursor curs, AnyObjectId id) (package private) boolean
has
(AnyObjectId objectId) Does the requested object exist as a loose object?(package private) boolean
hasCached
(AnyObjectId id) (package private) FileObjectDatabase.InsertLooseObjectResult
(package private) ObjectLoader
open
(WindowCursor curs, AnyObjectId id) (package private) boolean
resolve
(Set<ObjectId> matches, AbbreviatedObjectId id, int matchLimit) Find objects matching the prefix abbreviation.toString()
-
Field Details
-
LOG
private static final org.slf4j.Logger LOG -
directory
-
unpackedObjectCache
-
-
Constructor Details
-
LooseObjects
LooseObjects(File dir) Initialize a reference to an on-disk object directory.- Parameters:
dir
- the location of theobjects
directory.
-
-
Method Details
-
getDirectory
File getDirectory()Getter for the fielddirectory
.- Returns:
- the location of the
objects
directory.
-
create
- Throws:
IOException
-
close
void close() -
toString
-
hasCached
-
has
Does the requested object exist as a loose object?- Parameters:
objectId
- identity of the object to test for existence of.- Returns:
true
if the specified object is stored as a loose object.
-
resolve
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:
true
if the matches were exhausted before reachingmaxLimit
.
-
open
- Throws:
IOException
-
getSize
- Throws:
IOException
-
insert
- Throws:
IOException
-
tryMove
private FileObjectDatabase.InsertLooseObjectResult tryMove(File tmp, File dst, ObjectId id) throws IOException - Throws:
IOException
-
fileFor
Compute the location of a loose object file.- Parameters:
objectId
- identity of the object to get the File location for.- Returns:
File
location of the specified loose object.
-