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.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDrops all data that might be cached in memory.Read a single reference.getLock()Get lockgetReflogReader(String refname) Get ReflogReadergetRefsByPrefix(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.booleanWhether there is a fast SHA1 to ref mapbooleanWhether refName is conflictinglongGet next update indexprotected abstract MergedReftableReftableDatabase lazily initializes its merged reftable on the first read after construction or clearCache() call.static ReceiveCommandCreate a ReceiveCommand for the change from oldRef to newRef
-
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
Get next update index- Returns:
- the next available logical timestamp for an additional reftable in the stack.
- Throws:
IOException- on I/O problems.
-
getReflogReader
Get ReflogReader- Parameters:
refname- the name of the ref.- Returns:
- a ReflogReader for the given ref
- Throws:
IOException- on I/O problems
-
toCommand
Create a ReceiveCommand for the change from oldRef to newRef- Parameters:
oldRef- a refnewRef- a ref- Returns:
- a ReceiveCommand for the change from oldRef to newRef
-
getLock
Get lock- Returns:
- the lock protecting underlying ReftableReaders against concurrent reads.
-
isNameConflicting
public boolean isNameConflicting(String refName, TreeSet<String> added, Set<String> deleted) throws IOException Whether refName is conflicting- 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
includeand none of the strings inexcludes. - Throws:
IOException- the reference space cannot be accessed.
-
hasFastTipsWithSha1
Whether there is a fast SHA1 to ref map- Returns:
- whether there is a fast SHA1 to ref map.
- Throws:
IOException- in case of I/O problems.
-
getTipsWithSha1
- Parameters:
id-ObjectIdto resolve- Returns:
- a
SetofRefs 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.
-