com.netflix.astyanax.thrift
Class ThriftKeyspaceImpl

java.lang.Object
  extended by com.netflix.astyanax.thrift.ThriftKeyspaceImpl
All Implemented Interfaces:
Keyspace

public final class ThriftKeyspaceImpl
extends Object
implements Keyspace


Constructor Summary
ThriftKeyspaceImpl(String ksName, ConnectionPool<org.apache.cassandra.thrift.Cassandra.Client> pool, AstyanaxConfiguration config, KeyspaceTracerFactory tracerFactory)
           
 
Method Summary
 KeyspaceDefinition describeKeyspace()
          Return a complete description of the keyspace and its column families
 List<TokenRange> describeRing()
          Get a list of all tokens and their endpoints
 AstyanaxConfiguration getConfig()
          Return the configuration object used to set up this keyspace
 String getKeyspaceName()
          Returns keyspace name
 SerializerPackage getSerializerPackage(String cfName, boolean ignoreErrors)
          Return the serializer package for a specific column family.
<K,C> ColumnMutation
prepareColumnMutation(ColumnFamily<K,C> columnFamily, K rowKey, C column)
          Mutation for a single column
 MutationBatch prepareMutationBatch()
          Prepare a batch mutation object.
<K,C> ColumnFamilyQuery<K,C>
prepareQuery(ColumnFamily<K,C> cf)
          Starting point for constructing a query.
 OperationResult<Void> testOperation(Operation<?,?> operation)
          This method is used for testing purposes only.
 OperationResult<Void> testOperation(Operation<?,?> operation, RetryPolicy retry)
          This method is used for testing purposes only.
<K,C> OperationResult<Void>
truncateColumnFamily(ColumnFamily<K,C> columnFamily)
          Delete all rows in a column family
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThriftKeyspaceImpl

public ThriftKeyspaceImpl(String ksName,
                          ConnectionPool<org.apache.cassandra.thrift.Cassandra.Client> pool,
                          AstyanaxConfiguration config,
                          KeyspaceTracerFactory tracerFactory)
Method Detail

getKeyspaceName

public String getKeyspaceName()
Description copied from interface: Keyspace
Returns keyspace name

Specified by:
getKeyspaceName in interface Keyspace
Returns:

prepareMutationBatch

public MutationBatch prepareMutationBatch()
Description copied from interface: Keyspace
Prepare a batch mutation object. It is possible to create multiple batch mutations and later merge them into a single mutation by calling mergeShallow on a batch mutation object.

Specified by:
prepareMutationBatch in interface Keyspace
Returns:

describeRing

public List<TokenRange> describeRing()
                              throws ConnectionException
Description copied from interface: Keyspace
Get a list of all tokens and their endpoints

Specified by:
describeRing in interface Keyspace
Returns:
Throws:
ConnectionException

describeKeyspace

public KeyspaceDefinition describeKeyspace()
                                    throws ConnectionException
Description copied from interface: Keyspace
Return a complete description of the keyspace and its column families

Specified by:
describeKeyspace in interface Keyspace
Returns:
Throws:
ConnectionException

prepareQuery

public <K,C> ColumnFamilyQuery<K,C> prepareQuery(ColumnFamily<K,C> cf)
Description copied from interface: Keyspace
Starting point for constructing a query. From the column family the client can perform all 4 types of queries: get column, get key slice, get key range and and index query.

Specified by:
prepareQuery in interface Keyspace
Parameters:
cf - Column family to be used for the query. The key and column serializers in the ColumnFamily are automatically used while constructing the query and the response.
Returns:

prepareColumnMutation

public <K,C> ColumnMutation prepareColumnMutation(ColumnFamily<K,C> columnFamily,
                                                  K rowKey,
                                                  C column)
Description copied from interface: Keyspace
Mutation for a single column

Specified by:
prepareColumnMutation in interface Keyspace
Returns:

getConfig

public AstyanaxConfiguration getConfig()
Description copied from interface: Keyspace
Return the configuration object used to set up this keyspace

Specified by:
getConfig in interface Keyspace
Returns:

getSerializerPackage

public SerializerPackage getSerializerPackage(String cfName,
                                              boolean ignoreErrors)
                                       throws ConnectionException,
                                              UnknownComparatorException
Description copied from interface: Keyspace
Return the serializer package for a specific column family. This requires a call to the Cassandra cluster and is therefore cached to reduce load on Cassandra and since this data rarely changes.

Specified by:
getSerializerPackage in interface Keyspace
Returns:
Throws:
ConnectionException
UnknownComparatorException

testOperation

public OperationResult<Void> testOperation(Operation<?,?> operation)
                                    throws ConnectionException
Description copied from interface: Keyspace
This method is used for testing purposes only. It is used to inject errors in the connection pool.

Specified by:
testOperation in interface Keyspace
Returns:
Throws:
ConnectionException

testOperation

public OperationResult<Void> testOperation(Operation<?,?> operation,
                                           RetryPolicy retry)
                                    throws ConnectionException
Description copied from interface: Keyspace
This method is used for testing purposes only. It is used to inject errors in the connection pool.

Specified by:
testOperation in interface Keyspace
Returns:
Throws:
ConnectionException

truncateColumnFamily

public <K,C> OperationResult<Void> truncateColumnFamily(ColumnFamily<K,C> columnFamily)
                                           throws OperationException,
                                                  ConnectionException
Description copied from interface: Keyspace
Delete all rows in a column family

Specified by:
truncateColumnFamily in interface Keyspace
Returns:
Throws:
OperationException
ConnectionException


Copyright © 2012. All Rights Reserved.