|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.eclipse.jgit.lib.ObjectDatabase
public abstract class ObjectDatabase
Abstraction of arbitrary object storage.
An object database stores one or more Git objects, indexed by their unique
ObjectId. Optionally an object database can reference one or more
alternates; other ObjectDatabase instances that are searched in addition to
the current database.
Databases are usually divided into two halves: a half that is considered to be fast to search, and a half that is considered to be slow to search. When alternates are present the fast half is fully searched (recursively through all alternates) before the slow half is considered.
| Field Summary | |
|---|---|
protected static ObjectDatabase[] |
NO_ALTERNATES
Constant indicating no alternate databases exist. |
| Constructor Summary | |
|---|---|
protected |
ObjectDatabase()
Initialize a new database instance for access. |
| Method Summary | |
|---|---|
void |
close()
Close any resources held by this database and its active alternates. |
void |
closeAlternates()
Fully close all loaded alternates and clear the alternate list. |
protected void |
closeAlternates(ObjectDatabase[] alt)
Close the list of alternates returned by loadAlternates(). |
void |
closeSelf()
Close any resources held by this database only; ignoring alternates. |
void |
create()
Initialize a new object database at this location. |
boolean |
exists()
Does this database exist yet? |
ObjectDatabase[] |
getAlternates()
Get the alternate databases known to this database. |
boolean |
hasObject(AnyObjectId objectId)
Does the requested object exist in this database? |
protected abstract boolean |
hasObject1(AnyObjectId objectId)
Fast half of hasObject(AnyObjectId). |
protected boolean |
hasObject2(java.lang.String objectName)
Slow half of hasObject(AnyObjectId). |
protected ObjectDatabase[] |
loadAlternates()
Load the list of alternate databases into memory. |
ObjectLoader |
openObject(WindowCursor curs,
AnyObjectId objectId)
Open an object from this database. |
protected abstract ObjectLoader |
openObject1(WindowCursor curs,
AnyObjectId objectId)
Fast half of openObject(WindowCursor, AnyObjectId). |
protected ObjectLoader |
openObject2(WindowCursor curs,
java.lang.String objectName,
AnyObjectId objectId)
Slow half of openObject(WindowCursor, AnyObjectId). |
protected boolean |
tryAgain1()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final ObjectDatabase[] NO_ALTERNATES
| Constructor Detail |
|---|
protected ObjectDatabase()
| Method Detail |
|---|
public boolean exists()
create() to create this database location.
public void create()
throws java.io.IOException
java.io.IOException - the database could not be created.public final void close()
public void closeSelf()
To fully close this database and its referenced alternates, the caller
should instead invoke close().
public final void closeAlternates()
public final boolean hasObject(AnyObjectId objectId)
Alternates (if present) are searched automatically.
objectId - identity of the object to test for existence of.
protected abstract boolean hasObject1(AnyObjectId objectId)
hasObject(AnyObjectId).
objectId - identity of the object to test for existence of.
protected boolean hasObject2(java.lang.String objectName)
hasObject(AnyObjectId).
objectName - identity of the object to test for existence of.
public final ObjectLoader openObject(WindowCursor curs,
AnyObjectId objectId)
throws java.io.IOException
Alternates (if present) are searched automatically.
curs - temporary working space associated with the calling thread.objectId - identity of the object to open.
ObjectLoader for accessing the data of the named
object, or null if the object does not exist.
java.io.IOException
protected abstract ObjectLoader openObject1(WindowCursor curs,
AnyObjectId objectId)
throws java.io.IOException
openObject(WindowCursor, AnyObjectId).
curs - temporary working space associated with the calling thread.objectId - identity of the object to open.
ObjectLoader for accessing the data of the named
object, or null if the object does not exist.
java.io.IOException
protected ObjectLoader openObject2(WindowCursor curs,
java.lang.String objectName,
AnyObjectId objectId)
throws java.io.IOException
openObject(WindowCursor, AnyObjectId).
curs - temporary working space associated with the calling thread.objectName - name of the object to open.objectId - identity of the object to open.
ObjectLoader for accessing the data of the named
object, or null if the object does not exist.
java.io.IOExceptionprotected boolean tryAgain1()
public final ObjectDatabase[] getAlternates()
protected ObjectDatabase[] loadAlternates()
throws java.io.IOException
This method is invoked by getAlternates() if the alternate list
has not yet been populated, or if closeAlternates() has been
called on this instance and the alternate list is needed again.
If the alternate array is empty, implementors should consider using the
constant NO_ALTERNATES.
java.io.IOException - the alternate list could not be accessed. The empty alternate
array NO_ALTERNATES will be assumed by the caller.protected void closeAlternates(ObjectDatabase[] alt)
loadAlternates().
alt - the alternate list, from loadAlternates().
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||