Class BlockHeader

  • All Implemented Interfaces:
    Accountable

    public class BlockHeader
    extends java.lang.Object
    implements Accountable
    Block header containing block metadata.

    Holds the number of lines in the block.

    Holds the base file pointers to apply delta base encoding to all the file pointers in the block with DeltaBaseTermStateSerializer.

    Holds the offset to the details region of the block (the term states).

    Holds the offset to the middle term of the block to divide the number of terms to scan by 2.

    • Field Detail

      • RAM_USAGE

        private static final long RAM_USAGE
      • linesCount

        protected int linesCount
      • baseDocsFP

        protected long baseDocsFP
      • basePositionsFP

        protected long basePositionsFP
      • basePayloadsFP

        protected long basePayloadsFP
      • termStatesBaseOffset

        protected int termStatesBaseOffset
      • middleLineIndex

        protected int middleLineIndex
      • middleLineOffset

        protected int middleLineOffset
    • Constructor Detail

      • BlockHeader

        protected BlockHeader​(int linesCount,
                              long baseDocsFP,
                              long basePositionsFP,
                              long basePayloadsFP,
                              int termStatesBaseOffset,
                              int middleLineOffset)
        Parameters:
        linesCount - Number of lines in the block.
        baseDocsFP - File pointer to the docs of the first term with docs in the block.
        basePositionsFP - File pointer to the positions of the first term with positions in the block.
        basePayloadsFP - File pointer to the payloads of the first term with payloads in the block.
        termStatesBaseOffset - Offset to the details region of the block (the term states), relative to the block start.
        middleLineOffset - Offset to the middle term of the block, relative to the block start.
    • Method Detail

      • reset

        protected BlockHeader reset​(int linesCount,
                                    long baseDocsFP,
                                    long basePositionsFP,
                                    long basePayloadsFP,
                                    int termStatesBaseOffset,
                                    int middleTermOffset)
      • getLinesCount

        public int getLinesCount()
        Returns:
        The number of lines in the block.
      • getMiddleLineIndex

        public int getMiddleLineIndex()
        Returns:
        The index of the middle line of the block.
      • getMiddleLineOffset

        public int getMiddleLineOffset()
        Returns:
        The offset to the middle line of the block, relative to the block start.
      • getTermStatesBaseOffset

        public int getTermStatesBaseOffset()
        Returns:
        The offset to the details region of the block (the term states), relative to the block start.
      • getBaseDocsFP

        public long getBaseDocsFP()
        Returns:
        The file pointer to the docs of the first term with docs in the block.
      • getBasePositionsFP

        public long getBasePositionsFP()
        Returns:
        The file pointer to the positions of the first term with positions in the block.
      • getBasePayloadsFP

        public long getBasePayloadsFP()
        Returns:
        The file pointer to the payloads of the first term with payloads in the block.
      • ramBytesUsed

        public long ramBytesUsed()
        Description copied from interface: Accountable
        Return the memory usage of this object in bytes. Negative values are illegal.
        Specified by:
        ramBytesUsed in interface Accountable