public abstract class ObjectDatabase extends Object
An object database stores one or more Git objects, indexed by their unique
ObjectId.
| Modifier | Constructor and Description |
|---|---|
protected |
ObjectDatabase()
Initialize a new database instance for access.
|
| Modifier and Type | Method and Description |
|---|---|
abstract 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?
|
boolean |
has(AnyObjectId objectId)
Does the requested object exist in this database?
|
ObjectDatabase |
newCachedDatabase()
Create a new cached database instance over this database.
|
abstract ObjectInserter |
newInserter()
Create a new
ObjectInserter to insert new objects. |
abstract ObjectReader |
newReader()
Create a new
ObjectReader to read existing objects. |
ObjectLoader |
open(AnyObjectId objectId)
Open an object from this database.
|
ObjectLoader |
open(AnyObjectId objectId,
int typeHint)
Open an object from this database.
|
protected ObjectDatabase()
public boolean exists()
create() to create this database location.public void create()
throws IOException
IOException - the database could not be created.public abstract ObjectInserter newInserter()
ObjectInserter 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 abstract ObjectReader newReader()
ObjectReader 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.
public abstract void close()
public boolean has(AnyObjectId objectId) throws IOException
This is a one-shot call interface which may be faster than allocating a
newReader() to perform the lookup.
objectId - identity of the object to test for existence of.IOException - the object store cannot be accessed.public ObjectLoader open(AnyObjectId objectId) throws IOException
This is a one-shot call interface which may be faster than allocating a
newReader() to perform the lookup.
objectId - identity of the object to open.ObjectLoader for accessing the object.MissingObjectException - the object does not exist.IOException - the object store cannot be accessed.public ObjectLoader open(AnyObjectId objectId, int typeHint) throws MissingObjectException, IncorrectObjectTypeException, IOException
This is a one-shot call interface which may be faster than allocating a
newReader() to perform the lookup.
objectId - identity of the object to open.typeHint - hint about the type of object being requested, e.g.
Constants.OBJ_BLOB; ObjectReader.OBJ_ANY if
the object type is not known, or does not matter to the
caller.ObjectLoader for accessing the object.MissingObjectException - the object does not exist.IncorrectObjectTypeException - typeHint was not OBJ_ANY, and the object's actual type does
not match typeHint.IOException - the object store cannot be accessed.public ObjectDatabase newCachedDatabase()
Copyright © 2014. All rights reserved.