com.netflix.astyanax
Interface Cluster


public interface Cluster

Interface for cluster operations. Use the Keyspace interface to perform keyspace query and mutation operations.


Method Summary
 com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> addColumnFamily(com.netflix.astyanax.ddl.ColumnFamilyDefinition def)
          Add a column family to an existing keyspace
 com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> addKeyspace(com.netflix.astyanax.ddl.KeyspaceDefinition def)
          Add a new keyspace to the cluster.
<K,C> com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult>
createColumnFamily(java.util.Map<java.lang.String,java.lang.Object> options)
          Create a column family in this keyspace
 com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> createKeyspace(java.util.Map<java.lang.String,java.lang.Object> options)
          Create the keyspace in cassandra.
 java.lang.String describeClusterName()
          The cluster name is completely arbitrary
 com.netflix.astyanax.ddl.KeyspaceDefinition describeKeyspace(java.lang.String ksName)
          Describe a single keyspace
 java.util.List<com.netflix.astyanax.ddl.KeyspaceDefinition> describeKeyspaces()
          Return details about all keyspaces in the cluster
 java.lang.String describePartitioner()
          Describe the partitioner used by the cluster
 java.util.Map<java.lang.String,java.util.List<java.lang.String>> describeSchemaVersions()
          For each schema version present in the cluster, returns a list of nodes at that version.
 java.lang.String describeSnitch()
          Describe the snitch name used on the cluster
 com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> dropColumnFamily(java.lang.String keyspaceName, java.lang.String columnFamilyName)
          Delete the column family from the keyspace
 com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> dropKeyspace(java.lang.String keyspaceName)
          Delete a keyspace from the cluster
 AstyanaxConfiguration getConfig()
          Configuration object for this Cluster
 Keyspace getKeyspace(java.lang.String keyspace)
          Return a keyspace client.
 java.lang.String getVersion()
          Return version of cassandra running on the cluster
 com.netflix.astyanax.ddl.ColumnDefinition makeColumnDefinition()
          Make a column definitio to be added to a ColumnFamilyDefinition
 com.netflix.astyanax.ddl.ColumnFamilyDefinition makeColumnFamilyDefinition()
          Prepare a column family definition.
 com.netflix.astyanax.ddl.KeyspaceDefinition makeKeyspaceDefinition()
          Prepare a keyspace definition.
 com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> updateColumnFamily(com.netflix.astyanax.ddl.ColumnFamilyDefinition def)
          Update an existing column family
<K,C> com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult>
updateColumnFamily(java.util.Map<java.lang.String,java.lang.Object> options)
          Update the column family in cassandra
 com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> updateKeyspace(com.netflix.astyanax.ddl.KeyspaceDefinition def)
          Update a new keyspace in the cluster.
 com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> updateKeyspace(java.util.Map<java.lang.String,java.lang.Object> options)
          Update the keyspace in cassandra.
 

Method Detail

describeClusterName

java.lang.String describeClusterName()
                                     throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
The cluster name is completely arbitrary

Throws:
com.netflix.astyanax.connectionpool.exceptions.ConnectionException

getVersion

java.lang.String getVersion()
                            throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
Return version of cassandra running on the cluster

Throws:
com.netflix.astyanax.connectionpool.exceptions.ConnectionException

describeSnitch

java.lang.String describeSnitch()
                                throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
Describe the snitch name used on the cluster

Throws:
com.netflix.astyanax.connectionpool.exceptions.ConnectionException

describePartitioner

java.lang.String describePartitioner()
                                     throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
Describe the partitioner used by the cluster

Throws:
com.netflix.astyanax.connectionpool.exceptions.ConnectionException

describeSchemaVersions

java.util.Map<java.lang.String,java.util.List<java.lang.String>> describeSchemaVersions()
                                                                                        throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
For each schema version present in the cluster, returns a list of nodes at that version. Hosts that do not respond will be under the key DatabaseDescriptor.INITIAL_VERSION. The cluster is all on the same version if the size of the map is 1

Throws:
com.netflix.astyanax.connectionpool.exceptions.ConnectionException

makeColumnFamilyDefinition

com.netflix.astyanax.ddl.ColumnFamilyDefinition makeColumnFamilyDefinition()
Prepare a column family definition. Call execute() on the returned object to create the column family.


makeColumnDefinition

com.netflix.astyanax.ddl.ColumnDefinition makeColumnDefinition()
Make a column definitio to be added to a ColumnFamilyDefinition


dropColumnFamily

com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> dropColumnFamily(java.lang.String keyspaceName,
                                                                                                                  java.lang.String columnFamilyName)
                                                                                                                  throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
Delete the column family from the keyspace

