com.netflix.astyanax
Interface Keyspace

All Known Implementing Classes:
ThriftKeyspaceImpl

public interface Keyspace

Interface providing access to mutate and query columns from a cassandra keyspace.

Author:
elandau

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
 

Method Detail

getConfig

AstyanaxConfiguration getConfig()
Return the configuration object used to set up this keyspace

Returns:

getKeyspaceName

String getKeyspaceName()
Returns keyspace name

Returns:

describeRing

List<TokenRange> describeRing()
                              throws ConnectionException
Get a list of all tokens and their endpoints

Returns:
Throws:
ConnectionException

describeKeyspace

KeyspaceDefinition describeKeyspace()
                                    throws ConnectionException
Return a complete description of the keyspace and its column families

Returns:
Throws:
ConnectionException

getSerializerPackage

SerializerPackage getSerializerPackage(String cfName,
                                       boolean ignoreErrors)
                                       throws ConnectionException,
                                              UnknownComparatorException
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.

Parameters:
columnFamily -
ignoreErrors -
Returns:
Throws:
ConnectionException
UnknownComparatorException

prepareMutationBatch

MutationBatch prepareMutationBatch()
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.

Returns:
Throws:
ConnectionException

prepareQuery

<K,C> ColumnFamilyQuery<K,C> prepareQuery(ColumnFamily<K,C> cf)
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.

Type Parameters:
K -
C -
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

<K,C> ColumnMutation prepareColumnMutation(ColumnFamily<K,C> columnFamily,
                                           K rowKey,
                                           C column)
Mutation for a single column

Type Parameters:
K -
C -
Parameters:
columnFamily -
Returns:

truncateColumnFamily

<K,C> OperationResult<Void> truncateColumnFamily(ColumnFamily<K,C> columnFamily)
                                           throws OperationException,
                                                  ConnectionException
Delete all rows in a column family

Type Parameters:
K -
C -
Parameters:
columnFamily -
Returns:
Throws:
ConnectionException
OperationException

testOperation

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

Parameters:
operation -
Returns:
Throws:
ConnectionException

testOperation

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

Parameters:
operation -
Returns:
Throws:
ConnectionException


Copyright © 2012. All Rights Reserved.