public abstract class ReftableDatabase
extends java.lang.Object
MergedReftable that is common to various reftable-using
subclasses of RefDatabase. See
DfsReftableDatabase for an
example.| Modifier and Type | Field and Description |
|---|---|
private java.util.concurrent.locks.ReentrantLock |
lock |
private Reftable |
mergedTables |
| Constructor and Description |
|---|
ReftableDatabase() |
| Modifier and Type | Method and Description |
|---|---|
void |
clearCache()
Drops all data that might be cached in memory.
|
Ref |
exactRef(java.lang.String name)
Read a single reference.
|
java.util.concurrent.locks.ReentrantLock |
getLock() |
ReflogReader |
getReflogReader(java.lang.String refname) |
java.util.List<Ref> |
getRefsByPrefix(java.lang.String prefix)
Returns refs whose names start with a given prefix.
|
java.util.Set<Ref> |
getTipsWithSha1(ObjectId id)
Returns all refs that resolve directly to the given
ObjectId. |
boolean |
hasFastTipsWithSha1() |
boolean |
isNameConflicting(java.lang.String refName,
java.util.TreeSet<java.lang.String> added,
java.util.Set<java.lang.String> deleted) |
long |
nextUpdateIndex() |
protected abstract MergedReftable |
openMergedReftable()
ReftableDatabase lazily initializes its merged reftable on the first read after
construction or clearCache() call.
|
private Reftable |
reader() |
static ReceiveCommand |
toCommand(Ref oldRef,
Ref newRef) |
private static ObjectId |
toId(Ref ref) |
private final java.util.concurrent.locks.ReentrantLock lock
private Reftable mergedTables
protected abstract MergedReftable openMergedReftable() throws java.io.IOException
java.io.IOException - on I/O problems.public long nextUpdateIndex()
throws java.io.IOException
java.io.IOException - on I/O problems.public ReflogReader getReflogReader(java.lang.String refname) throws java.io.IOException
refname - the name of the ref.java.io.IOException - on I/O problemspublic static ReceiveCommand toCommand(Ref oldRef, Ref newRef)
oldRef - a refnewRef - a refpublic java.util.concurrent.locks.ReentrantLock getLock()
private Reftable reader() throws java.io.IOException
java.io.IOException - on I/O problemspublic boolean isNameConflicting(java.lang.String refName,
java.util.TreeSet<java.lang.String> added,
java.util.Set<java.lang.String> deleted)
throws java.io.IOException
refName - the name to checkadded - a sorted set of refs we pretend have been added to the
database.deleted - a set of refs we pretend have been removed from the database.java.io.IOException - on I/O problems@Nullable public Ref exactRef(java.lang.String name) throws java.io.IOException
This method expects an unshortened reference name and does not search using the standard search path.
name - the unabbreviated name of the reference.null.java.io.IOException - the reference space cannot be accessed.public java.util.List<Ref> getRefsByPrefix(java.lang.String prefix) throws java.io.IOException
prefix - string that names of refs should start with; may be empty (to
return all refs).prefix.java.io.IOException - the reference space cannot be accessed.public boolean hasFastTipsWithSha1()
throws java.io.IOException
java.io.IOException - in case of I/O problems.public java.util.Set<Ref> getTipsWithSha1(ObjectId id) throws java.io.IOException
ObjectId.
Includes peeled s.public void clearCache()