Parameters:
columnFamilyName - To delete
Throws:
com.netflix.astyanax.connectionpool.exceptions.OperationException
com.netflix.astyanax.connectionpool.exceptions.ConnectionException

addColumnFamily

com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> addColumnFamily(com.netflix.astyanax.ddl.ColumnFamilyDefinition def)
                                                                                                                 throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
Add a column family to an existing keyspace

Parameters:
def - - Created by calling makeColumnFamilyDefinition();
Throws:
com.netflix.astyanax.connectionpool.exceptions.ConnectionException

updateColumnFamily

com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> updateColumnFamily(com.netflix.astyanax.ddl.ColumnFamilyDefinition def)
                                                                                                                    throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
Update an existing column family

Parameters:
def - - Created by calling makeColumnFamilyDefinition();
Throws:
com.netflix.astyanax.connectionpool.exceptions.ConnectionException

makeKeyspaceDefinition

com.netflix.astyanax.ddl.KeyspaceDefinition makeKeyspaceDefinition()
Prepare a keyspace definition. Call execute() on the returned object to create the keyspace. Not that column families can be added the keyspace definition here instead of calling makeColumnFamilyDefinition separately.


describeKeyspaces

java.util.List<com.netflix.astyanax.ddl.KeyspaceDefinition> describeKeyspaces()
                                                                              throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
Return details about all keyspaces in the cluster

Throws:
com.netflix.astyanax.connectionpool.exceptions.ConnectionException

describeKeyspace

com.netflix.astyanax.ddl.KeyspaceDefinition describeKeyspace(java.lang.String ksName)
                                                             throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
Describe a single keyspace

Parameters:
ksName - - Keyspace name
Throws:
com.netflix.astyanax.connectionpool.exceptions.ConnectionException

getKeyspace

Keyspace getKeyspace(java.lang.String keyspace)
Return a keyspace client. Note that this keyspace will use the same connection pool as the cluster and any other keyspaces created from this cluster instance. As a result each keyspace operation is likely to have some overhead for switching keyspaces.


dropKeyspace

com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> dropKeyspace(java.lang.String keyspaceName)
                                                                                                              throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
Delete a keyspace from the cluster

Parameters:
keyspaceName - - Keyspace to drop
Throws:
com.netflix.astyanax.connectionpool.exceptions.OperationException
com.netflix.astyanax.connectionpool.exceptions.ConnectionException

addKeyspace

com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> addKeyspace(com.netflix.astyanax.ddl.KeyspaceDefinition def)
                                                                                                             throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
Add a new keyspace to the cluster. The keyspace object may include column families as well. Create a KeyspaceDefinition object by calling makeKeyspaceDefinition().

Parameters:
def -
Returns:
Throws:
com.netflix.astyanax.connectionpool.exceptions.ConnectionException

updateKeyspace

com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> updateKeyspace(com.netflix.astyanax.ddl.KeyspaceDefinition def)
                                                                                                                throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
Update a new keyspace in the cluster. The keyspace object may include column families as well. Create a KeyspaceDefinition object by calling makeKeyspaceDefinition().

Parameters:
def -
Throws:
com.netflix.astyanax.connectionpool.exceptions.ConnectionException

getConfig

AstyanaxConfiguration getConfig()
Configuration object for this Cluster


createColumnFamily

<K,C> com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> createColumnFamily(java.util.Map<java.lang.String,java.lang.Object> options)
                                                                                                                    throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
Create a column family in this keyspace

Parameters:
options - - For list of options see http://www.datastax.com/docs/1.0/configuration/storage_configuration
Throws:
com.netflix.astyanax.connectionpool.exceptions.ConnectionException

updateColumnFamily

<K,C> com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> updateColumnFamily(java.util.Map<java.lang.String,java.lang.Object> options)
                                                                                                                    throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
Update the column family in cassandra

Parameters:
options - - For list of options see http://www.datastax.com/docs/1.0/configuration/storage_configuration
Throws:
com.netflix.astyanax.connectionpool.exceptions.ConnectionException

createKeyspace

com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> createKeyspace(java.util.Map<java.lang.String,java.lang.Object> options)
                                                                                                                throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
Create the keyspace in cassandra. This call will only create the keyspace and not any column families. Once the keyspace has been created then call createColumnFamily for each CF you want to create.

Parameters:
options - - For list of options see http://www.datastax.com/docs/1.0/configuration/storage_configuration
Throws:
com.netflix.astyanax.connectionpool.exceptions.ConnectionException

updateKeyspace

com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> updateKeyspace(java.util.Map<java.lang.String,java.lang.Object> options)
                                                                                                                throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
Update the keyspace in cassandra.

Parameters:
options - - For list of options see http://www.datastax.com/docs/1.0/configuration/storage_configuration
Throws:
com.netflix.astyanax.connectionpool.exceptions.ConnectionException