org.apache.cassandra.db
Class Table

java.lang.Object
  extended by org.apache.cassandra.db.Table

public class Table
extends java.lang.Object

It represents a Keyspace.


Field Summary
 java.lang.String name
           
static java.util.concurrent.locks.ReentrantReadWriteLock switchLock
          accesses to CFS.memtable should acquire this for thread safety.
static java.lang.String SYSTEM_KS
           
static com.google.common.base.Function<java.lang.String,Table> tableTransformer
           
 
Method Summary
static java.lang.Iterable<Table> all()
           
 void apply(RowMutation mutation, boolean writeCommitLog)
           
 void apply(RowMutation mutation, boolean writeCommitLog, boolean updateIndexes)
          This method appends a row to the global CommitLog, then updates memtables and indexes.
static Table clear(java.lang.String table)
           
static Table clear(java.lang.String table, Schema schema)
           
 void clearSnapshot(java.lang.String snapshotName)
          Clear all the snapshots for a given table.
 void createReplicationStrategy(KSMetaData ksm)
           
 void dropCf(java.util.UUID cfId)
           
 java.util.List<java.util.concurrent.Future<?>> flush()
           
 java.util.List<SSTableReader> getAllSSTables()
           
 ColumnFamilyStore getColumnFamilyStore(java.lang.String cfName)
           
 ColumnFamilyStore getColumnFamilyStore(java.util.UUID id)
           
 java.util.Collection<ColumnFamilyStore> getColumnFamilyStores()
           
 AbstractReplicationStrategy getReplicationStrategy()
           
 Row getRow(QueryFilter filter)
           
static java.lang.String getTimestampedSnapshotName(java.lang.String clientSuppliedName)
           
static void indexRow(DecoratedKey key, ColumnFamilyStore cfs, java.util.Set<java.lang.String> idxNames)
           
 void initCf(java.util.UUID cfId, java.lang.String cfName, boolean loadSSTables)
          adds a cf to internal structures, ends up creating disk files).
static java.lang.Iterable<Table> nonSystem()
           
static Table open(java.lang.String table)
           
static Table openWithoutSSTables(java.lang.String table)
           
static void removeUnreadableSSTables(java.io.File directory)
          Removes every SSTable in the directory from the appropriate DataTracker's view.
 void snapshot(java.lang.String snapshotName, java.lang.String columnFamilyName)
          Take a snapshot of the specific column family, or the entire set of column families if columnFamily is null with a given timestamp
 boolean snapshotExists(java.lang.String snapshotName)
          Check whether snapshots already exists for a given name.
static java.lang.Iterable<Table> system()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SYSTEM_KS

public static final java.lang.String SYSTEM_KS
See Also:
Constant Field Values

switchLock

public static final java.util.concurrent.locks.ReentrantReadWriteLock switchLock
accesses to CFS.memtable should acquire this for thread safety. CFS.maybeSwitchMemtable should aquire the writeLock; see that method for the full explanation.

(Enabling fairness in the RRWL is observed to decrease throughput, so we leave it off.)


name

public final java.lang.String name

tableTransformer

public static final com.google.common.base.Function<java.lang.String,Table> tableTransformer
Method Detail

open

public static Table open(java.lang.String table)

openWithoutSSTables

public static Table openWithoutSSTables(java.lang.String table)

clear

public static Table clear(java.lang.String table)
                   throws java.io.IOException
Throws:
java.io.IOException

clear

public static Table clear(java.lang.String table,
                          Schema schema)
                   throws java.io.IOException
Throws:
java.io.IOException

removeUnreadableSSTables

public static void removeUnreadableSSTables(java.io.File directory)
Removes every SSTable in the directory from the appropriate DataTracker's view.

Parameters:
directory - the unreadable directory, possibly with SSTables in it, but not necessarily.

getColumnFamilyStores

public java.util.Collection<ColumnFamilyStore> getColumnFamilyStores()

getColumnFamilyStore

public ColumnFamilyStore getColumnFamilyStore(java.lang.String cfName)

getColumnFamilyStore

public ColumnFamilyStore getColumnFamilyStore(java.util.UUID id)

snapshot

public void snapshot(java.lang.String snapshotName,
                     java.lang.String columnFamilyName)
              throws java.io.IOException
Take a snapshot of the specific column family, or the entire set of column families if columnFamily is null with a given timestamp

Parameters:
snapshotName - the tag associated with the name of the snapshot. This value may not be null
columnFamilyName - the column family to snapshot or all on null
Throws:
java.io.IOException - if the column family doesn't exist

getTimestampedSnapshotName

public static java.lang.String getTimestampedSnapshotName(java.lang.String clientSuppliedName)
Parameters:
clientSuppliedName - may be null.
Returns:
the name of the snapshot

snapshotExists

public boolean snapshotExists(java.lang.String snapshotName)
Check whether snapshots already exists for a given name.

Parameters:
snapshotName - the user supplied snapshot name
Returns:
true if the snapshot exists

clearSnapshot

public void clearSnapshot(java.lang.String snapshotName)
Clear all the snapshots for a given table.

Parameters:
snapshotName - the user supplied snapshot name. It empty or null, all the snapshots will be cleaned

getAllSSTables

public java.util.List<SSTableReader> getAllSSTables()
Returns:
A list of open SSTableReaders

createReplicationStrategy

public void createReplicationStrategy(KSMetaData ksm)
                               throws ConfigurationException
Throws:
ConfigurationException

dropCf

public void dropCf(java.util.UUID cfId)
            throws java.io.IOException
Throws:
java.io.IOException

initCf

public void initCf(java.util.UUID cfId,
                   java.lang.String cfName,
                   boolean loadSSTables)
adds a cf to internal structures, ends up creating disk files).


getRow

public Row getRow(QueryFilter filter)

apply

public void apply(RowMutation mutation,
                  boolean writeCommitLog)

apply

public void apply(RowMutation mutation,
                  boolean writeCommitLog,
                  boolean updateIndexes)
This method appends a row to the global CommitLog, then updates memtables and indexes.

Parameters:
mutation - the row to write. Must not be modified after calling apply, since commitlog append may happen concurrently, depending on the CL Executor type.
writeCommitLog - false to disable commitlog append entirely
updateIndexes - false to disable index updates (used by CollationController "defragmenting")

getReplicationStrategy

public AbstractReplicationStrategy getReplicationStrategy()

indexRow

public static void indexRow(DecoratedKey key,
                            ColumnFamilyStore cfs,
                            java.util.Set<java.lang.String> idxNames)
Parameters:
key - row to index
cfs - ColumnFamily to index row in
idxNames - columns to index, in comparator order

flush

public java.util.List<java.util.concurrent.Future<?>> flush()

all

public static java.lang.Iterable<Table> all()

nonSystem

public static java.lang.Iterable<Table> nonSystem()

system

public static java.lang.Iterable<Table> system()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2013 The Apache Software Foundation