Class BlockWriter

java.lang.Object
org.eclipse.jgit.internal.storage.reftable.BlockWriter

class BlockWriter extends Object
Formats and writes blocks for ReftableWriter.
  • Field Details

    • blockType

      private final byte blockType
    • keyType

      private final byte keyType
    • entries

      private final List<BlockWriter.Entry> entries
    • blockLimitBytes

      private final int blockLimitBytes
    • restartInterval

      private final int restartInterval
    • entriesSumBytes

      private int entriesSumBytes
    • restartCnt

      private int restartCnt
  • Constructor Details

    • BlockWriter

      BlockWriter(byte type, byte kt, int bs, int ri)
  • Method Details

    • 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 IOException
      Throws:
      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)