public abstract class ReftableDatabase extends Object
MergedReftable
that is common to various reftable-using
subclasses of RefDatabase
. See
DfsReftableDatabase
for an
example.Constructor and Description |
---|
ReftableDatabase() |
Modifier and Type | Method and Description |
---|---|
void |
clearCache()
Drops all data that might be cached in memory.
|
Ref |
exactRef(String name)
Read a single reference.
|
ReentrantLock |
getLock() |
ReflogReader |
getReflogReader(String refname) |
List<Ref> |
getRefsByPrefix(String prefix)
Returns refs whose names start with a given prefix.
|
List<Ref> |
getRefsByPrefixWithExclusions(String include,
Set<String> excludes)
Returns refs whose names start with a given prefix excluding all refs that
start with one of the given prefixes.
|
Set<Ref> |
getTipsWithSha1(ObjectId id)
Returns all refs that resolve directly to the given
ObjectId . |
boolean |
hasFastTipsWithSha1() |
boolean |
isNameConflicting(String refName,
TreeSet<String> added,
Set<String> deleted) |
long |
nextUpdateIndex() |
protected abstract MergedReftable |
openMergedReftable()
ReftableDatabase lazily initializes its merged reftable on the first read after
construction or clearCache() call.
|
static ReceiveCommand |
toCommand(Ref oldRef,
Ref newRef) |
protected abstract MergedReftable openMergedReftable() throws IOException
IOException
- on I/O problems.public long nextUpdateIndex() throws IOException
IOException
- on I/O problems.public ReflogReader getReflogReader(String refname) throws IOException
refname
- the name of the ref.IOException
- on I/O problemspublic static ReceiveCommand toCommand(Ref oldRef, Ref newRef)
oldRef
- a refnewRef
- a refpublic ReentrantLock getLock()
public boolean isNameConflicting(String refName, TreeSet<String> added, Set<String> deleted) throws 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.IOException
- on I/O problems@Nullable public Ref exactRef(String name) throws 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
.IOException
- the reference space cannot be accessed.public List<Ref> getRefsByPrefix(String prefix) throws IOException
prefix
- string that names of refs should start with; may be empty (to
return all refs).prefix
.IOException
- the reference space cannot be accessed.public List<Ref> getRefsByPrefixWithExclusions(String include, Set<String> excludes) throws IOException
include
- string that names of refs should start with; may be empty.excludes
- strings that names of refs can't start with; may be empty.include
and
none of the strings in exclude
.IOException
- the reference space cannot be accessed.public boolean hasFastTipsWithSha1() throws IOException
IOException
- in case of I/O problems.public Set<Ref> getTipsWithSha1(ObjectId id) throws IOException
id
- ObjectId
to resolveSet
of Ref
s whose tips point to the provided
id.IOException
- on I/O errors.public void clearCache()
Copyright © 2021 Eclipse JGit Project. All rights reserved.