class BlockReader
extends java.lang.Object
ReftableReader
.Modifier and Type | Field and Description |
---|---|
private byte |
blockType |
private byte[] |
buf |
private int |
bufLen |
private long |
endPosition |
private int |
keysEnd |
private int |
keysStart |
private byte[] |
nameBuf |
private int |
nameLen |
private int |
ptr |
private int |
restartCnt |
private int |
restartTbl |
private boolean |
truncated |
private int |
valueType |
Constructor and Description |
---|
BlockReader() |
Modifier and Type | Method and Description |
---|---|
(package private) static int |
decodeBlockLen(int typeAndSize) |
(package private) long |
endPosition() |
private long |
inflateBuf(BlockSource src,
long pos,
int blockLen,
int fileBlockSize) |
private static java.io.IOException |
invalidBlock() |
private static java.io.IOException |
invalidBlock(java.lang.Throwable cause) |
(package private) boolean |
match(byte[] match,
boolean matchIsPrefix) |
(package private) java.lang.String |
name() |
private static Ref |
newRef(java.lang.String name,
long updateIndex) |
(package private) boolean |
next() |
private void |
parseBlockStart(BlockSource src,
long pos,
int fileBlockSize) |
(package private) void |
parseKey() |
(package private) void |
readBlock(BlockSource src,
long pos,
int fileBlockSize) |
private void |
readBlockIntoBuf(BlockSource src,
long pos,
int size) |
(package private) LongList |
readBlockPositionList() |
private short |
readInt16() |
(package private) ReflogEntry |
readLogEntry() |
(package private) long |
readLogUpdateIndex() |
private PersonIdent |
readPersonIdent() |
(package private) long |
readPositionFromIndex() |
(package private) Ref |
readRef(long minUpdateIndex) |
(package private) long |
readUpdateIndexDelta() |
private ObjectId |
readValueId() |
private java.lang.String |
readValueString() |
private int |
readVarint32() |
private long |
readVarint64() |
private int |
scanToKey(byte[] key,
int rPtr,
int rIdx,
int rCmp)
Performs the linear search step within a restart interval.
|
(package private) int |
seekKey(byte[] key)
Finds a key in the block and positions the current pointer on its record.
|
private void |
setupEmptyFileBlock() |
private void |
skipString() |
(package private) void |
skipValue() |
(package private) boolean |
truncated() |
(package private) byte |
type() |
(package private) void |
verifyIndex() |
private byte blockType
private long endPosition
private boolean truncated
private byte[] buf
private int bufLen
private int ptr
private int keysStart
private int keysEnd
private int restartCnt
private int restartTbl
private byte[] nameBuf
private int nameLen
private int valueType
byte type()
boolean truncated()
long endPosition()
boolean next()
void parseKey()
java.lang.String name()
boolean match(byte[] match, boolean matchIsPrefix)
long readPositionFromIndex() throws java.io.IOException
java.io.IOException
long readUpdateIndexDelta()
Ref readRef(long minUpdateIndex) throws java.io.IOException
java.io.IOException
long readLogUpdateIndex()
@Nullable ReflogEntry readLogEntry()
private ObjectId readValueId()
private java.lang.String readValueString()
private PersonIdent readPersonIdent()
void readBlock(BlockSource src, long pos, int fileBlockSize) throws java.io.IOException
java.io.IOException
private void readBlockIntoBuf(BlockSource src, long pos, int size) throws java.io.IOException
java.io.IOException
private void parseBlockStart(BlockSource src, long pos, int fileBlockSize) throws java.io.IOException
java.io.IOException
static int decodeBlockLen(int typeAndSize)
private long inflateBuf(BlockSource src, long pos, int blockLen, int fileBlockSize) throws java.io.IOException
java.io.IOException
private void setupEmptyFileBlock()
void verifyIndex() throws java.io.IOException
java.io.IOException
int seekKey(byte[] key)
As a side-effect this method arranges for the current pointer to be near
or exactly on key
, allowing other methods to access data from
that current record:
key
- key to find.<0
if the key occurs before the start of this block;
0
if the block is positioned on the key; >0
if
the key occurs after the last key of this block.private int scanToKey(byte[] key, int rPtr, int rIdx, int rCmp)
Starts at a restart position whose key sorts before (or equal to)
key
and walks sequentially through the following prefix
compressed records to find key
.
key
- key the caller wants to find.rPtr
- current record pointer from restart table binary search.rIdx
- current restart table index.rCmp
- result of compare from restart table binary search.<0
if the key occurs before the start of this block;
0
if the block is positioned on the key; >0
if
the key occurs after the last key of this block.void skipValue()
private void skipString()
private short readInt16()
private int readVarint32()
private long readVarint64()
private static Ref newRef(java.lang.String name, long updateIndex)
private static java.io.IOException invalidBlock()
private static java.io.IOException invalidBlock(java.lang.Throwable cause)