Class BlockWriter
- java.lang.Object
-
- org.eclipse.jgit.internal.storage.reftable.BlockWriter
-
class BlockWriter extends java.lang.ObjectFormats and writes blocks forReftableWriter.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classBlockWriter.DeleteLogEntry(package private) static classBlockWriter.Entry(package private) static classBlockWriter.IndexEntry(package private) static classBlockWriter.LogEntry(package private) static classBlockWriter.ObjEntry(package private) static classBlockWriter.RefEntry
-
Field Summary
Fields Modifier and Type Field Description private intblockLimitBytesprivate byteblockTypeprivate java.util.List<BlockWriter.Entry>entriesprivate intentriesSumBytesprivate bytekeyTypeprivate intrestartCntprivate intrestartInterval
-
Constructor Summary
Constructors Constructor Description BlockWriter(byte type, byte kt, int bs, int ri)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private BlockSizeTooSmallExceptionblockSizeTooSmall(BlockWriter.Entry entry)(package private) byteblockType()(package private) static intcommonPrefix(byte[] a, int n, byte[] b)(package private) static intcompare(byte[] a, int ai, int aLen, byte[] b, int bi, int bLen)private intcomputeBlockBytes(int entryBytes, boolean restart)private static intcomputeBlockBytes(int entryBytes, int restartCnt)(package private) intcurrentSize()(package private) static intencodeSuffixAndType(int sfx, int valueType)private static intestimateEntryCount(byte blockType, byte keyType, int blockLimitBytes)(package private) byte[]lastKey()(package private) voidmustAdd(BlockWriter.Entry entry)private booleannextShouldBeRestart()(package private) booleanpadBetweenBlocks()(package private) static booleanpadBetweenBlocks(byte type)(package private) booleantryAdd(BlockWriter.Entry entry)private booleantryAdd(BlockWriter.Entry entry, boolean tryRestart)(package private) voidwriteTo(ReftableOutputStream os)
-
-
-
Field Detail
-
blockType
private final byte blockType
-
keyType
private final byte keyType
-
entries
private final java.util.List<BlockWriter.Entry> entries
-
blockLimitBytes
private final int blockLimitBytes
-
restartInterval
private final int restartInterval
-
entriesSumBytes
private int entriesSumBytes
-
restartCnt
private int restartCnt
-
-
Method Detail
-
estimateEntryCount
private static int estimateEntryCount(byte blockType, byte keyType, int blockLimitBytes)
-
blockType
byte blockType()
-
padBetweenBlocks
boolean padBetweenBlocks()
-
padBetweenBlocks
static boolean padBetweenBlocks(byte type)
-
lastKey
byte[] lastKey()
-
currentSize
int currentSize()
-
mustAdd
void mustAdd(BlockWriter.Entry entry) throws BlockSizeTooSmallException
- Throws:
BlockSizeTooSmallException
-
tryAdd
boolean tryAdd(BlockWriter.Entry entry)
-
tryAdd
private boolean tryAdd(BlockWriter.Entry entry, boolean tryRestart)
-
nextShouldBeRestart
private boolean nextShouldBeRestart()
-
computeBlockBytes
private int computeBlockBytes(int entryBytes, boolean restart)
-
computeBlockBytes
private static int computeBlockBytes(int entryBytes, int restartCnt)
-
writeTo
void writeTo(ReftableOutputStream os) throws java.io.IOException
- Throws:
java.io.IOException
-
blockSizeTooSmall
private BlockSizeTooSmallException blockSizeTooSmall(BlockWriter.Entry entry)
-
commonPrefix
static int commonPrefix(byte[] a, int n, byte[] b)
-
encodeSuffixAndType
static int encodeSuffixAndType(int sfx, int valueType)
-
compare
static int compare(byte[] a, int ai, int aLen, byte[] b, int bi, int bLen)
-
-