me.prettyprint.cassandra.service
Class VirtualKeyspaceServiceImpl

java.lang.Object
  extended by me.prettyprint.cassandra.service.KeyspaceServiceImpl
      extended by me.prettyprint.cassandra.service.VirtualKeyspaceServiceImpl
All Implemented Interfaces:
KeyspaceService

public class VirtualKeyspaceServiceImpl
extends KeyspaceServiceImpl


Field Summary
 
Fields inherited from interface me.prettyprint.cassandra.service.KeyspaceService
CF_TYPE, CF_TYPE_STANDARD, CF_TYPE_SUPER
 
Constructor Summary
VirtualKeyspaceServiceImpl(String keyspaceName, E keyPrefix, Serializer<E> keyPrefixSerializer, ConsistencyLevelPolicy consistencyLevel, HConnectionManager connectionManager, FailoverPolicy failoverPolicy)
           
VirtualKeyspaceServiceImpl(String keyspaceName, E keyPrefix, Serializer<E> keyPrefixSerializer, ConsistencyLevelPolicy consistencyLevel, HConnectionManager connectionManager, FailoverPolicy failoverPolicy, Map<String,String> credentials)
           
 
Method Summary
 void addCounter(ByteBuffer key, org.apache.cassandra.thrift.ColumnParent columnParent, org.apache.cassandra.thrift.CounterColumn counterColumn)
          Add a counter with CL.ONE
 void batchMutate(BatchMutation batchMutate)
          Call batch mutate with the BatchMutation object which encapsulates some of the complexity of the batch_mutate API signature
 void batchMutate(Map<ByteBuffer,Map<String,List<org.apache.cassandra.thrift.Mutation>>> mutationMap)
          Call batch mutate with the assembled mutationMap.
 org.apache.cassandra.thrift.Column getColumn(ByteBuffer key, org.apache.cassandra.thrift.ColumnPath columnPath)
          Get the Column at the given columnPath.
 int getCount(ByteBuffer key, org.apache.cassandra.thrift.ColumnParent columnParent, org.apache.cassandra.thrift.SlicePredicate predicate)
          Counts the columns present in columnParent.
 org.apache.cassandra.thrift.CounterColumn getCounter(ByteBuffer key, org.apache.cassandra.thrift.ColumnPath columnPath)
          Get the Counter at the given columnPath.
 List<org.apache.cassandra.thrift.CounterColumn> getCounterSlice(ByteBuffer key, org.apache.cassandra.thrift.ColumnParent columnParent, org.apache.cassandra.thrift.SlicePredicate predicate)
          Get the group of counter columns contained by columnParent.
 List<org.apache.cassandra.thrift.CounterSuperColumn> getCounterSuperSlice(ByteBuffer key, org.apache.cassandra.thrift.ColumnParent columnParent, org.apache.cassandra.thrift.SlicePredicate predicate)
          Get the group of superColumn contained by columnParent.
 Map<ByteBuffer,List<org.apache.cassandra.thrift.Column>> getIndexedSlices(org.apache.cassandra.thrift.ColumnParent columnParent, org.apache.cassandra.thrift.IndexClause indexClause, org.apache.cassandra.thrift.SlicePredicate predicate)
          returns a subset of columns for a range of keys.
 Map<ByteBuffer,List<org.apache.cassandra.thrift.CounterColumn>> getRangeCounterSlices(org.apache.cassandra.thrift.ColumnParent columnParent, org.apache.cassandra.thrift.SlicePredicate predicate, org.apache.cassandra.thrift.KeyRange keyRange)
          returns a subset of counter columns for a range of keys
 Map<ByteBuffer,List<org.apache.cassandra.thrift.Column>> getRangeSlices(org.apache.cassandra.thrift.ColumnParent columnParent, org.apache.cassandra.thrift.SlicePredicate predicate, org.apache.cassandra.thrift.KeyRange keyRange)
          returns a subset of columns for a range of keys.
 List<org.apache.cassandra.thrift.Column> getSlice(ByteBuffer key, org.apache.cassandra.thrift.ColumnParent columnParent, org.apache.cassandra.thrift.SlicePredicate predicate)
          Get the group of columns contained by columnParent.
 org.apache.cassandra.thrift.SuperColumn getSuperColumn(ByteBuffer key, org.apache.cassandra.thrift.ColumnPath columnPath)
          Get the SuperColumn at the given columnPath.
 org.apache.cassandra.thrift.SuperColumn getSuperColumn(ByteBuffer key, org.apache.cassandra.thrift.ColumnPath columnPath, boolean reversed, int size)
          Get the SuperColumn at the given columnPath.
 Map<ByteBuffer,List<org.apache.cassandra.thrift.CounterSuperColumn>> getSuperRangeCounterSlices(org.apache.cassandra.thrift.ColumnParent columnParent, org.apache.cassandra.thrift.SlicePredicate predicate, org.apache.cassandra.thrift.KeyRange keyRange)
          returns a subset of counter super columns for a range of keys
 Map<ByteBuffer,List<org.apache.cassandra.thrift.SuperColumn>> getSuperRangeSlices(org.apache.cassandra.thrift.ColumnParent columnParent, org.apache.cassandra.thrift.SlicePredicate predicate, org.apache.cassandra.thrift.KeyRange keyRange)
          returns a subset of super columns for a range of keys.
 List<org.apache.cassandra.thrift.SuperColumn> getSuperSlice(ByteBuffer key, org.apache.cassandra.thrift.ColumnParent columnParent, org.apache.cassandra.thrift.SlicePredicate predicate)
          Get the group of superColumn contained by columnParent.
 void insert(ByteBuffer key, org.apache.cassandra.thrift.ColumnParent columnParent, org.apache.cassandra.thrift.Column column)
          Inserts a column.
 Map<ByteBuffer,Integer> multigetCount(List<ByteBuffer> keys, org.apache.cassandra.thrift.ColumnParent columnParent, org.apache.cassandra.thrift.SlicePredicate slicePredicate)
          Returns a map of key to column count
 Map<ByteBuffer,List<org.apache.cassandra.thrift.CounterColumn>> multigetCounterSlice(List<ByteBuffer> keys, org.apache.cassandra.thrift.ColumnParent columnParent, org.apache.cassandra.thrift.SlicePredicate predicate)
          Performs a get_slice for columnParent and predicate for the given keys in parallel.
 Map<ByteBuffer,List<org.apache.cassandra.thrift.CounterSuperColumn>> multigetCounterSuperSlice(List<ByteBuffer> keys, org.apache.cassandra.thrift.ColumnParent columnParent, org.apache.cassandra.thrift.SlicePredicate predicate)
          Performs a get_slice for a superColumn columnParent and predicate for the given keys in parallel.
 Map<ByteBuffer,List<org.apache.cassandra.thrift.Column>> multigetSlice(List<ByteBuffer> keys, org.apache.cassandra.thrift.ColumnParent columnParent, org.apache.cassandra.thrift.SlicePredicate predicate)
          Performs a get_slice for columnParent and predicate for the given keys in parallel.
 Map<ByteBuffer,List<org.apache.cassandra.thrift.SuperColumn>> multigetSuperSlice(List<ByteBuffer> keys, org.apache.cassandra.thrift.ColumnParent columnParent, org.apache.cassandra.thrift.SlicePredicate predicate)
          Performs a get_slice for a superColumn columnParent and predicate for the given keys in parallel.
 org.apache.cassandra.thrift.KeyRange prefixKeyRange(org.apache.cassandra.thrift.KeyRange unprefixed)
           
 void remove(ByteBuffer key, org.apache.cassandra.thrift.ColumnPath columnPath, long timestamp)
          Same as two argument version, but the caller must specify their own clock
 void removeCounter(ByteBuffer key, org.apache.cassandra.thrift.ColumnPath columnPath)
           
 org.apache.cassandra.thrift.KeyRange unprefixKeyRange(org.apache.cassandra.thrift.KeyRange prefixed)
           
 
