org.apache.cassandra.db
Class ColumnFamilyStore

java.lang.Object
  extended by org.apache.cassandra.db.ColumnFamilyStore
All Implemented Interfaces:
ColumnFamilyStoreMBean

public final class ColumnFamilyStore
extends java.lang.Object
implements ColumnFamilyStoreMBean


Field Summary
 java.lang.String columnFamily_
           
 
Method Summary
 void addSSTable(SSTableReader sstable)
           
 java.lang.String cfStats(java.lang.String newLineSeparator)
           
 java.util.concurrent.Future<?> forceFlush()
          Triggers an immediate memtable flush.
 void forceFlushBinary()
           
 void forceFlushIfExpired()
           
 ColumnFamily getColumnFamily(QueryFilter filter)
           
 ColumnFamily getColumnFamily(QueryFilter filter, int gcBefore)
          get a list of columns starting from a given column, in a specified order.
 ColumnFamily getColumnFamily(java.lang.String key, QueryPath path, byte[] start, byte[] finish, boolean reversed, int limit)
           
 java.lang.String getColumnFamilyName()
           
static ColumnFamilyStore getColumnFamilyStore(java.lang.String table, java.lang.String columnFamily)
           
 AbstractType getComparator()
           
static int getDefaultGCBefore()
           
static int getGenerationFromFileName(java.lang.String filename)
           
 RangeReply getKeyRange(java.lang.String startWith, java.lang.String stopAt, int maxResults)
           
 RangeReply getKeyRangeRaw(DecoratedKey startWith, DecoratedKey stopAt, int maxResults)
           
 int getMemtableColumnsCount()
          Returns the total number of columns present in the memtable.
 int getMemtableDataSize()
          Returns the total amount of data stored in the memtable, including column related overhead.
 int getMemtableSwitchCount()
          Returns the number of times that a flush has resulted in the memtable being switched out.
 int getPendingTasks()
           
 RangeSliceReply getRangeSlice(byte[] super_column, DecoratedKey startKey, DecoratedKey finishKey, int keyMax, SliceRange sliceRange, java.util.List<byte[]> columnNames)
           
 int getReadCount()
           
 double getReadLatency()
           
 java.util.Collection<SSTableReader> getSSTables()
           
 java.lang.String getTempSSTableFileName()
           
static java.util.List<Memtable> getUnflushedMemtables(java.lang.String cfName)
           
 int getWriteCount()
           
 double getWriteLatency()
           
 boolean isSuper()
           
 java.util.Iterator<DecoratedKey> memtableKeyIterator()
           
static ColumnFamily removeDeleted(ColumnFamily cf, int gcBefore)
           
 void snapshot(java.lang.String snapshotName)
          Take a snap shot of this columnfamily store.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

columnFamily_

public final java.lang.String columnFamily_
Method Detail

getColumnFamilyStore

public static ColumnFamilyStore getColumnFamilyStore(java.lang.String table,
                                                     java.lang.String columnFamily)
                                              throws java.io.IOException
Throws:
java.io.IOException

cfStats

public java.lang.String cfStats(java.lang.String newLineSeparator)

getColumnFamilyName

public java.lang.String getColumnFamilyName()
Specified by:
getColumnFamilyName in interface ColumnFamilyStoreMBean
Returns:
the name of the column family

getGenerationFromFileName

public static int getGenerationFromFileName(java.lang.String filename)

getTempSSTableFileName

public java.lang.String getTempSSTableFileName()

forceFlushIfExpired

public void forceFlushIfExpired()
                         throws java.io.IOException
Throws:
java.io.IOException

forceFlush

public java.util.concurrent.Future<?> forceFlush()
                                          throws java.io.IOException
Description copied from interface: ColumnFamilyStoreMBean
Triggers an immediate memtable flush.

Specified by:
forceFlush in interface ColumnFamilyStoreMBean
Throws:
java.io.IOException

forceFlushBinary

public void forceFlushBinary()

getDefaultGCBefore

public static int getDefaultGCBefore()

removeDeleted

public static ColumnFamily removeDeleted(ColumnFamily cf,
                                         int gcBefore)

addSSTable

public void addSSTable(SSTableReader sstable)

getUnflushedMemtables

public static java.util.List<Memtable> getUnflushedMemtables(java.lang.String cfName)

isSuper

public boolean isSuper()

getMemtableColumnsCount

public int getMemtableColumnsCount()
Description copied from interface: ColumnFamilyStoreMBean
Returns the total number of columns present in the memtable.

Specified by:
getMemtableColumnsCount in interface ColumnFamilyStoreMBean
Returns:
The number of columns.

getMemtableDataSize

public int getMemtableDataSize()
Description copied from interface: ColumnFamilyStoreMBean
Returns the total amount of data stored in the memtable, including column related overhead.

Specified by:
getMemtableDataSize in interface ColumnFamilyStoreMBean
Returns:
The size in bytes.

