public abstract class Reftable
extends java.lang.Object
implements java.lang.AutoCloseable
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
includeDeletes
true if deletions should be included in results. |
| Constructor and Description |
|---|
Reftable() |
| Modifier and Type | Method and Description |
|---|---|
abstract LogCursor |
allLogs()
Seek reader to read log records.
|
abstract RefCursor |
allRefs()
Seek to the first reference, to iterate in order.
|
abstract RefCursor |
byObjectId(AnyObjectId id)
Match references pointing to a specific object.
|
abstract void |
close() |
Ref |
exactRef(java.lang.String refName)
Lookup a reference, or null if not found.
|
static Reftable |
from(java.util.Collection<Ref> refs)
References to convert into a reftable
|
boolean |
hasId(AnyObjectId id)
Test if any reference directly refers to the object.
|
boolean |
hasRef(java.lang.String refName)
Test if a reference exists.
|
boolean |
hasRefsWithPrefix(java.lang.String prefix)
Test if any reference starts with
prefix as a prefix. |
Ref |
resolve(Ref symref)
Resolve a symbolic reference to populate its value.
|
private Ref |
resolve(Ref ref,
int depth) |
LogCursor |
seekLog(java.lang.String refName)
Read a single reference's log.
|
abstract LogCursor |
seekLog(java.lang.String refName,
long updateIndex)
Seek to an update index in a reference's log.
|
abstract RefCursor |
seekRef(java.lang.String refName)
Seek to a reference.
|
abstract RefCursor |
seekRefsWithPrefix(java.lang.String prefix)
Seek references with prefix.
|
void |
setIncludeDeletes(boolean deletes)
Whether deleted references will be returned.
|
protected boolean includeDeletes
true if deletions should be included in results.public static Reftable from(java.util.Collection<Ref> refs)
refs - references to convert into a reftable; may be empty.public void setIncludeDeletes(boolean deletes)
deletes - if true deleted references will be returned. If
false (default behavior), deleted references will be
skipped, and not returned.public abstract RefCursor allRefs() throws java.io.IOException
java.io.IOException - if references cannot be read.public abstract RefCursor seekRef(java.lang.String refName) throws java.io.IOException
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.
refName - reference name.java.io.IOException - if references cannot be read.public abstract RefCursor seekRefsWithPrefix(java.lang.String prefix) throws java.io.IOException
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.
prefix - prefix to find.java.io.IOException - if references cannot be read.public abstract RefCursor byObjectId(AnyObjectId id) throws java.io.IOException
id - object to find.java.io.IOException - if references cannot be read.public abstract LogCursor allLogs() throws java.io.IOException
java.io.IOException - if logs cannot be read.public LogCursor seekLog(java.lang.String refName) throws java.io.IOException
refName - exact name of the reference whose log to read.java.io.IOException - if logs cannot be read.public abstract LogCursor seekLog(java.lang.String refName, long updateIndex) throws java.io.IOException
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 before updateIndex will be returned.java.io.IOException - if logs cannot be read.@Nullable public Ref exactRef(java.lang.String refName) throws java.io.IOException
refName - reference name to find.null if not found.java.io.IOException - if references cannot be read.public boolean hasRef(java.lang.String refName)
throws java.io.IOException
refName - reference name or subtree to find.true if the reference exists.java.io.IOException - if references cannot be read.public boolean hasRefsWithPrefix(java.lang.String prefix)
throws java.io.IOException
prefix as a prefix.prefix - prefix to find.true if at least one reference exists with prefix.java.io.IOException - if references cannot be read.public boolean hasId(AnyObjectId id) throws java.io.IOException
id - ObjectId to find.true if any reference exists directly referencing
id, or a annotated tag that peels to id.java.io.IOException - if references cannot be read.@Nullable public Ref resolve(Ref symref) throws java.io.IOException
symref - reference to resolve.symref, or null.java.io.IOException - if references cannot be read.private Ref resolve(Ref ref, int depth) throws java.io.IOException
java.io.IOExceptionpublic abstract void close()
throws java.io.IOException
close in interface java.lang.AutoCloseablejava.io.IOException