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.
| Modifier and Type | Class and Description |
|---|---|
private static class |
MergedReftable.LogQueueEntry |
private class |
MergedReftable.MergedLogCursor |
private class |
MergedReftable.MergedRefCursor |
private static class |
MergedReftable.RefQueueEntry |
| Modifier and Type | Field and Description |
|---|---|
private Reftable[] |
tables |
includeDeletes| Constructor and Description |
|---|
MergedReftable(java.util.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() |
(package private) int |
queueSize() |
LogCursor |
seekLog(java.lang.String refName,
long updateIdx)
Seek to an update index in a reference's log.
|
RefCursor |
seekRef(java.lang.String name)
Seek either to a reference, or a reference subtree.
|
private final Reftable[] tables
public MergedReftable(java.util.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 java.io.IOException
public RefCursor seekRef(java.lang.String name) throws java.io.IOException
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.
public RefCursor byObjectId(AnyObjectId name) throws java.io.IOException
byObjectId in class Reftablename - object to find.java.io.IOException - if references cannot be read.public LogCursor allLogs() throws java.io.IOException
public LogCursor seekLog(java.lang.String refName, long updateIdx) throws java.io.IOException
seekLog in class ReftablerefName - 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.java.io.IOException - if logs cannot be read.public void close()
throws java.io.IOException
int queueSize()