me.prettyprint.cassandra.service
Interface KeyspaceService

All Known Implementing Classes:
KeyspaceServiceImpl, VirtualKeyspaceServiceImpl

public interface KeyspaceService

The keyspace is a high level handle to all read/write operations to cassandra. A Keyspace object is NOT THREAD SAFE. Use one keyspace per thread please!

Author:
rantav

Field Summary
static String CF_TYPE
           
static String CF_TYPE_STANDARD
           
static String CF_TYPE_SUPER
           
 
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 addCounter(String key, org.apache.cassandra.thrift.ColumnParent columnParent, org.apache.cassandra.thrift.CounterColumn counterColumn)
          Add a counter with CL.ONE
 void batchMutate(BatchMutation batchMutation)
          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.
 CassandraHost getCassandraHost()
           
 org.apache.cassandra.thrift.Column getColumn(ByteBuffer key, org.apache.cassandra.thrift.ColumnPath columnPath)
          Get the Column at the given columnPath.
 org.apache.cassandra.thrift.Column getColumn(String key, org.apache.cassandra.thrift.ColumnPath columnPath)
           
 HConsistencyLevel getConsistencyLevel(OperationType operationType)
           
 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.
 org.apache.cassandra.thrift.CounterColumn getCounter(String key, org.apache.cassandra.thrift.ColumnPath 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.CounterColumn> getCounterSlice(String key, org.apache.cassandra.thrift.ColumnParent columnParent, org.apache.cassandra.thrift.SlicePredicate predicate)
           
 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.
 List<org.apache.cassandra.thrift.CounterSuperColumn> getCounterSuperSlice(String key, org.apache.cassandra.thrift.ColumnParent columnParent, org.apache.cassandra.thrift.SlicePredicate predicate)
           
 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.
 String getName()
           
 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.
 List<org.apache.cassandra.thrift.Column> getSlice(String key, org.apache.cassandra.thrift.ColumnParent columnParent, org.apache.cassandra.thrift.SlicePredicate predicate)
           
 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.
 org.apache.cassandra.thrift.SuperColumn getSuperColumn(String key, org.apache.cassandra.thrift.ColumnPath 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.
 List<org.apache.cassandra.thrift.SuperColumn> getSuperSlice(String key, org.apache.cassandra.thrift.ColumnParent columnParent, org.apache.cassandra.thrift.SlicePredicate predicate)
           
 void insert(ByteBuffer key, org.apache.cassandra.thrift.ColumnParent columnParent, org.apache.cassandra.thrift.Column column)
          Inserts a column.
 void insert(String key, org.apache.cassandra.thrift.ColumnPath columnPath, ByteBuffer value)
           
 void insert(String key, org.apache.cassandra.thrift.ColumnPath columnPath, ByteBuffer value, long timestamp)
           
 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,org.apache.cassandra.thrift.SuperColumn> multigetSuperColumn(List<ByteBuffer> keys, org.apache.cassandra.thrift.ColumnPath columnPath)
          Performs a get for columnPath in parallel on the given list of keys.
 Map<ByteBuffer,org.apache.cassandra.thrift.SuperColumn> multigetSuperColumn(List<ByteBuffer> keys, org.apache.cassandra.thrift.ColumnPath columnPath, boolean reversed, int size)
          Perform a get for columnPath in parallel on the given list of keys.
 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.
 void remove(ByteBuffer key, org.apache.cassandra.thrift.ColumnPath columnPath)
           
 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 remove(String key, org.apache.cassandra.thrift.ColumnPath columnPath)
           
 void remove(String key, org.apache.cassandra.thrift.ColumnPath columnPath, long timestamp)
           
 void removeCounter(ByteBuffer key, org.apache.cassandra.thrift.ColumnPath columnPath)
           
 void removeCounter(String key, org.apache.cassandra.thrift.ColumnPath columnPath)
           
 

Field Detail

CF_TYPE

static final String CF_TYPE
See Also:
Constant Field Values

CF_TYPE_STANDARD

static final String CF_TYPE_STANDARD
See Also:
Constant Field Values

CF_TYPE_SUPER

static final String CF_TYPE_SUPER
See Also:
Constant Field Values
Method Detail

getColumn

org.apache.cassandra.thrift.Column getColumn(ByteBuffer key,
                                             org.apache.cassandra.thrift.ColumnPath columnPath)
                                             throws HectorException
Get the Column at the given columnPath. If no value is present, NotFoundException is thrown.

Throws:
HNotFoundException - if no value exists for the column
HectorException

getColumn

org.apache.cassandra.thrift.Column getColumn(String key,
                                             org.apache.cassandra.thrift.ColumnPath columnPath)
                                             throws HectorException
Throws:
HectorException

getCounter

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

Throws:
HNotFoundException - if no value exists for the counter
HectorException

getCounter

org.apache.cassandra.thrift.CounterColumn getCounter(String key,
                                                     org.apache.cassandra.thrift.ColumnPath columnPath)
                                                     throws HectorException
Throws:
HectorException

getSuperColumn

org.apache.cassandra.thrift.SuperColumn getSuperColumn(ByteBuffer key,
                                                       org.apache.cassandra.thrift.ColumnPath columnPath)
                                                       throws HectorException
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...)

Throws:
HNotFoundException - when a supercolumn is not found
HectorException

getSuperColumn

org.apache.cassandra.thrift.SuperColumn getSuperColumn(String key,
                                                       org.apache.cassandra.thrift.ColumnPath columnPath)
                                                       throws HectorException
Throws:
HectorException

getSuperColumn

org.apache.cassandra.thrift.SuperColumn getSuperColumn(ByteBuffer key,
                                                       org.apache.cassandra.thrift.ColumnPath columnPath,
                                                       boolean reversed,
                                                       int size)
                                                       throws HectorException
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...)