Methods inherited from class me.prettyprint.cassandra.service.KeyspaceServiceImpl
addCounter, getCassandraHost, getColumn, getConsistencyLevel, getCounter, getCounterSlice, getCounterSuperSlice, getName, getSlice, getSuperColumn, getSuperSlice, insert, insert, multigetSuperColumn, multigetSuperColumn, remove, remove, remove, removeCounter, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VirtualKeyspaceServiceImpl

public VirtualKeyspaceServiceImpl(String keyspaceName,
                                  E keyPrefix,
                                  Serializer<E> keyPrefixSerializer,
                                  ConsistencyLevelPolicy consistencyLevel,
                                  HConnectionManager connectionManager,
                                  FailoverPolicy failoverPolicy)
                           throws HectorTransportException
Throws:
HectorTransportException

VirtualKeyspaceServiceImpl

public VirtualKeyspaceServiceImpl(String keyspaceName,
                                  E keyPrefix,
                                  Serializer<E> keyPrefixSerializer,
                                  ConsistencyLevelPolicy consistencyLevel,
                                  HConnectionManager connectionManager,
                                  FailoverPolicy failoverPolicy,
                                  Map<String,String> credentials)
                           throws HectorTransportException
Throws:
HectorTransportException
Method Detail

prefixKeyRange

