Class ReftableDatabase
java.lang.Object
org.eclipse.jgit.internal.storage.reftable.ReftableDatabase
Operations on
MergedReftable
that is common to various reftable-using
subclasses of RefDatabase
. See
DfsReftableDatabase
for an
example.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Drops all data that might be cached in memory.Read a single reference.getLock()
getReflogReader
(String refname) getRefsByPrefix
(String prefix) Returns refs whose names start with a given prefix.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.Returns all refs that resolve directly to the givenObjectId
.boolean
boolean
long
protected abstract MergedReftable
ReftableDatabase lazily initializes its merged reftable on the first read after construction or clearCache() call.private Reftable
reader()
static ReceiveCommand
private static ObjectId
-
Field Details
-
lock
-
mergedTables
-
-
Constructor Details
-
ReftableDatabase
public ReftableDatabase()
-
-
Method Details
-
openMergedReftable
ReftableDatabase lazily initializes its merged reftable on the first read after construction or clearCache() call. This function should always instantiate a new MergedReftable based on the list of reftables specified by the underlying storage.- Returns:
- the ReftableStack for this instance
- Throws:
IOException
- on I/O problems.
-
nextUpdateIndex
- Returns:
- the next available logical timestamp for an additional reftable in the stack.
- Throws:
IOException
- on I/O problems.
-
getReflogReader
- Parameters:
refname
- the name of the ref.- Returns:
- a ReflogReader for the given ref
- Throws:
IOException
- on I/O problems
-
toCommand
- Parameters:
oldRef
- a refnewRef
- a ref- Returns:
- a ReceiveCommand for the change from oldRef to newRef
-
toId
-
getLock
- Returns:
- the lock protecting underlying ReftableReaders against concurrent reads.
-
reader
- Returns:
- the merged reftable that is implemented by the stack of reftables. Return value must be accessed under lock.
- Throws:
IOException
- on I/O problems
-
isNameConflicting
public boolean isNameConflicting(String refName, TreeSet<String> added, Set<String> deleted) throws IOException - Parameters:
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.- Returns:
- whether the given refName would be illegal in a repository that uses loose refs.
- Throws:
IOException
- on I/O problems
-
exactRef
Read a single reference.This method expects an unshortened reference name and does not search using the standard search path.
- Parameters:
name
- the unabbreviated name of the reference.- Returns:
- the reference (if it exists); else
null
. - Throws:
IOException
- the reference space cannot be accessed.
-
getRefsByPrefix
Returns refs whose names start with a given prefix.- Parameters:
prefix
- string that names of refs should start with; may be empty (to return all refs).- Returns:
- immutable list of refs whose names start with
prefix
. - Throws:
IOException
- the reference space cannot be accessed.
-
getRefsByPrefixWithExclusions
public List<Ref> getRefsByPrefixWithExclusions(String include, Set<String> excludes) throws IOException Returns refs whose names start with a given prefix excluding all refs that start with one of the given prefixes.- Parameters:
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.- Returns:
- immutable list of refs whose names start with
include
and none of the strings inexclude
. - Throws:
IOException
- the reference space cannot be accessed.
-
hasFastTipsWithSha1
- Returns:
- whether there is a fast SHA1 to ref map.
- Throws:
IOException
- in case of I/O problems.
-
getTipsWithSha1
- Parameters:
id
-ObjectId
to resolve- Returns:
- a
Set
ofRef
s whose tips point to the provided id. - Throws:
IOException
- on I/O errors.
-
clearCache
public void clearCache()Drops all data that might be cached in memory.
-