org.apache.cassandra.io.sstable
Class SSTableSimpleWriter

java.lang.Object
  extended by org.apache.cassandra.io.sstable.AbstractSSTableSimpleWriter
      extended by org.apache.cassandra.io.sstable.SSTableSimpleWriter

public class SSTableSimpleWriter
extends AbstractSSTableSimpleWriter

A SSTable writer that assumes rows are in (partitioner) sorted order. Contrarily to SSTableSimpleUnsortedWriter, this writer does not buffer anything into memory, however it assumes that row are added in sorted order (an exception will be thrown otherwise), which for the RandomPartitioner means that rows should be added by increasing md5 of the row key. This is rarely possible and SSTableSimpleUnsortedWriter should most of the time be prefered.

See Also:
AbstractSSTableSimpleWriter

Field Summary
 
Fields inherited from class org.apache.cassandra.io.sstable.AbstractSSTableSimpleWriter
columnFamily, currentKey, currentSuperColumn, directory, metadata, nodeid
 
Constructor Summary
SSTableSimpleWriter(java.io.File directory, CFMetaData metadata)
           
SSTableSimpleWriter(java.io.File directory, java.lang.String keyspace, java.lang.String columnFamily, AbstractType comparator, AbstractType subComparator)
          Create a new writer.
 
Method Summary
 void close()
          Close this writer.
protected  ColumnFamily getColumnFamily()
           
protected  void writeRow(DecoratedKey key, ColumnFamily columnFamily)
           
 
Methods inherited from class org.apache.cassandra.io.sstable.AbstractSSTableSimpleWriter
addColumn, addCounterColumn, addExpiringColumn, getWriter, newRow, newSuperColumn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SSTableSimpleWriter

public SSTableSimpleWriter(java.io.File directory,
                           java.lang.String keyspace,
                           java.lang.String columnFamily,
                           AbstractType comparator,
                           AbstractType subComparator)
                    throws java.io.IOException
Create a new writer.

Parameters:
directory - the directory where to write the sstable
keyspace - the keyspace name
columnFamily - the column family name
comparator - the column family comparator
subComparator - the column family subComparator or null if not a Super column family.
Throws:
java.io.IOException

SSTableSimpleWriter

public SSTableSimpleWriter(java.io.File directory,
                           CFMetaData metadata)
                    throws java.io.IOException
Throws:
java.io.IOException
Method Detail

close

public void close()
           throws java.io.IOException
Description copied from class: AbstractSSTableSimpleWriter
Close this writer. This method should be called, otherwise the produced sstables are not guaranteed to be complete (and won't be in practice).

Specified by:
close in class AbstractSSTableSimpleWriter
Throws:
java.io.IOException

writeRow

protected void writeRow(DecoratedKey key,
                        ColumnFamily columnFamily)
                 throws java.io.IOException
Specified by:
writeRow in class AbstractSSTableSimpleWriter
Throws:
java.io.IOException

getColumnFamily

protected ColumnFamily getColumnFamily()
Specified by:
getColumnFamily in class AbstractSSTableSimpleWriter


Copyright © 2011 The Apache Software Foundation