public org.apache.cassandra.thrift.KeyRange prefixKeyRange(org.apache.cassandra.thrift.KeyRange unprefixed)

unprefixKeyRange

public org.apache.cassandra.thrift.KeyRange unprefixKeyRange(org.apache.cassandra.thrift.KeyRange prefixed)

batchMutate

public void batchMutate(Map<ByteBuffer,Map<String,List<org.apache.cassandra.thrift.Mutation>>> mutationMap)
                 throws HectorException
Description copied from interface: KeyspaceService
Call batch mutate with the assembled mutationMap. This method is a direct pass-through to the underlying Thrift API

Specified by:
batchMutate in interface KeyspaceService
Overrides:
batchMutate in class KeyspaceServiceImpl
Throws:
HectorException

batchMutate

public void batchMutate(BatchMutation batchMutate)
                 throws HectorException
Description copied from interface: KeyspaceService
Call batch mutate with the BatchMutation object which encapsulates some of the complexity of the batch_mutate API signature

Specified by:
batchMutate in interface KeyspaceService
Overrides:
batchMutate in class KeyspaceServiceImpl
Throws:
HectorException

getCount

public int getCount(ByteBuffer key,
                    org.apache.cassandra.thrift.ColumnParent columnParent,
                    org.apache.cassandra.thrift.SlicePredicate predicate)
             throws HectorException
Description copied from interface: KeyspaceService
Counts the columns present in columnParent.

Specified by:
getCount in interface KeyspaceService
Overrides:
getCount in class KeyspaceServiceImpl
Throws:
HectorException

getRangeSlices

public Map<ByteBuffer,List<org.apache.cassandra.thrift.Column>> getRangeSlices(org.apache.cassandra.thrift.ColumnParent columnParent,
                                                                               org.apache.cassandra.thrift.SlicePredicate predicate,
                                                                               org.apache.cassandra.thrift.KeyRange keyRange)
                                                                        throws HectorException
Description copied from interface: KeyspaceService
returns a subset of columns for a range of keys.

Specified by:
getRangeSlices in interface KeyspaceService
Overrides:
getRangeSlices in class KeyspaceServiceImpl
Throws:
HectorException

getRangeCounterSlices

public Map<ByteBuffer,List<org.apache.cassandra.thrift.CounterColumn>> getRangeCounterSlices(org.apache.cassandra.thrift.ColumnParent columnParent,
                                                                                             org.apache.cassandra.thrift.SlicePredicate predicate,
                                                                                             org.apache.cassandra.thrift.KeyRange keyRange)
                                                                                      throws HectorException
