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<SchemaChangeResult> addColumnFamily(ColumnFamilyDefinition def)
          Add a column family to an existing keyspace
 com.netflix.astyanax.connectionpool.OperationResult<SchemaChangeResult> addKeyspace(KeyspaceDefinition def)
          Add a new keyspace to the cluster.
 com.netflix.astyanax.connectionpool.OperationResult<SchemaChangeResult> createColumnFamily(java.util.Map<java.lang.String,java.lang.Object> options)
          Create a column family.
 com.netflix.astyanax.connectionpool.OperationResult<SchemaChangeResult> createColumnFamily(java.util.Properties props)
          Create a column family.
 com.netflix.astyanax.connectionpool.OperationResult<SchemaChangeResult> createKeyspace(java.util.Map<java.lang.String,java.lang.Object> options)
          Create the keyspace in cassandra.
 com.netflix.astyanax.connectionpool.OperationResult<SchemaChangeResult> createKeyspace(java.util.Properties props)
          Create the keyspace in cassandra.
 java.lang.String describeClusterName()
          The cluster name is completely arbitrary
 KeyspaceDefinition describeKeyspace(java.lang.String ksName)
          Describe a single keyspace
 java.util.List<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<SchemaChangeResult> dropColumnFamily(java.lang.String keyspaceName, java.lang.String columnFamilyName)
          Delete the column family from the keyspace
 com.netflix.astyanax.connectionpool.OperationResult<SchemaChangeResult> dropKeyspace(java.lang.String keyspaceName)
          Delete a keyspace from the cluster
 java.util.Properties getAllKeyspaceProperties()
          Return all the keyspace definition as properties
 java.util.Properties getColumnFamilyProperties(java.lang.String keyspace, java.lang.String keyspaces)
          Return the
 AstyanaxConfiguration getConfig()
          Configuration object for this Cluster
 Keyspace getKeyspace(java.lang.String keyspace)
          Return a keyspace client.
 java.util.Properties getKeyspaceProperties(java.lang.String keyspace)
          Return the keyspace definition as a properties
 java.lang.String getVersion()
          Return version of cassandra running on the cluster
 ColumnDefinition makeColumnDefinition()
          Make a column definitio to be added to a ColumnFamilyDefinition
 ColumnFamilyDefinition makeColumnFamilyDefinition()
          Prepare a column family definition.
 KeyspaceDefinition makeKeyspaceDefinition()
          Prepare a keyspace definition.
 com.netflix.astyanax.connectionpool.OperationResult<SchemaChangeResult> updateColumnFamily(ColumnFamilyDefinition def)
          Update an existing column family
 com.netflix.astyanax.connectionpool.OperationResult<SchemaChangeResult> updateColumnFamily(java.util.Map<java.lang.String,java.lang.Object> options)
          Update the column family in cassandra
 com.netflix.astyanax.connectionpool.OperationResult<SchemaChangeResult> updateColumnFamily(java.util.Properties props)
          Update the column family in cassandra
 com.netflix.astyanax.connectionpool.OperationResult<SchemaChangeResult> updateKeyspace(KeyspaceDefinition def)
          Update a new keyspace in the cluster.
 com.netflix.astyanax.connectionpool.OperationResult<SchemaChangeResult> updateKeyspace(java.util.Map<java.lang.String,java.lang.Object> options)
          Update the keyspace in cassandra.
 com.netflix.astyanax.connectionpool.OperationResult<SchemaChangeResult> updateKeyspace(java.util.Properties props)
          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

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


makeColumnDefinition

ColumnDefinition makeColumnDefinition()
Make a column definitio to be added to a ColumnFamilyDefinition


dropColumnFamily

com.netflix.astyanax.connectionpool.OperationResult<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<SchemaChangeResult> addColumnFamily(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<SchemaChangeResult> updateColumnFamily(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

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.


getAllKeyspaceProperties

java.util.Properties getAllKeyspaceProperties()
                                              throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
Return all the keyspace definition as properties

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

getKeyspaceProperties

java.util.Properties getKeyspaceProperties(java.lang.String keyspace)
                                           throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
Return the keyspace definition as a properties

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

getColumnFamilyProperties

java.util.Properties getColumnFamilyProperties(java.lang.String keyspace,
                                               java.lang.String keyspaces)
                                               throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
Return the

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

describeKeyspaces

java.util.List<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

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)
                     throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
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.

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

dropKeyspace

com.netflix.astyanax.connectionpool.OperationResult<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<SchemaChangeResult> addKeyspace(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<SchemaChangeResult> updateKeyspace(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

com.netflix.astyanax.connectionpool.OperationResult<SchemaChangeResult> createColumnFamily(java.util.Map<java.lang.String,java.lang.Object> options)
                                                                                           throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
Create a column family. Definition must also specify the parent 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

createColumnFamily

com.netflix.astyanax.connectionpool.OperationResult<SchemaChangeResult> createColumnFamily(java.util.Properties props)
                                                                                           throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
Create a column family. Definition must also specify the parent 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

com.netflix.astyanax.connectionpool.OperationResult<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

updateColumnFamily

com.netflix.astyanax.connectionpool.OperationResult<SchemaChangeResult> updateColumnFamily(java.util.Properties props)
                                                                                           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<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

createKeyspace

com.netflix.astyanax.connectionpool.OperationResult<SchemaChangeResult> createKeyspace(java.util.Properties props)
                                                                                       throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
Create the keyspace in cassandra. This call will only create the keyspace and any child column families.

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<SchemaChangeResult> updateKeyspace(java.util.Map<java.lang.String,java.lang.Object> options)
                                                                                       throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
Update the keyspace in cassandra. Only the keyspace and no column family definitions will be updated here

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<SchemaChangeResult> updateKeyspace(java.util.Properties props)
                                                                                       throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
Update the keyspace in cassandra. Only the keyspace and no column family definitions will be updated here

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