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 either to a reference, or a reference subtree.
|
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
Reftable
allRefs
in class Reftable
IOException
- if references cannot be read.public RefCursor seekRef(String name) throws IOException
Reftable
If refName
ends with "/"
the method will seek to the
subtree of all references starting with refName
as a prefix. If
no references start with this prefix, an empty cursor is returned.
Otherwise exactly refName
will be looked for. 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 or subtree to find.IOException
- if references cannot be read.public RefCursor byObjectId(AnyObjectId name) throws IOException
Reftable
byObjectId
in class Reftable
name
- object to find.IOException
- if references cannot be read.public LogCursor allLogs() throws IOException
Reftable
allLogs
in class Reftable
IOException
- if logs cannot be read.public LogCursor seekLog(String refName, long updateIdx) throws IOException
Reftable
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 © 2017 Eclipse JGit Project. All rights reserved.