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 boolean
true
if deletions should be included in results. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract LogCursor
allLogs()
Seek reader to read log records.abstract RefCursor
allRefs()
Seek to the first reference, to iterate in order.abstract RefCursor
Match references pointing to a specific object.Lookup a reference, or null if not found.static Reftable
from
(Collection<Ref> refs) References to convert into a reftableboolean
hasId
(AnyObjectId id) Test if any reference directly refers to the object.abstract boolean
boolean
Test if a reference exists.boolean
hasRefsWithPrefix
(String prefix) Test if any reference starts withprefix
as a prefix.abstract long
Get the maximum update index for ref entries that appear in this reftable.abstract long
Get the minimum update index for ref entries that appear in this reftable.Resolve a symbolic reference to populate its value.private Ref
Read a single reference's log.abstract LogCursor
Seek to an update index in a reference's log.abstract RefCursor
Seek to a reference.abstract RefCursor
seekRefsWithPrefix
(String prefix) Seek references with prefix.void
setIncludeDeletes
(boolean deletes) Whether deleted references will be returned.
-
Field Details
-
includeDeletes
protected boolean includeDeletestrue
if 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
- iftrue
deleted 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
prefix
as 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 beforeupdateIndex
will 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
null
if not found. - Throws:
IOException
- if references cannot be read.
-
hasRef
Test if a reference exists.- Parameters:
refName
- reference name or subtree to find.- Returns:
true
if the reference exists.- Throws:
IOException
- if references cannot be read.
-
hasRefsWithPrefix
Test if any reference starts withprefix
as a prefix.- Parameters:
prefix
- prefix to find.- Returns:
true
if 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:
true
if 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
-