getMemtableSwitchCount

public int getMemtableSwitchCount()
Description copied from interface: ColumnFamilyStoreMBean
Returns the number of times that a flush has resulted in the memtable being switched out.

Specified by:
getMemtableSwitchCount in interface ColumnFamilyStoreMBean
Returns:
the number of memtable switches

memtableKeyIterator

public java.util.Iterator<DecoratedKey> memtableKeyIterator()
                                                     throws java.util.concurrent.ExecutionException,
                                                            java.lang.InterruptedException
Throws:
java.util.concurrent.ExecutionException
java.lang.InterruptedException

getSSTables

public java.util.Collection<SSTableReader> getSSTables()

getReadCount

public int getReadCount()
Specified by:
getReadCount in interface ColumnFamilyStoreMBean
Returns:
the number of read operations on this column family in the last minute

getReadLatency

public double getReadLatency()
Specified by:
getReadLatency in interface ColumnFamilyStoreMBean
Returns:
average latency per read operation in the last minute

getPendingTasks

public int getPendingTasks()
Specified by:
getPendingTasks in interface ColumnFamilyStoreMBean
Returns:
the estimated number of tasks pending for this column family

getWriteCount

public int getWriteCount()
Specified by:
getWriteCount in interface ColumnFamilyStoreMBean
Returns:
the number of write operations on this column family in the last minute

getWriteLatency

public double getWriteLatency()
Specified by:
getWriteLatency in interface ColumnFamilyStoreMBean
Returns:
average latency per write operation in the last minute

getColumnFamily

public ColumnFamily getColumnFamily(java.lang.String key,
                                    QueryPath path,
                                    byte[] start,
                                    byte[] finish,
                                    boolean reversed,
                                    int limit)
                             throws java.io.IOException
Throws:
java.io.IOException

getColumnFamily

public ColumnFamily getColumnFamily(QueryFilter filter)
                             throws java.io.IOException
Throws:
java.io.IOException

getColumnFamily

public ColumnFamily getColumnFamily(QueryFilter filter,
                                    int gcBefore)
                             throws java.io.IOException
get a list of columns starting from a given column, in a specified order. only the latest version of a column is returned.

Returns:
null if there is no data and no tombstones; otherwise a ColumnFamily
Throws:
java.io.IOException

getKeyRange

public RangeReply getKeyRange(java.lang.String startWith,
                              java.lang.String stopAt,
                              int maxResults)
                       throws java.io.IOException,
                              java.util.concurrent.ExecutionException,
                              java.lang.InterruptedException
Parameters:
startWith - key to start with, inclusive. empty string = start at beginning.
stopAt - key to stop at, inclusive. empty string = stop only when keys are exhausted.
maxResults -
Returns:
list of keys between startWith and stopAt
Throws:
java.io.IOException
java.util.concurrent.ExecutionException
java.lang.InterruptedException

getKeyRangeRaw

public RangeReply getKeyRangeRaw(DecoratedKey startWith,
                                 DecoratedKey stopAt,
                                 int maxResults)
                          throws java.io.IOException,
                                 java.util.concurrent.ExecutionException,
                                 java.lang.InterruptedException
Parameters:
startWith - key to start with, inclusive. empty string = start at beginning.
stopAt - key to stop at, inclusive. empty string = stop only when keys are exhausted.
maxResults -
Returns:
list of keys between startWith and stopAt TODO refactor better. this is just getKeyRange w/o the deletion check, for the benefit of range_slice. still opens one randomaccessfile per key, which sucks. something like compactioniterator would be better.
Throws:
java.io.IOException
java.util.concurrent.ExecutionException
java.lang.InterruptedException

getRangeSlice

public RangeSliceReply getRangeSlice(byte[] super_column,
                                     DecoratedKey startKey,
                                     DecoratedKey finishKey,
                                     int keyMax,
                                     SliceRange sliceRange,
                                     java.util.List<byte[]> columnNames)
                              throws java.io.IOException,
                                     java.util.concurrent.ExecutionException,
                                     java.lang.InterruptedException
Parameters:
super_column -
startKey - key to start at (inclusive). empty string = start at the beginning.
finishKey - key to stop at (inclusive). empty string = stop at the end.
keyMax - maximum number of keys to process, regardless of startKey/finishKey
sliceRange - may be null if columnNames is specified. specifies contiguous columns to return in what order.
columnNames - may be null if sliceRange is specified. specifies which columns to return in what order. @return list of key->list tuples.
Throws:
java.io.IOException
java.util.concurrent.ExecutionException
java.lang.InterruptedException

getComparator

public AbstractType getComparator()

snapshot

public void snapshot(java.lang.String snapshotName)
              throws java.io.IOException
Take a snap shot of this columnfamily store.

Parameters:
snapshotName - the name of the associated with the snapshot
Throws:
java.io.IOException


Copyright © 2010 The Apache Software Foundation