reftable: add maxUpdateIndex to Reftable
This makes maxUpdateIndex() available in MergedReftable, so we can know generically at which index to create the next reftable in a stack. Change-Id: Ia2314bc57c8b5dd7e69d5e61096fdce1d35abd11 Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
This commit is contained in:
parent
a793be2111
commit
33dc08c162
|
@ -91,6 +91,15 @@ public MergedReftable(List<Reftable> tableStack) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public long maxUpdateIndex() throws IOException {
|
||||
return tables.length > 0 ? tables[tables.length - 1].maxUpdateIndex()
|
||||
: 0;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public RefCursor allRefs() throws IOException {
|
||||
|
|
|
@ -98,6 +98,19 @@ public void setIncludeDeletes(boolean deletes) {
|
|||
includeDeletes = deletes;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the maximum update index for log entries that appear in this
|
||||
* reftable.
|
||||
*
|
||||
* @return the maximum update index for log entries that appear in this
|
||||
* reftable. This should be 1 higher than the prior reftable's
|
||||
* {@code maxUpdateIndex} if this table is used in a stack.
|
||||
* @throws java.io.IOException
|
||||
* file cannot be read.
|
||||
*/
|
||||
public abstract long maxUpdateIndex() throws IOException;
|
||||
|
||||
/**
|
||||
* Seek to the first reference, to iterate in order.
|
||||
*
|
||||
|
|
|
@ -146,15 +146,9 @@ public long minUpdateIndex() throws IOException {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the maximum update index for log entries that appear in this
|
||||
* reftable.
|
||||
*
|
||||
* @return the maximum update index for log entries that appear in this
|
||||
* reftable. This should be 1 higher than the prior reftable's
|
||||
* {@code maxUpdateIndex} if this table is used in a stack.
|
||||
* @throws java.io.IOException
|
||||
* file cannot be read.
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public long maxUpdateIndex() throws IOException {
|
||||
if (blockSize == -1) {
|
||||
readFileHeader();
|
||||
|
|
Loading…
Reference in New Issue