Class IndexSummaryBuilder

java.lang.Object
org.apache.cassandra.io.sstable.indexsummary.IndexSummaryBuilder
All Implemented Interfaces:
AutoCloseable

public class IndexSummaryBuilder extends Object implements AutoCloseable
  • Constructor Details

    • 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 Details

    • markIndexSynced

      public void markIndexSynced(long upToPosition)
    • markDataSynced

      public void markDataSynced(long upToPosition)
    • getLastReadableBoundary

      public IndexSummaryBuilder.ReadableBoundary getLastReadableBoundary()
    • maybeAddEntry

      public IndexSummaryBuilder maybeAddEntry(DecoratedKey decoratedKey, long indexStart) throws IOException
      Throws:
      IOException
    • maybeAddEntry

      public IndexSummaryBuilder maybeAddEntry(DecoratedKey decoratedKey, long indexStart, long indexEnd, long dataEnd) throws 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:
      IOException
    • prepareToCommit

      public void prepareToCommit()
    • build

      public IndexSummary build(IPartitioner partitioner)
    • build

      public IndexSummary build(IPartitioner partitioner, IndexSummaryBuilder.ReadableBoundary boundary)
    • close

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

      public Throwable close(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