Description copied from interface: KeyspaceService
returns a subset of counter columns for a range of keys

Specified by:
getRangeCounterSlices in interface KeyspaceService
Overrides:
getRangeCounterSlices in class KeyspaceServiceImpl
Throws:
HectorException

getSuperRangeSlices

public Map<ByteBuffer,List<org.apache.cassandra.thrift.SuperColumn>> getSuperRangeSlices(org.apache.cassandra.thrift.ColumnParent columnParent,
                                                                                         org.apache.cassandra.thrift.SlicePredicate predicate,
                                                                                         org.apache.cassandra.thrift.KeyRange keyRange)
                                                                                  throws HectorException
Description copied from interface: KeyspaceService
returns a subset of super columns for a range of keys.

Specified by:
getSuperRangeSlices in interface KeyspaceService
Overrides:
getSuperRangeSlices in class KeyspaceServiceImpl
Throws:
HectorException

getSuperRangeCounterSlices

public Map<ByteBuffer,List<org.apache.cassandra.thrift.CounterSuperColumn>> getSuperRangeCounterSlices(org.apache.cassandra.thrift.ColumnParent columnParent,
                                                                                                       org.apache.cassandra.thrift.SlicePredicate predicate,
                                                                                                       org.apache.cassandra.thrift.KeyRange keyRange)
                                                                                                throws HectorException
Description copied from interface: KeyspaceService
returns a subset of counter super columns for a range of keys

Specified by:
getSuperRangeCounterSlices in interface KeyspaceService
Overrides:
getSuperRangeCounterSlices in class KeyspaceServiceImpl
Throws:
HectorException

getSlice

public List<org.apache.cassandra.thrift.Column> getSlice(ByteBuffer key,
                                                         org.apache.cassandra.thrift.ColumnParent columnParent,
                                                         org.apache.cassandra.thrift.SlicePredicate predicate)
                                                  throws HectorException
Description copied from interface: KeyspaceService
Get the group of columns contained by columnParent. Returns Either a ColumnFamily name or a ColumnFamily/SuperColumn specified by the given predicate. If no matching values are found, an empty list is returned.

Specified by:
getSlice in interface KeyspaceService
Overrides:
getSlice in class KeyspaceServiceImpl
Throws:
HectorException

getCounterSlice

public List<org.apache.cassandra.thrift.CounterColumn> getCounterSlice(ByteBuffer key,
                                                                       org.apache.cassandra.thrift.ColumnParent columnParent,
                                                                       org.apache.cassandra.thrift.SlicePredicate predicate)
                                                                throws HectorException
Description copied from interface: KeyspaceService
Get the group of counter columns contained by columnParent. Returns Either a ColumnFamily name or a ColumnFamily/SuperColumn specified by the given predicate. If no matching values are found, an empty list is returned.

Specified by:
getCounterSlice in interface KeyspaceService
Overrides:
getCounterSlice in class KeyspaceServiceImpl
Throws:
HectorException

getSuperColumn

public org.apache.cassandra.thrift.SuperColumn getSuperColumn(ByteBuffer key,
                                                              org.apache.cassandra.thrift.ColumnPath columnPath)
                                                       throws HectorException
Description copied from interface: KeyspaceService
Get the SuperColumn at the given columnPath. If no value is present, NotFoundException is thrown. by default will return column with native order and the size of the list is unlimited (so be careful...)

Specified by:
getSuperColumn in interface KeyspaceService
Overrides:
getSuperColumn in class KeyspaceServiceImpl
Throws:
HNotFoundException - when a supercolumn is not found
HectorException

getSuperColumn

public org.apache.cassandra.thrift.SuperColumn getSuperColumn(ByteBuffer key,
                                                              org.apache.cassandra.thrift.ColumnPath columnPath,
                                                              boolean reversed,
                                                              int size)
                                                       throws HectorException
