Class BlockWriter
- java.lang.Object
-
- org.eclipse.jgit.internal.storage.reftable.BlockWriter
-
class BlockWriter extends java.lang.Object
Formats and writes blocks forReftableWriter
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
BlockWriter.DeleteLogEntry
(package private) static class
BlockWriter.Entry
(package private) static class
BlockWriter.IndexEntry
(package private) static class
BlockWriter.LogEntry
(package private) static class
BlockWriter.ObjEntry
(package private) static class
BlockWriter.RefEntry
-
Field Summary
Fields Modifier and Type Field Description private int
blockLimitBytes
private byte
blockType
private java.util.List<BlockWriter.Entry>
entries
private int
entriesSumBytes
private byte
keyType
private int
restartCnt
private int
restartInterval
-
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 BlockSizeTooSmallException
blockSizeTooSmall(BlockWriter.Entry entry)
(package private) byte
blockType()
(package private) static int
commonPrefix(byte[] a, int n, byte[] b)
(package private) static int
compare(byte[] a, int ai, int aLen, byte[] b, int bi, int bLen)
private int
computeBlockBytes(int entryBytes, boolean restart)
private static int
computeBlockBytes(int entryBytes, int restartCnt)
(package private) int
currentSize()
(package private) static int
encodeSuffixAndType(int sfx, int valueType)
private static int
estimateEntryCount(byte blockType, byte keyType, int blockLimitBytes)
(package private) byte[]
lastKey()
(package private) void
mustAdd(BlockWriter.Entry entry)
private boolean
nextShouldBeRestart()
(package private) boolean
padBetweenBlocks()
(package private) static boolean
padBetweenBlocks(byte type)
(package private) boolean
tryAdd(BlockWriter.Entry entry)
private boolean
tryAdd(BlockWriter.Entry entry, boolean tryRestart)
(package private) void
writeTo(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)
-
-