Parameters:
reversed - the result Column sort
size - the result column size
Throws:
HNotFoundException - when a supercolumn is not found
HectorException

getSlice

List<org.apache.cassandra.thrift.Column> getSlice(ByteBuffer key,
                                                  org.apache.cassandra.thrift.ColumnParent columnParent,
                                                  org.apache.cassandra.thrift.SlicePredicate predicate)
                                                  throws HectorException
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.

Throws:
HectorException

getSlice

List<org.apache.cassandra.thrift.Column> getSlice(String key,
                                                  org.apache.cassandra.thrift.ColumnParent columnParent,
                                                  org.apache.cassandra.thrift.SlicePredicate predicate)
                                                  throws HectorException
Throws:
HectorException

getCounterSlice

List<org.apache.cassandra.thrift.CounterColumn> getCounterSlice(ByteBuffer key,
                                                                org.apache.cassandra.thrift.ColumnParent columnParent,
                                                                org.apache.cassandra.thrift.SlicePredicate predicate)
                                                                throws HectorException
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.

Throws:
HectorException

getCounterSlice

List<org.apache.cassandra.thrift.CounterColumn> getCounterSlice(String key,
                                                                org.apache.cassandra.thrift.ColumnParent columnParent,
                                                                org.apache.cassandra.thrift.SlicePredicate predicate)
                                                                throws HectorException
Throws:
HectorException

getSuperSlice

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

Throws:
HectorException

getSuperSlice

List<org.apache.cassandra.thrift.SuperColumn> getSuperSlice(String key,
                                                            org.apache.cassandra.thrift.ColumnParent columnParent,
                                                            org.apache.cassandra.thrift.SlicePredicate predicate)
                                                            throws HectorException
Throws:
HectorException

getCounterSuperSlice

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

Throws:
HectorException

getCounterSuperSlice

List<org.apache.cassandra.thrift.CounterSuperColumn> getCounterSuperSlice(String key,
                                                                          org.apache.cassandra.thrift.ColumnParent columnParent,
                                                                          org.apache.cassandra.thrift.SlicePredicate predicate)
                                                                          throws HectorException
Throws:
HectorException

multigetSuperColumn

Map<ByteBuffer,org.apache.cassandra.thrift.SuperColumn> multigetSuperColumn(List<ByteBuffer> keys,
                                                                            org.apache.cassandra.thrift.ColumnPath columnPath)
                                                                            throws HectorException
Performs a get for columnPath in parallel on the given list of keys. The return value maps keys to the ColumnOrSuperColumn found. If no value corresponding to a key is present, the key will still be in the map, but both the column and superColumn references of the ColumnOrSuperColumn object it maps to will be null.

Throws:
HectorException

multigetSuperColumn

