public class ReftableReader extends Reftable implements AutoCloseable
ReftableReader
is not thread-safe. Concurrent readers need their own
instance to read from the same file.
includeDeletes
Constructor and Description |
---|
ReftableReader(BlockSource src)
Initialize a new reftable 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.
|
int |
blockSize()
Get the block size in bytes chosen for this file by the writer.
|
RefCursor |
byObjectId(AnyObjectId id)
Match references pointing to a specific object.
|
void |
close() |
boolean |
hasObjectMap() |
long |
maxUpdateIndex()
Get the maximum update index for ref entries that appear in this
reftable.
|
long |
minUpdateIndex()
Get the minimum update index for ref entries that appear in this
reftable.
|
LogCursor |
seekLog(String refName,
long updateIndex)
Seek to an update index in a reference's log.
|
RefCursor |
seekRef(String refName)
Seek to a reference.
|
RefCursor |
seekRefsWithPrefix(String prefix)
Seek references with prefix.
|
long |
size()
Get size of the reftable, in bytes.
|
exactRef, from, hasId, hasRef, hasRefsWithPrefix, resolve, seekLog, setIncludeDeletes
public ReftableReader(BlockSource src)
src
- the file content to read.public int blockSize() throws IOException
BlockSource
will be
aligned to the block size.IOException
- file cannot be read.public boolean hasObjectMap() throws IOException
hasObjectMap
in class Reftable
IOException
- on I/O problems.public long minUpdateIndex() throws IOException
minUpdateIndex
in class Reftable
IOException
- file cannot be read.public long maxUpdateIndex() throws IOException
maxUpdateIndex
in class Reftable
IOException
- file cannot be read.public RefCursor allRefs() throws IOException
allRefs
in class Reftable
IOException
- if references cannot be read.public RefCursor seekRef(String refName) 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
refName
- 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 id) throws IOException
byObjectId
in class Reftable
id
- 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 updateIndex) throws IOException
seekLog
in class Reftable
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.IOException
- if logs cannot be read.public long size() throws IOException
IOException
- size cannot be obtained.public void close() throws IOException
close
in interface AutoCloseable
IOException
Copyright © 2020 Eclipse JGit Project. All rights reserved.