## org.apache.cassandra.db.compaction
Class LeveledCompactionStrategy

    java.lang.Object
      org.apache.cassandra.db.compaction.AbstractCompactionStrategy
          org.apache.cassandra.db.compaction.LeveledCompactionStrategy

All Implemented Interfaces:
  INotificationConsumer

    public class LeveledCompactionStrategy

extends AbstractCompactionStrategy
implements INotificationConsumer

Field Summary

Fields inherited from class org.apache.cassandra.db.compaction.AbstractCompactionStrategy
`cfs, options`

Constructor Summary
`LeveledCompactionStrategy(ColumnFamilyStore cfs, java.util.Map<java.lang.String,java.lang.String> options)`

Method Summary
`java.util.List<AbstractCompactionTask>` `getBackgroundTasks(int gcBefore)`
`int` `getEstimatedRemainingTasks()`
`int` `getLevelSize(int i)`
`java.util.List<AbstractCompactionTask>` `getMaximalTasks(int gcBefore)`
`long` `getMaxSSTableSize()`
`AbstractCompactionTask` `getUserDefinedTask(java.util.Collection<SSTableReader> sstables, int gcBefore)`
`void` `handleNotification(INotification notification, java.lang.Object sender)`
`boolean` `isKeyExistenceExpensive(java.util.Set<? extends SSTable> sstablesToIgnore)`
`void` `shutdown()` Releases any resources if this strategy is shutdown (when the CFS is reloaded after a schema change).
`java.lang.String` `toString()`

Methods inherited from class org.apache.cassandra.db.compaction.AbstractCompactionStrategy
`getOptions`

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

Constructor Detail

### LeveledCompactionStrategy

    public LeveledCompactionStrategy(ColumnFamilyStore cfs,
                                     java.util.Map<java.lang.String,java.lang.String> options)

Method Detail

### shutdown

    public void shutdown()

  Description copied from class: `AbstractCompactionStrategy`
  Releases any resources if this strategy is shutdown (when the CFS is reloaded after a schema change). Default is to do nothing.

  Overrides:
    `shutdown` in class `AbstractCompactionStrategy`

### getLevelSize

    public int getLevelSize(int i)

### getBackgroundTasks

    public java.util.List<AbstractCompactionTask> getBackgroundTasks(int gcBefore)

  Specified by:
    `getBackgroundTasks` in class `AbstractCompactionStrategy`
  Parameters:
    `gcBefore` - throw away tombstones older than this
  Returns:
    a list of compaction tasks that should run in the background to get the sstable count down to desired parameters. Will not be null, but may be empty.

### getMaximalTasks

    public java.util.List<AbstractCompactionTask> getMaximalTasks(int gcBefore)

  Specified by:
    `getMaximalTasks` in class `AbstractCompactionStrategy`
  Parameters:
    `gcBefore` - throw away tombstones older than this
  Returns:
    a list of compaction tasks that should be run to compact this columnfamilystore as much as possible. Will not be null, but may be empty.

### getUserDefinedTask

    public AbstractCompactionTask getUserDefinedTask(java.util.Collection<SSTableReader> sstables,
                                                     int gcBefore)

  Specified by:
    `getUserDefinedTask` in class `AbstractCompactionStrategy`
    `gcBefore` - throw away tombstones older than this
  Returns:
    a compaction task corresponding to the requested sstables. Will not be null. (Will throw if user requests an invalid compaction.)

### getEstimatedRemainingTasks

    public int getEstimatedRemainingTasks()

  Specified by:
    `getEstimatedRemainingTasks` in class `AbstractCompactionStrategy`
  Returns:
    the number of background tasks estimated to still be needed for this columnfamilystore

### handleNotification

    public void handleNotification(INotification notification,
                                   java.lang.Object sender)

  Specified by:
    `handleNotification` in interface `INotificationConsumer`

### getMaxSSTableSize

    public long getMaxSSTableSize()

  Specified by:
    `getMaxSSTableSize` in class `AbstractCompactionStrategy`
  Returns:
    size in bytes of the largest sstables for this strategy

### isKeyExistenceExpensive

    public boolean isKeyExistenceExpensive(java.util.Set<? extends SSTable> sstablesToIgnore)

  Specified by:
    `isKeyExistenceExpensive` in class `AbstractCompactionStrategy`
  Returns:
    true if checking for whether a key exists, ignoring @param sstablesToIgnore, is going to be expensive

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

Copyright © 2012 The Apache Software Foundation