java.lang.Object
org.elasticsearch.index.codec.tsdb.pipeline.DecodingContext
All Implemented Interfaces:
MetadataReader

public final class DecodingContext extends Object implements MetadataReader
Mutable per-block context for decoding, tracking the position bitmap and delegating metadata reads to the underlying DataInput. Reused across blocks via clear().
  • Constructor Summary

    Constructors
    Constructor
    Description
    DecodingContext(int blockSize, int pipelineLength)
    Creates a decoding context.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the block size.
    void
    Resets this context for reuse with the next block.
    boolean
    isStageApplied(int position)
    Returns true if the stage at the given position was applied.
    Returns the metadata reader for accessing stage metadata.
    int
    Returns the number of stages in the pipeline.
    byte
    Reads a single byte.
    void
    readBytes(byte[] bytes, int offset, int length)
    Reads bytes into the given array.
    int
    Reads a fixed 4-byte integer in Lucene format.
    long
    Reads a fixed 8-byte long in Lucene format.
    int
    Reads a variable-length integer.
    long
    Reads a variable-length long.
    int
    Reads a zigzag-encoded variable-length integer.
    long
    Reads a zigzag-encoded variable-length long.
    void
    setDataInput(org.apache.lucene.store.DataInput dataInput)
    Sets the data input stream for reading block data and stage metadata.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.elasticsearch.index.codec.tsdb.pipeline.MetadataReader

    readBytes
  • Constructor Details

    • DecodingContext

      public DecodingContext(int blockSize, int pipelineLength)
      Creates a decoding context.
      Parameters:
      blockSize - the number of values per block
      pipelineLength - the number of stages in the pipeline
  • Method Details

    • setDataInput

      public void setDataInput(org.apache.lucene.store.DataInput dataInput)
      Sets the data input stream for reading block data and stage metadata.
      Parameters:
      dataInput - the data input stream
    • pipelineLength

      public int pipelineLength()
      Returns the number of stages in the pipeline.
      Returns:
      the pipeline length
    • isStageApplied

      public boolean isStageApplied(int position)
      Returns true if the stage at the given position was applied.
      Parameters:
      position - the zero-based stage index
      Returns:
      whether the stage was applied
    • metadata

      public MetadataReader metadata()
      Returns the metadata reader for accessing stage metadata.
      Returns:
      the metadata reader
    • blockSize

      public int blockSize()
      Returns the block size.
      Returns:
      the number of values per block
    • clear

      public void clear()
      Resets this context for reuse with the next block.

      NOTE: dataInput is intentionally nulled. Unlike EncodingContext which owns its MetadataBuffer, DecodingContext does not own the DataInput (it is injected). Nulling forces the caller to provide a fresh DataInput via setDataInput(org.apache.lucene.store.DataInput) before each block, which is a fail-fast against silently reading garbage from a stale stream.

    • readByte

      public byte readByte() throws IOException
      Description copied from interface: MetadataReader
      Reads a single byte.
      Specified by:
      readByte in interface MetadataReader
      Returns:
      the byte value
      Throws:
      IOException - if an I/O error occurs
    • readZInt

      public int readZInt() throws IOException
      Description copied from interface: MetadataReader
      Reads a zigzag-encoded variable-length integer.
      Specified by:
      readZInt in interface MetadataReader
      Returns:
      the decoded integer
      Throws:
      IOException - if an I/O error occurs
    • readZLong

      public long readZLong() throws IOException
      Description copied from interface: MetadataReader
      Reads a zigzag-encoded variable-length long.
      Specified by:
      readZLong in interface MetadataReader
      Returns:
      the decoded long
      Throws:
      IOException - if an I/O error occurs
    • readLong

      public long readLong() throws IOException
      Description copied from interface: MetadataReader
      Reads a fixed 8-byte long in Lucene format.
      Specified by:
      readLong in interface MetadataReader
      Returns:
      the long value
      Throws:
      IOException - if an I/O error occurs
    • readInt

      public int readInt() throws IOException
      Description copied from interface: MetadataReader
      Reads a fixed 4-byte integer in Lucene format.
      Specified by:
      readInt in interface MetadataReader
      Returns:
      the integer value
      Throws:
      IOException - if an I/O error occurs
    • readVInt

      public int readVInt() throws IOException
      Description copied from interface: MetadataReader
      Reads a variable-length integer.
      Specified by:
      readVInt in interface MetadataReader
      Returns:
      the decoded integer
      Throws:
      IOException - if an I/O error occurs
    • readVLong

      public long readVLong() throws IOException
      Description copied from interface: MetadataReader
      Reads a variable-length long.
      Specified by:
      readVLong in interface MetadataReader
      Returns:
      the decoded long
      Throws:
      IOException - if an I/O error occurs
    • readBytes

      public void readBytes(byte[] bytes, int offset, int length) throws IOException
      Description copied from interface: MetadataReader
      Reads bytes into the given array.
      Specified by:
      readBytes in interface MetadataReader
      Parameters:
      bytes - the destination array
      offset - the offset in the array
      length - the number of bytes to read
      Throws:
      IOException - if an I/O error occurs