|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.jgit.lib.ObjectDatabase
org.eclipse.jgit.storage.file.ObjectDirectory
public class ObjectDirectory
Traditional file system based ObjectDatabase.
This is the classical object database representation for a Git repository,
where objects are stored loose by hashing them into directories by their
ObjectId, or are stored in compressed containers known as
PackFiles.
Optionally an object database can reference one or more alternates; other ObjectDatabase instances that are searched in addition to the current database.
Databases are divided into two halves: a half that is considered to be fast
to search (the PackFiles), and a half that is considered to be slow
to search (loose objects). When alternates are present the fast half is fully
searched (recursively through all alternates) before the slow half is
considered.
| Constructor Summary | |
|---|---|
ObjectDirectory(Config cfg,
File dir,
File[] alternatePaths,
FS fs)
Initialize a reference to an on-disk object directory. |
|
| Method Summary | |
|---|---|
void |
close()
Close any resources held by this database. |
void |
create()
Initialize a new object database at this location. |
boolean |
exists()
Does this database exist yet? |
File |
fileFor(AnyObjectId objectId)
Compute the location of a loose object file. |
File |
getDirectory()
|
Collection<PackFile> |
getPacks()
|
boolean |
has(AnyObjectId objectId)
Does the requested object exist in this database? |
ObjectDatabase |
newCachedDatabase()
Create a new cached database instance over this database. |
org.eclipse.jgit.storage.file.ObjectDirectoryInserter |
newInserter()
Create a new ObjectInserter to insert new objects. |
ObjectReader |
newReader()
Create a new ObjectReader to read existing objects. |
PackFile |
openPack(File pack,
File idx)
Add a single existing pack to the list of available pack files. |
String |
toString()
|
| Methods inherited from class org.eclipse.jgit.lib.ObjectDatabase |
|---|
open, open |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ObjectDirectory(Config cfg,
File dir,
File[] alternatePaths,
FS fs)
throws IOException
cfg - configuration this directory consults for write settings.dir - the location of the objects directory.alternatePaths - a list of alternate object directoriesfs - the file system abstraction which will be necessary to perform
certain file system operations.
IOException - an alternate object cannot be opened.| Method Detail |
|---|
public final File getDirectory()
objects directory.public boolean exists()
ObjectDatabase
exists in class ObjectDatabaseObjectDatabase.create() to create this database location.
public void create()
throws IOException
ObjectDatabase
create in class ObjectDatabaseIOException - the database could not be created.public org.eclipse.jgit.storage.file.ObjectDirectoryInserter newInserter()
ObjectDatabaseObjectInserter to insert new objects.
The returned inserter is not itself thread-safe, but multiple concurrent
inserter instances created from the same ObjectDatabase must be
thread-safe.
public void close()
ObjectDatabase
close in class ObjectDatabasepublic File fileFor(AnyObjectId objectId)
objectId - identity of the loose object to map to the directory.
public Collection<PackFile> getPacks()
public PackFile openPack(File pack,
File idx)
throws IOException
pack - path of the pack file to open.idx - path of the corresponding index file.
IOException - index file could not be opened, read, or is not recognized as
a Git pack file index.public String toString()
toString in class Objectpublic ObjectDatabase newCachedDatabase()
ObjectDatabase
newCachedDatabase in class ObjectDatabasepublic ObjectReader newReader()
ObjectDatabaseObjectReader to read existing objects.
The returned reader is not itself thread-safe, but multiple concurrent
reader instances created from the same ObjectDatabase must be
thread-safe.
newReader in class ObjectDatabasepublic boolean has(AnyObjectId objectId)
Alternates (if present) are searched automatically.
has in class ObjectDatabaseobjectId - identity of the object to test for existence of.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||