Class LegacyDirectMonotonicWriter


  • public final class LegacyDirectMonotonicWriter
    extends java.lang.Object
    Write monotonically-increasing sequences of integers. This writer splits data into blocks and then for each block, computes the average slope, the minimum value and only encode the delta from the expected value using a LegacyDirectWriter.
    See Also:
    LegacyDirectMonotonicReader
    • Field Detail

      • MIN_BLOCK_SHIFT

        public static final int MIN_BLOCK_SHIFT
        min block shift
        See Also:
        Constant Field Values
      • MAX_BLOCK_SHIFT

        public static final int MAX_BLOCK_SHIFT
        max block shift
        See Also:
        Constant Field Values
      • numValues

        final long numValues
      • baseDataPointer

        final long baseDataPointer
      • buffer

        final long[] buffer
      • bufferSize

        int bufferSize
      • count

        long count
      • finished

        boolean finished
      • previous

        long previous
    • Constructor Detail

      • LegacyDirectMonotonicWriter

        LegacyDirectMonotonicWriter​(IndexOutput metaOut,
                                    IndexOutput dataOut,
                                    long numValues,
                                    int blockShift)
    • Method Detail

      • flush

        private void flush()
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • add

        public void add​(long v)
                 throws java.io.IOException
        Write a new value. Note that data might not make it to storage until finish() is called.
        Throws:
        java.lang.IllegalArgumentException - if values don't come in order
        java.io.IOException
      • finish

        public void finish()
                    throws java.io.IOException
        This must be called exactly once after all values have been added.
        Throws:
        java.io.IOException
      • getInstance

        public static LegacyDirectMonotonicWriter getInstance​(IndexOutput metaOut,
                                                              IndexOutput dataOut,
                                                              long numValues,
                                                              int blockShift)
        Returns an instance suitable for encoding numValues into monotonic blocks of 2blockShift values. Metadata will be written to metaOut and actual data to dataOut.