org.apache.cassandra.db

## Class ColumnIndex.Builder

- java.lang.Object
- - org.apache.cassandra.db.ColumnIndex.Builder

- Enclosing class:
    ColumnIndex

      public static class ColumnIndex.Builder
      extends java.lang.Object

  Help to create an index for a column family based on size of columns, and write said columns to disk.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Builder(ColumnFamily cf, java.nio.ByteBuffer key, DataOutputPlus output)`
    `Builder(ColumnFamily cf, java.nio.ByteBuffer key, DataOutputPlus output, OnDiskAtom.SerializerForWriting serializer)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(OnDiskAtom column)`
    `ColumnIndex` | `build()`
    `ColumnIndex` | `build(ColumnFamily cf)` Serializes the index into in-memory structure with all required components such as Bloom Filter, index block size, IndexInfo list
    `ColumnIndex` | `buildForCompaction(java.util.Iterator<OnDiskAtom> columns)` The important distinction wrt build() is that we may be building for a row that ends up being compacted away entirely, i.e., the input consists only of expired tombstones (or columns shadowed by expired tombstone).
    `void` | `finishAddingAtoms()`
    `void` | `maybeWriteEmptyRowHeader()`
    `RangeTombstone.Tracker` | `tombstoneTracker()`
    `int` | `writtenAtomCount()`

    - ### Methods inherited from class java.lang.Object

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

- - ### Constructor Detail

    - #### Builder

          public Builder(ColumnFamily cf,
                         java.nio.ByteBuffer key,
                         DataOutputPlus output)

    - #### Builder

          public Builder(ColumnFamily cf,
                         java.nio.ByteBuffer key,
                         DataOutputPlus output,
                         OnDiskAtom.SerializerForWriting serializer)

  - ### Method Detail

    - #### tombstoneTracker

          public RangeTombstone.Tracker tombstoneTracker()

    - #### writtenAtomCount

          public int writtenAtomCount()

    - #### build

          public ColumnIndex build(ColumnFamily cf)
                            throws java.io.IOException

      Serializes the index into in-memory structure with all required components such as Bloom Filter, index block size, IndexInfo list
      Parameters:
        `cf` - Column family to create index for
      Returns:
        information about index - it's Bloom Filter, block size and IndexInfo list
      Throws:
        `java.io.IOException`

    - #### buildForCompaction

          public ColumnIndex buildForCompaction(java.util.Iterator<OnDiskAtom> columns)
                                         throws java.io.IOException

      The important distinction wrt build() is that we may be building for a row that ends up being compacted away entirely, i.e., the input consists only of expired tombstones (or columns shadowed by expired tombstone). Thus, it is the caller's responsibility to decide whether to write the header for an empty row.
      Throws:
        `java.io.IOException`

    - #### add

          public void add(OnDiskAtom column)
                   throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### finishAddingAtoms

          public void finishAddingAtoms()
                                 throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### build

          public ColumnIndex build()

    - #### maybeWriteEmptyRowHeader

          public void maybeWriteEmptyRowHeader()
                                        throws java.io.IOException

      Throws:
        `java.io.IOException`

Copyright © 2018 The Apache Software Foundation