Class BlockWriter


  • class BlockWriter
    extends java.lang.Object
    Formats and writes blocks for ReftableWriter.
    • Field Detail

      • blockType

        private final byte blockType
      • keyType

        private final byte keyType
      • blockLimitBytes

        private final int blockLimitBytes
      • restartInterval

        private final int restartInterval
      • entriesSumBytes

        private int entriesSumBytes
      • restartCnt

        private int restartCnt
    • Constructor Detail

      • BlockWriter

        BlockWriter​(byte type,
                    byte kt,
                    int bs,
                    int ri)
    • 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()
      • 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
      • 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)