org.apache.cassandra.io
Class SSTable

java.lang.Object
  extended by org.apache.cassandra.io.SSTable
Direct Known Subclasses:
SSTableReader, SSTableWriter

public abstract class SSTable
extends java.lang.Object

This class is built on top of the SequenceFile. It stores data on disk in sorted fashion. However the sorting is upto the application. This class expects keys to be handed to it in sorted order. A separate index file is maintained as well, containing the SSTable keys and the offset into the SSTable at which they are found. Every 1/indexInterval key is read into memory when the SSTable is opened. Finally, a bloom filter file is also kept for the keys in each SSTable.


Nested Class Summary
static class SSTable.PositionSize
           
 
Field Summary
protected  BloomFilter bf
           
protected  java.lang.String columnFamilyName
           
static int FILES_ON_DISK
           
protected  IndexSummary indexSummary
           
protected  IPartitioner partitioner
           
protected  java.lang.String path
           
static java.lang.String TEMPFILE_MARKER
           
 
Constructor Summary
SSTable(java.lang.String filename, IPartitioner partitioner)
           
 
Method Summary
 long bytesOnDisk()
           
protected  java.lang.String compactedFilename()
           
protected static java.lang.String compactedFilename(java.lang.String dataFile)
           
static boolean deleteIfCompacted(java.lang.String dataFilename)
          We use a ReferenceQueue to manage deleting files that have been compacted and for which no more SSTable references exist.
 java.lang.String filterFilename()
           
protected static java.lang.String filterFilename(java.lang.String dataFile)
           
 java.util.List<java.lang.String> getAllFilenames()
           
 java.lang.String getColumnFamilyName()
           
 java.lang.String getFilename()
           
 java.lang.String getTableName()
           
static long getTotalBytes(java.lang.Iterable<SSTableReader> sstables)
           
 java.lang.String indexFilename()
           
static java.lang.String indexFilename(java.lang.String dataFile)
           
protected static java.lang.String parseColumnFamilyName(java.lang.String filename)
           
static java.lang.String parseTableName(java.lang.String filename)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FILES_ON_DISK

public static final int FILES_ON_DISK
See Also:
Constant Field Values

path

protected java.lang.String path

partitioner

protected IPartitioner partitioner

bf

protected BloomFilter bf

columnFamilyName

protected java.lang.String columnFamilyName

indexSummary

protected IndexSummary indexSummary

TEMPFILE_MARKER

public static final java.lang.String TEMPFILE_MARKER
See Also:
Constant Field Values
Constructor Detail

SSTable

public SSTable(java.lang.String filename,
               IPartitioner partitioner)
Method Detail

parseColumnFamilyName

protected static java.lang.String parseColumnFamilyName(java.lang.String filename)

indexFilename

public static java.lang.String indexFilename(java.lang.String dataFile)

indexFilename

public java.lang.String indexFilename()

compactedFilename

protected static java.lang.String compactedFilename(java.lang.String dataFile)

deleteIfCompacted

public static boolean deleteIfCompacted(java.lang.String dataFilename)
                                 throws java.io.IOException
We use a ReferenceQueue to manage deleting files that have been compacted and for which no more SSTable references exist. But this is not guaranteed to run for each such file because of the semantics of the JVM gc. So, we write a marker to `compactedFilename` when a file is compacted; if such a marker exists on startup, the file should be removed.

Returns:
true if the file was deleted
Throws:
java.io.IOException

compactedFilename

protected java.lang.String compactedFilename()

filterFilename

protected static java.lang.String filterFilename(java.lang.String dataFile)

filterFilename

public java.lang.String filterFilename()

getFilename

public java.lang.String getFilename()

getAllFilenames

public java.util.List<java.lang.String> getAllFilenames()
Returns:
full paths to all the files associated w/ this SSTable

getColumnFamilyName

public java.lang.String getColumnFamilyName()

getTableName

public java.lang.String getTableName()

parseTableName

public static java.lang.String parseTableName(java.lang.String filename)

getTotalBytes

public static long getTotalBytes(java.lang.Iterable<SSTableReader> sstables)

bytesOnDisk

public long bytesOnDisk()

toString

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


Copyright © 2010 The Apache Software Foundation