Class LooseObjects
- java.lang.Object
-
- org.eclipse.jgit.internal.storage.file.LooseObjects
-
class LooseObjects extends java.lang.Object
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
Fields Modifier and Type Field Description private java.io.File
directory
private static org.slf4j.Logger
LOG
private UnpackedObjectCache
unpackedObjectCache
-
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) void
close()
(package private) void
create()
(package private) java.io.File
fileFor(AnyObjectId objectId)
Compute the location of a loose object file.(package private) java.io.File
getDirectory()
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
insert(java.io.File tmp, ObjectId id)
(package private) ObjectLoader
open(WindowCursor curs, AnyObjectId id)
(package private) boolean
resolve(java.util.Set<ObjectId> matches, AbbreviatedObjectId id, int matchLimit)
Find objects matching the prefix abbreviation.java.lang.String
toString()
private FileObjectDatabase.InsertLooseObjectResult
tryMove(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
objects
directory.
-
create
void create() throws java.io.IOException
- Throws:
java.io.IOException
-
close
void close()
-
toString
public java.lang.String toString()
- Overrides:
toString
in 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:
true
if 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:
true
if 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:
File
location of the specified loose object.
-
-