Class IndexSummaryBuilder

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class IndexSummaryBuilder
    extends java.lang.Object
    implements java.lang.AutoCloseable
    • Constructor Detail

      • IndexSummaryBuilder

        public IndexSummaryBuilder​(long expectedKeys,
                                   int minIndexInterval,
                                   int samplingLevel)
        Build an index summary builder.
        Parameters:
        expectedKeys - - the number of keys we expect in the sstable
        minIndexInterval - - the minimum interval between entries selected for sampling
        samplingLevel - - the level at which entries are sampled
    • Method Detail

      • markIndexSynced

        public void markIndexSynced​(long upToPosition)
      • markDataSynced

        public void markDataSynced​(long upToPosition)
      • maybeAddEntry

        public IndexSummaryBuilder maybeAddEntry​(DecoratedKey decoratedKey,
                                                 long indexStart)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • maybeAddEntry

        public IndexSummaryBuilder maybeAddEntry​(DecoratedKey decoratedKey,
                                                 long indexStart,
                                                 long indexEnd,
                                                 long dataEnd)
                                          throws java.io.IOException
        Parameters:
        decoratedKey - the key for this record
        indexStart - the position in the index file this record begins
        indexEnd - the position in the index file we need to be able to read to (exclusive) to read this record
        dataEnd - the position in the data file we need to be able to read to (exclusive) to read this record a value of 0 indicates we are not tracking readable boundaries
        Throws:
        java.io.IOException
      • prepareToCommit

        public void prepareToCommit()
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
      • close

        public java.lang.Throwable close​(java.lang.Throwable accumulate)
      • downsample

        public static IndexSummary downsample​(IndexSummary existing,
                                              int newSamplingLevel,
                                              int minIndexInterval,
                                              IPartitioner partitioner)
        Downsamples an existing index summary to a new sampling level.
        Parameters:
        existing - an existing IndexSummary
        newSamplingLevel - the target level for the new IndexSummary. This must be less than the current sampling level for `existing`.
        partitioner - the partitioner used for the index summary
        Returns:
        a new IndexSummary