Description copied from interface: KeyspaceService
Get the SuperColumn at the given columnPath. If no value is present, NotFoundException is thrown. by default will return column with native order and the size of the list is unlimited (so be careful...)

Specified by:
getSuperColumn in interface KeyspaceService
Overrides:
getSuperColumn in class KeyspaceServiceImpl
reversed - the result Column sort
size - the result column size
Throws:
HNotFoundException - when a supercolumn is not found
HectorException

getSuperSlice

public List<org.apache.cassandra.thrift.SuperColumn> getSuperSlice(ByteBuffer key,
                                                                   org.apache.cassandra.thrift.ColumnParent columnParent,
                                                                   org.apache.cassandra.thrift.SlicePredicate predicate)
                                                            throws HectorException
Description copied from interface: KeyspaceService
Get the group of superColumn contained by columnParent.

Specified by:
getSuperSlice in interface KeyspaceService
Overrides:
getSuperSlice in class KeyspaceServiceImpl
Throws:
HectorException

insert

public void insert(ByteBuffer key,
                   org.apache.cassandra.thrift.ColumnParent columnParent,
                   org.apache.cassandra.thrift.Column column)
            throws HectorException
Description copied from interface: KeyspaceService
Inserts a column.

Specified by:
insert in interface KeyspaceService
Overrides:
insert in class KeyspaceServiceImpl
Throws:
HectorException

multigetSlice

public Map<ByteBuffer,List<org.apache.cassandra.thrift.Column>> multigetSlice(List<ByteBuffer> keys,
                                                                              org.apache.cassandra.thrift.ColumnParent columnParent,
                                                                              org.apache.cassandra.thrift.SlicePredicate predicate)
                                                                       throws HectorException
Description copied from interface: KeyspaceService
Performs a get_slice for columnParent and predicate for the given keys in parallel.

Specified by:
multigetSlice in interface KeyspaceService
Overrides:
multigetSlice in class KeyspaceServiceImpl
Throws:
HectorException

multigetCounterSlice

public Map<ByteBuffer,List<org.apache.cassandra.thrift.CounterColumn>> multigetCounterSlice(List<ByteBuffer> keys,
                                                                                            org.apache.cassandra.thrift.ColumnParent columnParent,
                                                                                            org.apache.cassandra.thrift.SlicePredicate predicate)
                                                                                     throws HectorException
Description copied from interface: KeyspaceService
Performs a get_slice for columnParent and predicate for the given keys in parallel.

Specified by:
multigetCounterSlice in interface KeyspaceService
Overrides:
multigetCounterSlice in class KeyspaceServiceImpl
Throws:
HectorException

multigetSuperSlice

public Map<ByteBuffer,List<org.apache.cassandra.thrift.SuperColumn>> multigetSuperSlice(List<ByteBuffer> keys,
                                                                                        org.apache.cassandra.thrift.ColumnParent columnParent,
                                                                                        org.apache.cassandra.thrift.SlicePredicate predicate)
                                                                                 throws HectorException
Description copied from interface: KeyspaceService
Performs a get_slice for a superColumn columnParent and predicate for the given keys in parallel.

Specified by:
multigetSuperSlice in interface KeyspaceService
Overrides:
multigetSuperSlice in class KeyspaceServiceImpl
Throws:
HectorException

multigetCounterSuperSlice

public Map<ByteBuffer,List<org.apache.cassandra.thrift.CounterSuperColumn>> multigetCounterSuperSlice(List<ByteBuffer> keys,
                                                                                                      org.apache.cassandra.thrift.ColumnParent columnParent,
                                                                                                      org.apache.cassandra.thrift.SlicePredicate predicate)
                                                                                               throws HectorException
Description copied from interface: KeyspaceService
Performs a get_slice for a superColumn columnParent and predicate for the given keys in parallel.

Specified by:
multigetCounterSuperSlice in interface KeyspaceService
Overrides:
multigetCounterSuperSlice in class KeyspaceServiceImpl
Throws:
HectorException

