|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cassandra.io.SSTable
public class SSTable
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. SSTable is broken up into blocks where each block contains 128 keys. At the end of the file the block index is written which contains the offsets to the keys in the block. SSTable also maintains an index file to which every 128th key is written with a pointer to the block index which is the block that actually contains the key. This index file is then read and maintained in memory. SSTable is append only and immutable. SSTable on disk looks as follows:
------------------------- |------------------------|<-------| | | | BLOCK-INDEX PTR | | | |------------------------|-------- |------------------------|<-------| | | | | | | BLOCK-INDEX PTR | | | |------------------------|--------- |------------------------|<--------| | | | | | | | | | BLOCK-INDEX PTR | | | |------------------------| | |------------------------|---------- |------------------------|-----------------> BLOOM-FILTER version-info <--|----------|-------------|-------> relative offset to last block index. Author : Avinash Lakshman ( alakshman@facebook.com) & Prashant Malik ( pmalik@facebook.com )
Nested Class Summary | |
---|---|
protected static class |
SSTable.BlockMetadata
This class holds the position of a key in a block and the size of the data associated with this key. |
static class |
SSTable.KeyPositionInfo
This is a simple container for the index Key and its corresponding position in the data file. |
Field Summary | |
---|---|
static java.lang.String |
blockIndexKey_
|
static java.lang.String |
temporaryFile_
|
Constructor Summary | |
---|---|
SSTable(java.lang.String dataFileName,
IPartitioner partitioner)
This ctor basically gets passed in the full path name of the data file associated with this SSTable. |
|
SSTable(java.lang.String directory,
java.lang.String filename,
IPartitioner partitioner)
This ctor is used for writing data into the SSTable. |
Method Summary | |
---|---|
void |
append(java.lang.String decoratedKey,
byte[] value)
|
void |
append(java.lang.String decoratedKey,
DataOutputBuffer buffer)
|
void |
close()
|
void |
close(BloomFilter bf)
|
void |
closeRename(BloomFilter bf)
Renames a temporary SSTable file to a valid data and index file |
static void |
delete(java.lang.String dataFile)
This method deletes both the specified data file and the associated index file |
static int |
getApproximateKeyCount(java.util.List<java.lang.String> dataFiles)
|
static Coordinate |
getCoordinates(java.lang.String decoratedKey,
IFileReader dataReader,
IPartitioner partitioner)
|
java.lang.String |
getDataFileLocation()
|
static java.util.List<java.lang.String> |
getIndexedKeys()
Get all indexed keys in the SSTable. |
static int |
indexInterval()
|
static boolean |
isKeyInFile(java.lang.String clientKey,
java.lang.String filename)
|
DataInputBuffer |
next(java.lang.String clientKey,
java.lang.String columnFamilyColumn)
|
DataInputBuffer |
next(java.lang.String clientKey,
java.lang.String cfName,
java.util.List<java.lang.String> columnNames)
|
DataInputBuffer |
next(java.lang.String clientKey,
java.lang.String cfName,
java.util.List<java.lang.String> columnNames,
IndexHelper.TimeRange timeRange)
|
static void |
onStart(java.util.List<java.lang.String> filenames)
|
static void |
removeAssociatedBloomFilter(java.lang.String filename)
|
static void |
storeBloomFilter(java.lang.String filename,
BloomFilter bf)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String blockIndexKey_
public static final java.lang.String temporaryFile_
Constructor Detail |
---|
public SSTable(java.lang.String dataFileName, IPartitioner partitioner) throws java.io.IOException
java.io.IOException
public SSTable(java.lang.String directory, java.lang.String filename, IPartitioner partitioner) throws java.io.IOException
java.io.IOException
Method Detail |
---|
public static int indexInterval()
public static void delete(java.lang.String dataFile)
dataFile
- - data file associated with the SSTablepublic static int getApproximateKeyCount(java.util.List<java.lang.String> dataFiles)
public static java.util.List<java.lang.String> getIndexedKeys()
public static void onStart(java.util.List<java.lang.String> filenames) throws java.io.IOException
java.io.IOException
public static void storeBloomFilter(java.lang.String filename, BloomFilter bf)
public static void removeAssociatedBloomFilter(java.lang.String filename)
public static boolean isKeyInFile(java.lang.String clientKey, java.lang.String filename)
public java.lang.String getDataFileLocation() throws java.io.IOException
java.io.IOException
public void append(java.lang.String decoratedKey, DataOutputBuffer buffer) throws java.io.IOException
java.io.IOException
public void append(java.lang.String decoratedKey, byte[] value) throws java.io.IOException
java.io.IOException
public static Coordinate getCoordinates(java.lang.String decoratedKey, IFileReader dataReader, IPartitioner partitioner) throws java.io.IOException
java.io.IOException
public DataInputBuffer next(java.lang.String clientKey, java.lang.String cfName, java.util.List<java.lang.String> columnNames) throws java.io.IOException
java.io.IOException
public DataInputBuffer next(java.lang.String clientKey, java.lang.String cfName, java.util.List<java.lang.String> columnNames, IndexHelper.TimeRange timeRange) throws java.io.IOException
java.io.IOException
public DataInputBuffer next(java.lang.String clientKey, java.lang.String columnFamilyColumn) throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
java.io.IOException
public void close(BloomFilter bf) throws java.io.IOException
java.io.IOException
public void closeRename(BloomFilter bf) throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |