public class MergedReftable extends Reftable
A MergedReftable
merge-joins multiple
ReftableReader
on the fly.
Tables higher/later in the stack shadow lower/earlier tables, hiding
references that been updated/replaced.
By default deleted references are skipped and not returned to the caller.
Reftable.setIncludeDeletes(boolean)
can be used to modify this behavior if
the caller needs to preserve deletions during partial compaction.
A MergedReftable
is not thread-safe.
includeDeletes
Constructor and Description |
---|
MergedReftable(List<Reftable> tableStack)
Initialize a merged table reader.
|
Modifier and Type | Method and Description |
---|---|
LogCursor |
allLogs()
Seek reader to read log records.
|
RefCursor |
allRefs()
Seek to the first reference, to iterate in order.
|
RefCursor |
byObjectId(AnyObjectId name)
Match references pointing to a specific object.
|
void |
close() |
LogCursor |
seekLog(String refName,
long updateIdx)
Seek to an update index in a reference's log.
|
RefCursor |
seekRef(String name)
Seek to a reference.
|
RefCursor |
seekRefsWithPrefix(String prefix)
Seek references with prefix.
|
exactRef, from, hasId, hasRef, hasRefsWithPrefix, resolve, seekLog, setIncludeDeletes
public MergedReftable(List<Reftable> tableStack)
The tables in tableStack
will be closed when this
MergedReftable
is closed.
tableStack
- stack of tables to read from. The base of the stack is at
index 0, the most recent should be at the top of the stack at
tableStack.size() - 1
. The top of the stack (higher
index) shadows the base of the stack (lower index).public RefCursor allRefs() throws IOException
allRefs
in class Reftable
IOException
- if references cannot be read.public RefCursor seekRef(String name) throws 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.
seekRef
in class Reftable
name
- reference name.IOException
- if references cannot be read.public RefCursor seekRefsWithPrefix(String prefix) throws 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.
seekRefsWithPrefix
in class Reftable
prefix
- prefix to find.IOException
- if references cannot be read.public RefCursor byObjectId(AnyObjectId name) throws IOException
byObjectId
in class Reftable
name
- object to find.IOException
- if references cannot be read.public LogCursor allLogs() throws IOException
allLogs
in class Reftable
IOException
- if logs cannot be read.public LogCursor seekLog(String refName, long updateIdx) throws IOException
seekLog
in class Reftable
refName
- exact name of the reference whose log to read.updateIdx
- most recent index to return first in the log cursor. Log
records at or before updateIndex
will be returned.IOException
- if logs cannot be read.public void close() throws IOException
close
in interface AutoCloseable
close
in class Reftable
IOException
Copyright © 2019 Eclipse JGit Project. All rights reserved.