org.apache.cassandra.io.sstable
Class IndexHelper

java.lang.Object
  extended by org.apache.cassandra.io.sstable.IndexHelper

public class IndexHelper
extends java.lang.Object

Provides helper to serialize, deserialize and use column indexes.


Nested Class Summary
static class IndexHelper.IndexInfo
           
 
Constructor Summary
IndexHelper()
           
 
Method Summary
static Filter defreezeBloomFilter(FileDataInput file, boolean useOldBuffer)
          De-freeze the bloom filter.
static java.util.ArrayList<IndexHelper.IndexInfo> deserializeIndex(FileDataInput in)
          Deserialize the index into a structure and return it
static java.util.Comparator<IndexHelper.IndexInfo> getComparator(AbstractType nameComparator)
           
static int indexFor(java.nio.ByteBuffer name, java.util.List<IndexHelper.IndexInfo> indexList, AbstractType comparator, boolean reversed)
          the index of the IndexInfo in which @name will be found.
static void skipBloomFilter(FileDataInput in)
          Skip the bloom filter
static void skipIndex(FileDataInput file)
          Skip the index
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexHelper

public IndexHelper()
Method Detail

skipBloomFilter

public static void skipBloomFilter(FileDataInput in)
                            throws java.io.IOException
Skip the bloom filter

Parameters:
in - the data input from which the bloom filter should be skipped
Throws:
java.io.IOException

skipIndex

public static void skipIndex(FileDataInput file)
                      throws java.io.IOException
Skip the index

Parameters:
file - the data input from which the index should be skipped
Throws:
java.io.IOException - if an I/O error occurs.

deserializeIndex

public static java.util.ArrayList<IndexHelper.IndexInfo> deserializeIndex(FileDataInput in)
                                                                   throws java.io.IOException
Deserialize the index into a structure and return it

Parameters:
in - - input source
Returns:
ArrayList - list of de-serialized indexes
Throws:
java.io.IOException - if an I/O error occurs.

defreezeBloomFilter

public static Filter defreezeBloomFilter(FileDataInput file,
                                         boolean useOldBuffer)
                                  throws java.io.IOException
De-freeze the bloom filter.

Parameters:
file - - source file
useOldBuffer - - do we need to reuse old buffer?
Returns:
bloom filter summarizing the column information
Throws:
java.io.IOException - if an I/O error occurs.

indexFor

public static int indexFor(java.nio.ByteBuffer name,
                           java.util.List<IndexHelper.IndexInfo> indexList,
                           AbstractType comparator,
                           boolean reversed)
the index of the IndexInfo in which @name will be found. If the index is @indexList.size(), the @name appears nowhere.

Parameters:
name - name of the index
indexList - list of the indexInfo objects
comparator - comparator type
reversed - is name reversed
Returns:
int index

getComparator

public static java.util.Comparator<IndexHelper.IndexInfo> getComparator(AbstractType nameComparator)


Copyright © 2011 The Apache Software Foundation