Class Reftable
java.lang.Object
org.eclipse.jgit.internal.storage.reftable.Reftable
- Direct Known Subclasses:
MergedReftable,ReftableReader
Abstract table of references.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleantrueif deletions should be included in results. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract LogCursorallLogs()Seek reader to read log records.abstract RefCursorallRefs()Seek to the first reference, to iterate in order.abstract RefCursorMatch references pointing to a specific object.Lookup a reference, or null if not found.static Reftablefrom(Collection<Ref> refs) References to convert into a reftablebooleanhasId(AnyObjectId id) Test if any reference directly refers to the object.abstract booleanbooleanTest if a reference exists.booleanhasRefsWithPrefix(String prefix) Test if any reference starts withprefixas a prefix.abstract longGet the maximum update index for ref entries that appear in this reftable.abstract longGet the minimum update index for ref entries that appear in this reftable.Resolve a symbolic reference to populate its value.private RefRead a single reference's log.abstract LogCursorSeek to an update index in a reference's log.abstract RefCursorSeek to a reference.abstract RefCursorseekRefsWithPrefix(String prefix) Seek references with prefix.voidsetIncludeDeletes(boolean deletes) Whether deleted references will be returned.
-
Field Details
-
includeDeletes
protected boolean includeDeletestrueif deletions should be included in results.
-
-
Constructor Details
-
Reftable
public Reftable()
-
-
Method Details
-
from
References to convert into a reftable- Parameters:
refs- references to convert into a reftable; may be empty.- Returns:
- a reader for the supplied references.
-
setIncludeDeletes
public void setIncludeDeletes(boolean deletes) Whether deleted references will be returned.- Parameters:
deletes- iftruedeleted references will be returned. Iffalse(default behavior), deleted references will be skipped, and not returned.
-
maxUpdateIndex
Get the maximum update index for ref entries that appear in this reftable.- Returns:
- the maximum update index for ref entries that appear in this reftable.
- Throws:
IOException- file cannot be read.
-
minUpdateIndex
Get the minimum update index for ref entries that appear in this reftable.- Returns:
- the minimum update index for ref entries that appear in this reftable.
- Throws:
IOException- file cannot be read.
-
allRefs
Seek to the first reference, to iterate in order.- Returns:
- cursor to iterate.
- Throws:
IOException- if references cannot be read.
-
seekRef
Seek to a reference.This method will seek to the reference
refName. If present, the returned cursor will iterate exactly one entry. If not found, an empty cursor is returned.- Parameters:
refName- reference name.- Returns:
- cursor to iterate; empty cursor if no references match.
- Throws:
IOException- if references cannot be read.
-
seekRefsWithPrefix
Seek references with prefix.The method will seek all the references starting with
prefixas a prefix. If no references start with this prefix, an empty cursor is returned.- Parameters:
prefix- prefix to find.- Returns:
- cursor to iterate; empty cursor if no references match.
- Throws:
IOException- if references cannot be read.
-
byObjectId
Match references pointing to a specific object.- Parameters:
id- object to find.- Returns:
- cursor to iterate; empty cursor if no references match.
- Throws:
IOException- if references cannot be read.
-
hasObjectMap
- Returns:
- whether this reftable can do a fast SHA1 => ref lookup.
- Throws:
IOException- on I/O problems.
-
allLogs
Seek reader to read log records.- Returns:
- cursor to iterate; empty cursor if no logs are present.
- Throws:
IOException- if logs cannot be read.
-
seekLog
Read a single reference's log.- Parameters:
refName- exact name of the reference whose log to read.- Returns:
- cursor to iterate; empty cursor if no logs match.
- Throws:
IOException- if logs cannot be read.
-
seekLog
Seek to an update index in a reference's log.- Parameters:
refName- exact name of the reference whose log to read.updateIndex- most recent index to return first in the log cursor. Log records at or beforeupdateIndexwill be returned.- Returns:
- cursor to iterate; empty cursor if no logs match.
- Throws:
IOException- if logs cannot be read.
-
exactRef
Lookup a reference, or null if not found.- Parameters:
refName- reference name to find.- Returns:
- the reference, or
nullif not found. - Throws:
IOException- if references cannot be read.
-
hasRef
Test if a reference exists.- Parameters:
refName- reference name or subtree to find.- Returns:
trueif the reference exists.- Throws:
IOException- if references cannot be read.
-
hasRefsWithPrefix
Test if any reference starts withprefixas a prefix.- Parameters:
prefix- prefix to find.- Returns:
trueif at least one reference exists with prefix.- Throws:
IOException- if references cannot be read.
-
hasId
Test if any reference directly refers to the object.- Parameters:
id- ObjectId to find.- Returns:
trueif any reference exists directly referencingid, or a annotated tag that peels toid.- Throws:
IOException- if references cannot be read.
-
resolve
Resolve a symbolic reference to populate its value.- Parameters:
symref- reference to resolve.- Returns:
- resolved
symref, ornull. - Throws:
IOException- if references cannot be read.
-
resolve
- Throws:
IOException
-