## org.apache.cassandra.io
Class CompactionIterator

    java.lang.Object
      com.google.common.collect.UnmodifiableIterator<T>
          com.google.common.collect.AbstractIterator<T2>
              org.apache.cassandra.utils.ReducingIterator<IteratingRow,CompactionIterator.CompactedRow>
                  org.apache.cassandra.io.CompactionIterator

All Implemented Interfaces:
  java.io.Closeable, java.lang.Iterable<CompactionIterator.CompactedRow>, java.util.Iterator<CompactionIterator.CompactedRow>

    public class CompactionIterator

extends ReducingIterator<IteratingRow,CompactionIterator.CompactedRow>
implements java.io.Closeable

Nested Class Summary
`static class` `CompactionIterator.CompactedRow`

Field Summary
`protected static int` `FILE_BUFFER_SIZE`

Fields inherited from class org.apache.cassandra.utils.ReducingIterator
`last, source`

Constructor Summary
`` `CompactionIterator(ColumnFamilyStore cfs, java.lang.Iterable<SSTableReader> sstables, int gcBefore, boolean major)`
`protected` `CompactionIterator(ColumnFamilyStore cfs, java.util.Iterator iter, int gcBefore, boolean major)`

Method Summary
`void` `close()`
`long` `getBytesRead()`
`protected static org.apache.commons.collections.iterators.CollatingIterator` `getCollatingIterator(java.lang.Iterable<SSTableReader> sstables)`
`protected CompactionIterator.CompactedRow` `getReduced()` return the last object computed by reduce
`protected java.lang.Iterable<SSTableScanner>` `getScanners()`
`long` `getTotalBytes()`
`protected boolean` `isEqual(IteratingRow o1, IteratingRow o2)` override this if the keys you want to base the reduce on are not the same as the object itself (but can be generated from it)
`void` `reduce(IteratingRow current)` combine this object with the previous ones.

Methods inherited from class org.apache.cassandra.utils.ReducingIterator
`computeNext, iterator`

Methods inherited from class com.google.common.collect.AbstractIterator
`endOfData, hasNext, next, peek`

Methods inherited from class com.google.common.collect.UnmodifiableIterator
`remove`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface java.util.Iterator
`hasNext, next, remove`

Field Detail

### FILE_BUFFER_SIZE

    protected static final int FILE_BUFFER_SIZE

See Also:
  Constant Field Values

Constructor Detail

### CompactionIterator

    public CompactionIterator(ColumnFamilyStore cfs,
                              java.lang.Iterable<SSTableReader> sstables,
                              int gcBefore,
                              boolean major)
                       throws java.io.IOException

Throws:
  `java.io.IOException`

### CompactionIterator

    protected CompactionIterator(ColumnFamilyStore cfs,
                                 java.util.Iterator iter,
                                 int gcBefore,
                                 boolean major)

Method Detail

### getCollatingIterator

    protected static org.apache.commons.collections.iterators.CollatingIterator getCollatingIterator(java.lang.Iterable<SSTableReader> sstables)
                                                                                              throws java.io.IOException

  Throws:
    `java.io.IOException`

### isEqual

    protected boolean isEqual(IteratingRow o1,
                              IteratingRow o2)

  Description copied from class: `ReducingIterator`
  override this if the keys you want to base the reduce on are not the same as the object itself (but can be generated from it)

  Overrides:
    `isEqual` in class `ReducingIterator<IteratingRow,CompactionIterator.CompactedRow>`

### reduce

    public void reduce(IteratingRow current)

  Description copied from class: `ReducingIterator`
  combine this object with the previous ones. intermediate state is up to your implementation.

  Specified by:
    `reduce` in class `ReducingIterator<IteratingRow,CompactionIterator.CompactedRow>`

### getReduced

    protected CompactionIterator.CompactedRow getReduced()

  Description copied from class: `ReducingIterator`
  return the last object computed by reduce

  Specified by:
    `getReduced` in class `ReducingIterator<IteratingRow,CompactionIterator.CompactedRow>`

### close

    public void close()
               throws java.io.IOException

  Specified by:
    `close` in interface `java.io.Closeable`
  Throws:
    `java.io.IOException`

### getScanners

    protected java.lang.Iterable<SSTableScanner> getScanners()

### getTotalBytes

    public long getTotalBytes()

### getBytesRead

    public long getBytesRead()

Copyright © 2010 The Apache Software Foundation