me.prettyprint.cassandra.service
Class MultigetSliceIterator<K,N,V>

java.lang.Object
  extended by me.prettyprint.cassandra.service.MultigetSliceIterator<K,N,V>
Type Parameters:
K - The type of the row key
N - Column name type
V - Column value type
All Implemented Interfaces:
Iterator<Row<K,N,V>>

public class MultigetSliceIterator<K,N,V>
extends Object
implements Iterator<Row<K,N,V>>

Iterates over the MultigetSliceQuery result set, refreshing until all qualifying rows are retrieved based on input keys.  This iterator is optimized for parallelism with the help of maxThreadCount option provided. If maxThreadCount is not provided, it calls Cassandra with the set(maxRowCountPerQuery) of row keys at a time unless all keys are queried. E.g., maxRowCountPerQuery is 100 and maxThreadCount 5, it calls Cassandra 5 times using 5 threads/ parallelism for total of 500 keys. You can also configure it not to use Threads and call Cassandra 5 time sequentially instead of parallelism by not setting maxThreadCount or setting it 0

Author:
vchella

Constructor Summary
MultigetSliceIterator(boolean reversed, int maxRowCountPerQuery, Keyspace keyspace, Serializer<K> keySerializer, Serializer<N> nameSerializer, Serializer<V> valueSerializer, String columnFamily, List<K> rowKeys, N start, N finish)
          Constructor with the required parameters.
MultigetSliceIterator(boolean reversed, int maxRowCountPerQuery, Keyspace keyspace, Serializer<K> keySerializer, Serializer<N> nameSerializer, Serializer<V> valueSerializer, String columnFamily, List<K> rowKeys, N start, N finish, int maxColumnCountPerRow)
          Constructor with the required parameters.
MultigetSliceIterator(boolean reversed, Keyspace keyspace, Serializer<K> keySerializer, Serializer<N> nameSerializer, Serializer<V> valueSerializer, String columnFamily, List<K> rowKeys, N start, N finish)
          Constructor with the required parameters.
MultigetSliceIterator(boolean reversed, Keyspace keyspace, Serializer<K> keySerializer, Serializer<N> nameSerializer, Serializer<V> valueSerializer, String columnFamily, List<K> rowKeys, N start, N finish, int maxColumnCountPerRow)
          Constructor with the required parameters Constructor with the required parameters.
MultigetSliceIterator(boolean reversed, Keyspace keyspace, Serializer<K> keySerializer, Serializer<N> nameSerializer, Serializer<V> valueSerializer, String columnFamily, List<K> rowKeys, N start, N finish, int maxThreadCount, int maxRowCountPerQuery, int maxColumnCountPerRow)
          Constructor with all required parameters.
 
Method Summary
 String getHostsUsed()
          The CassandraHost on which this operation was successful
 int getRowCountPerQueryUsed()
          Returns the RowCount per query used in this operation
 int getThreadCountUsed()
          Number of threads used to call Cassandra
 long getTotalExecutionTimeMicro()
          How long the operation took to execute in MICRO-seconds.
 long getTotalExecutionTimeNano()
          How long the operation took to execute in NANO-seconds.
 boolean hasNext()
           
 Row<K,N,V> next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultigetSliceIterator

public MultigetSliceIterator(boolean reversed,
                             Keyspace keyspace,
                             Serializer<K> keySerializer,
                             Serializer<N> nameSerializer,
                             Serializer<V> valueSerializer,
                             String columnFamily,
                             List<K> rowKeys,
                             N start,
                             N finish)
Constructor with the required parameters. Below are default parameter values int maxThreadCount = 0; //Disable parallelism int maxRowCountPerQuery = 0; // Query all keys at a time. int maxColumnCountPerRow = 100;// Limit columns count to 100 in each row

Parameters:
reversed -
maxColsCountPerQuery -
maxColCount -
maxRowCountPerQuery -
keyspace -
keySerializer -
nameSerializer -
valueSerializer -

