Top Description Fields Constructors Methods
org.eclipse.jgit.internal.storage.reftable

pack-priv Class BlockReader

extends Object
Class Inheritance
Static Imports
java.nio.charset.StandardCharsets.UTF_8, org.eclipse.jgit.internal.storage.reftable.BlockWriter.compare, .ReftableConstants.FILE_BLOCK_TYPE, .ReftableConstants.FILE_HEADER_LEN, .ReftableConstants.INDEX_BLOCK_TYPE, .ReftableConstants.LOG_BLOCK_TYPE, .ReftableConstants.LOG_DATA, .ReftableConstants.LOG_NONE, .ReftableConstants.OBJ_BLOCK_TYPE, .ReftableConstants.REF_BLOCK_TYPE, .ReftableConstants.VALUE_1ID, .ReftableConstants.VALUE_2ID, .ReftableConstants.VALUE_NONE, .ReftableConstants.VALUE_SYMREF, .ReftableConstants.VALUE_TYPE_MASK, .ReftableConstants.reverseUpdateIndex, org.eclipse.jgit.lib.Constants.OBJECT_ID_LENGTH, .Ref.Storage.NEW, .Ref.Storage.PACKED

Reads a single block for ReftableReader. Instances are tied to a specific block in the file so are not reused for other blocks. Instances hold an offset into the block.

Field Summary

Modifier and TypeField and Description
private byte
private byte[]
private int
private long
private int
private int
private byte[]
private int
private int
private int
private int
private int

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv static int
decodeBlockLen(int typeAndSize)

pack-priv long
private long
inflateBuf(BlockSource src, long pos, int blockLen, int fileBlockSize)

private static IOException
private static IOException
pack-priv boolean
match(byte[] match, boolean matchIsPrefix)

pack-priv String
name()

private static Ref
newRef(String name, long updateIndex)

pack-priv boolean
next()

private void
parseBlockStart(BlockSource src, long pos, int fileBlockSize)

pack-priv void
pack-priv void
readBlock(BlockSource src, long pos, int fileBlockSize)

private void
readBlockIntoBuf(BlockSource src, long pos, int size)

pack-priv LongList
private short
pack-priv ReflogEntry
pack-priv long
private PersonIdent
pack-priv long
pack-priv Ref
readRef(long minUpdateIndex)

pack-priv long
private ObjectId
private String
private int
private long
private int

Returns:

<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.
scanToKey
(byte[]
key the caller wants to find.
key
,
int
current record pointer from restart table binary search.
rPtr
,
int
current restart table index.
rIdx
,
int
result of compare from restart table binary search.
rCmp
)

Performs the linear search step within a restart interval.

pack-priv int

Returns:

<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.
seekKey
(byte[]
key to find.
key
)

Finds a key in the block and positions the current pointer on its record.

private void
private void
pack-priv void
pack-priv byte
type()

pack-priv void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

blockTypeback to summary
private byte blockType
bufback to summary
private byte[] buf
bufLenback to summary
private int bufLen
endPositionback to summary
private long endPosition
keysEndback to summary
private int keysEnd
keysStartback to summary
private int keysStart
nameBufback to summary
private byte[] nameBuf
nameLenback to summary
private int nameLen
ptrback to summary
private int ptr
restartCntback to summary
private int restartCnt
restartTblback to summary
private int restartTbl
valueTypeback to summary
private int valueType

Constructor Detail

BlockReaderback to summary
pack-priv BlockReader()

Method Detail

decodeBlockLenback to summary
pack-priv static int decodeBlockLen(int typeAndSize)
endPositionback to summary
pack-priv long endPosition()
inflateBufback to summary
private long inflateBuf(BlockSource src, long pos, int blockLen, int fileBlockSize) throws IOException
invalidBlockback to summary
private static IOException invalidBlock()
invalidBlockback to summary
private static IOException invalidBlock(Throwable cause)
matchback to summary
pack-priv boolean match(byte[] match, boolean matchIsPrefix)
nameback to summary
pack-priv String name()
newRefback to summary
private static Ref newRef(String name, long updateIndex)
nextback to summary
pack-priv boolean next()
parseBlockStartback to summary
private void parseBlockStart(BlockSource src, long pos, int fileBlockSize) throws IOException
parseKeyback to summary
pack-priv void parseKey()
readBlockback to summary
pack-priv void readBlock(BlockSource src, long pos, int fileBlockSize) throws IOException
readBlockIntoBufback to summary
private void readBlockIntoBuf(BlockSource src, long pos, int size) throws IOException
readBlockPositionListback to summary
pack-priv LongList readBlockPositionList()
Annotations
@Nullable
readInt16back to summary
private short readInt16()
readLogEntryback to summary
pack-priv ReflogEntry readLogEntry()
Annotations
@Nullable
readLogUpdateIndexback to summary
pack-priv long readLogUpdateIndex()
readPersonIdentback to summary
private PersonIdent readPersonIdent()
readPositionFromIndexback to summary
pack-priv long readPositionFromIndex() throws IOException
readRefback to summary
pack-priv Ref readRef(long minUpdateIndex) throws IOException
readUpdateIndexDeltaback to summary
pack-priv long readUpdateIndexDelta()
readValueIdback to summary
private ObjectId readValueId()
readValueStringback to summary
private String readValueString()
readVarint32back to summary
private int readVarint32()
readVarint64back to summary
private long readVarint64()
scanToKeyback to summary
private int scanToKey(byte[] key, int rPtr, int rIdx, int rCmp)

Performs the linear search step within a restart interval.

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.

Parameters
key:byte[]

key the caller wants to find.

rPtr:int

current record pointer from restart table binary search.

rIdx:int

current restart table index.

rCmp:int

result of compare from restart table binary search.

Returns:int

<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.

seekKeyback to summary
pack-priv int seekKey(byte[] key)

Finds a key in the block and positions the current pointer on its record.

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:

Parameters
key:byte[]

key to find.

Returns:int

<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.

setupEmptyFileBlockback to summary
private void setupEmptyFileBlock()
skipStringback to summary
private void skipString()
skipValueback to summary
pack-priv void skipValue()
typeback to summary
pack-priv byte type()
verifyIndexback to summary
pack-priv void verifyIndex() throws IOException