getIndexedSlices

public Map<ByteBuffer,List<org.apache.cassandra.thrift.Column>> getIndexedSlices(org.apache.cassandra.thrift.ColumnParent columnParent,
                                                                                 org.apache.cassandra.thrift.IndexClause indexClause,
                                                                                 org.apache.cassandra.thrift.SlicePredicate predicate)
                                                                          throws HectorException
Description copied from interface: KeyspaceService
returns a subset of columns for a range of keys.

Specified by:
getIndexedSlices in interface KeyspaceService
Overrides:
getIndexedSlices in class KeyspaceServiceImpl
Throws:
HectorException

multigetCount

public Map<ByteBuffer,Integer> multigetCount(List<ByteBuffer> keys,
                                             org.apache.cassandra.thrift.ColumnParent columnParent,
                                             org.apache.cassandra.thrift.SlicePredicate slicePredicate)
                                      throws HectorException
Description copied from interface: KeyspaceService
Returns a map of key to column count

Specified by:
multigetCount in interface KeyspaceService
Overrides:
multigetCount in class KeyspaceServiceImpl
Throws:
HectorException

remove

public void remove(ByteBuffer key,
                   org.apache.cassandra.thrift.ColumnPath columnPath,
                   long timestamp)
            throws HectorException
Description copied from interface: KeyspaceService
Same as two argument version, but the caller must specify their own clock

Specified by:
remove in interface KeyspaceService
Overrides:
remove in class KeyspaceServiceImpl
Throws:
HectorException

getColumn

public org.apache.cassandra.thrift.Column getColumn(ByteBuffer key,
                                                    org.apache.cassandra.thrift.ColumnPath columnPath)
                                             throws HectorException
Description copied from interface: KeyspaceService
Get the Column at the given columnPath. If no value is present, NotFoundException is thrown.

Specified by:
getColumn in interface KeyspaceService
Overrides:
getColumn in class KeyspaceServiceImpl
Throws:
HNotFoundException - if no value exists for the column
HectorException

getCounter

public org.apache.cassandra.thrift.CounterColumn getCounter(ByteBuffer key,
                                                            org.apache.cassandra.thrift.ColumnPath columnPath)
                                                     throws HectorException
Description copied from interface: KeyspaceService
Get the Counter at the given columnPath. If no value is present, NotFoundException is thrown.

Specified by:
getCounter in interface KeyspaceService
Overrides:
getCounter in class KeyspaceServiceImpl
Throws:
HNotFoundException - if no value exists for the counter
HectorException

addCounter

public void addCounter(ByteBuffer key,
                       org.apache.cassandra.thrift.ColumnParent columnParent,
                       org.apache.cassandra.thrift.CounterColumn counterColumn)
                throws HectorException
Description copied from interface: KeyspaceService
Add a counter with CL.ONE

Specified by:
addCounter in interface KeyspaceService
Overrides:
addCounter in class KeyspaceServiceImpl
Throws:
HectorException

getCounterSuperSlice

public List<org.apache.cassandra.thrift.CounterSuperColumn> getCounterSuperSlice(ByteBuffer key,
                                                                                 org.apache.cassandra.thrift.ColumnParent columnParent,
                                                                                 org.apache.cassandra.thrift.SlicePredicate predicate)
                                                                          throws HectorException
Description copied from interface: KeyspaceService
Get the group of superColumn contained by columnParent.

Specified by:
getCounterSuperSlice in interface KeyspaceService
Overrides:
getCounterSuperSlice in class KeyspaceServiceImpl
Throws:
HectorException

removeCounter

public void removeCounter(ByteBuffer key,
                          org.apache.cassandra.thrift.ColumnPath columnPath)
                   throws HectorException
Specified by:
removeCounter in interface KeyspaceService
Overrides:
removeCounter in class KeyspaceServiceImpl
Throws:
HectorException


Copyright © 2011. All Rights Reserved.