MultigetSliceIterator

public MultigetSliceIterator(boolean reversed,
                             Keyspace keyspace,
                             Serializer<K> keySerializer,
                             Serializer<N> nameSerializer,
                             Serializer<V> valueSerializer,
                             String columnFamily,
                             List<K> rowKeys,
                             N start,
                             N finish,
                             int maxColumnCountPerRow)
Constructor with the required parameters Constructor with the required parameters. Below are default parameter values int maxThreadCount 0; //Disable parallelism int maxRowCountPerQuery = 0; // Query all keys at a time.

Parameters:
reversed -
maxColsCountPerQuery -
maxColCount -
maxRowCountPerQuery -
keyspace -
keySerializer -
nameSerializer -
valueSerializer -

MultigetSliceIterator

public MultigetSliceIterator(boolean reversed,
                             int maxRowCountPerQuery,
                             Keyspace keyspace,
                             Serializer<K> keySerializer,
                             Serializer<N> nameSerializer,
                             Serializer<V> valueSerializer,
                             String columnFamily,
                             List<K> rowKeys,
                             N start,
                             N finish,
                             int maxColumnCountPerRow)
Constructor with the required parameters. Below are default parameter values int maxThreadCount = 0; //Disable parallelism

Parameters:
reversed -
maxColsCountPerQuery -
maxColCount -
maxRowCountPerQuery -
keyspace -
keySerializer -
nameSerializer -
valueSerializer -

MultigetSliceIterator

public MultigetSliceIterator(boolean reversed,
                             int maxRowCountPerQuery,
                             Keyspace keyspace,
                             Serializer<K> keySerializer,
                             Serializer<N> nameSerializer,
                             Serializer<V> valueSerializer,
                             String columnFamily,
                             List<K> rowKeys,
                             N start,
                             N finish)
Constructor with the required parameters. Below are default parameter values int maxThreadCount = 0; //Disable parallelism int maxColumnCountPerRow = 100;// Limit columns count to 100 in each row

Parameters:
reversed -
maxColsCountPerQuery -
maxColCount -
maxRowCountPerQuery -
keyspace -
keySerializer -
nameSerializer -
valueSerializer -

MultigetSliceIterator

public MultigetSliceIterator(boolean reversed,
                             Keyspace keyspace,
                             Serializer<K> keySerializer,
                             Serializer<N> nameSerializer,
                             Serializer<V> valueSerializer,
                             String columnFamily,
                             List<K> rowKeys,
                             N start,
                             N finish,
                             int maxThreadCount,
                             int maxRowCountPerQuery,
                             int maxColumnCountPerRow)
Constructor with all required parameters. No default values will be used

Parameters:
reversed -
maxColsCountPerQuery -
maxColCount -
maxRowCountPerQuery -
keyspace -
keySerializer -
nameSerializer -
valueSerializer -
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<Row<K,N,V>>

next

public Row<K,N,V> next()
Specified by:
next in interface Iterator<Row<K,N,V>>

remove

public void remove()
Specified by:
remove in interface Iterator<Row<K,N,V>>

getTotalExecutionTimeMicro

public long getTotalExecutionTimeMicro()
How long the operation took to execute in MICRO-seconds. When parallelism is enabled, this value might not be correct always due to available system resources and thread implementation

Returns:
the totalExecutionTimeMicro

getTotalExecutionTimeNano

public long getTotalExecutionTimeNano()
How long the operation took to execute in NANO-seconds. When parallelism is enabled, this value might not be correct always due to available system resources and thread implementation

Returns:
the totalExecutionTimeNano

getHostsUsed

public String getHostsUsed()
The CassandraHost on which this operation was successful


getThreadCountUsed

public int getThreadCountUsed()
Number of threads used to call Cassandra

Returns:
Thread count used

getRowCountPerQueryUsed

public int getRowCountPerQueryUsed()
Returns the RowCount per query used in this operation

Returns:


Copyright © 2013. All Rights Reserved.