Map<ByteBuffer,org.apache.cassandra.thrift.SuperColumn> multigetSuperColumn(List<ByteBuffer> keys,
                                                                            org.apache.cassandra.thrift.ColumnPath columnPath,
                                                                            boolean reversed,
                                                                            int size)
                                                                            throws HectorException
Perform a get for columnPath in parallel on the given list of keys. The return value maps keys to the ColumnOrSuperColumn found. If no value corresponding to a key is present, the key will still be in the map, but both the column and superColumn references of the ColumnOrSuperColumn object it maps to will be null.

Throws:
HectorException

multigetSlice

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
Performs a get_slice for columnParent and predicate for the given keys in parallel.

Throws:
HectorException

multigetCounterSlice

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
Performs a get_slice for columnParent and predicate for the given keys in parallel.

Throws:
HectorException

multigetSuperSlice

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
Performs a get_slice for a superColumn columnParent and predicate for the given keys in parallel.

Throws:
HectorException

multigetCounterSuperSlice

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
Performs a get_slice for a superColumn columnParent and predicate for the given keys in parallel.

Throws:
HectorException

insert

void insert(ByteBuffer key,
            org.apache.cassandra.thrift.ColumnParent columnParent,
            org.apache.cassandra.thrift.Column column)
            throws HectorException
Inserts a column.

Throws:
HectorException

insert

void insert(String key,
            org.apache.cassandra.thrift.ColumnPath columnPath,
            ByteBuffer value)
            throws HectorException
Throws:
HectorException

insert

void insert(String key,
            org.apache.cassandra.thrift.ColumnPath columnPath,
            ByteBuffer value,
            long timestamp)
            throws HectorException
Throws:
HectorException

addCounter

void addCounter(ByteBuffer key,
                org.apache.cassandra.thrift.ColumnParent columnParent,
                org.apache.cassandra.thrift.CounterColumn counterColumn)
                throws HectorException
Add a counter with CL.ONE

Throws:
HectorException

addCounter

void addCounter(String key,
                org.apache.cassandra.thrift.ColumnParent columnParent,
                org.apache.cassandra.thrift.CounterColumn counterColumn)
                throws HectorException
Add a counter with CL.ONE

Throws:
HectorException

batchMutate

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

Throws:
HectorException

batchMutate

void batchMutate(BatchMutation batchMutation)
                 throws HectorException
Call batch mutate with the BatchMutation object which encapsulates some of the complexity of the batch_mutate API signature

Throws:
HectorException

remove

void remove(ByteBuffer key,
            org.apache.cassandra.thrift.ColumnPath columnPath)

remove

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

Throws:
HectorException

remove

void remove(String key,
            org.apache.cassandra.thrift.ColumnPath columnPath)
            throws HectorException
Throws:
HectorException

remove

void remove(String key,
            org.apache.cassandra.thrift.ColumnPath columnPath,
            long timestamp)
            throws HectorException
Throws:
HectorException

removeCounter

void removeCounter(ByteBuffer key,
                   org.apache.cassandra.thrift.ColumnPath columnPath)
                   throws HectorException
Throws:
HectorException

removeCounter

void removeCounter(String key,
                   org.apache.cassandra.thrift.ColumnPath columnPath)
                   throws HectorException
Throws:
HectorException

getCount

int getCount(ByteBuffer key,
             org.apache.cassandra.thrift.ColumnParent columnParent,
             org.apache.cassandra.thrift.SlicePredicate predicate)
             throws HectorException
Counts the columns present in columnParent.

Throws:
HectorException

getRangeSlices

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
returns a subset of columns for a range of keys.

Throws:
HectorException

getRangeCounterSlices

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
returns a subset of counter columns for a range of keys

Throws:
HectorException

getSuperRangeSlices

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
returns a subset of super columns for a range of keys.

Throws:
HectorException

getSuperRangeCounterSlices

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


getIndexedSlices

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
returns a subset of columns for a range of keys.

Throws:
HectorException

multigetCount

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

Throws:
HectorException

getConsistencyLevel

HConsistencyLevel getConsistencyLevel(OperationType operationType)
Returns:
The consistency level held by this keyspace instance.

getName

String getName()

getCassandraHost

CassandraHost getCassandraHost()


Copyright © 2011. All Rights Reserved.