com.netflix.astyanax.thrift
Class ThriftClusterImpl

java.lang.Object
  extended by com.netflix.astyanax.thrift.ThriftClusterImpl
All Implemented Interfaces:
Cluster

public class ThriftClusterImpl
extends Object
implements Cluster


Constructor Summary
ThriftClusterImpl(AstyanaxConfiguration config, ConnectionPool<org.apache.cassandra.thrift.Cassandra.Client> connectionPool, KeyspaceTracerFactory tracerFactory)
           
 
Method Summary
 String addColumnFamily(ColumnFamilyDefinition def)
          Add a column family to an existing keyspace
 String addKeyspace(KeyspaceDefinition def)
          Add a new keyspace to the cluster.
 String describeClusterName()
          The cluster name is completely arbitrary
 KeyspaceDefinition describeKeyspace(String ksName)
          Describe a single keyspace
 List<KeyspaceDefinition> describeKeyspaces()
          Return details about all keyspaces in the cluster
 String describePartitioner()
          Describe the partitioner used by the cluster
 Map<String,List<String>> describeSchemaVersions()
           
 String describeSnitch()
          Describe the snitch name used on the cluster
 String dropColumnFamily(String keyspaceName, String columnFamilyName)
          Delete the column family from the keyspace
 String dropKeyspace(String keyspaceName)
          Delete a keyspace from the cluster
 AstyanaxConfiguration getConfig()
          Configuration object for this Cluster
 Keyspace getKeyspace(String ksName)
          Return a keyspace client.
 String getVersion()
          Get the version from 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.
 String updateColumnFamily(ColumnFamilyDefinition def)
          Update an existing column family
 String updateKeyspace(KeyspaceDefinition def)
          Update a new keyspace in the cluster.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThriftClusterImpl

public ThriftClusterImpl(AstyanaxConfiguration config,
                         ConnectionPool<org.apache.cassandra.thrift.Cassandra.Client> connectionPool,
                         KeyspaceTracerFactory tracerFactory)
Method Detail

describeClusterName

public String describeClusterName()
                           throws ConnectionException
Description copied from interface: Cluster
The cluster name is completely arbitrary

Specified by:
describeClusterName in interface Cluster
Returns:
Throws:
ConnectionException

describeSnitch

public String describeSnitch()
                      throws ConnectionException
Description copied from interface: Cluster
Describe the snitch name used on the cluster

Specified by:
describeSnitch in interface Cluster
Returns:
Throws:
ConnectionException

describePartitioner

public String describePartitioner()
                           throws ConnectionException
Description copied from interface: Cluster
Describe the partitioner used by the cluster

Specified by:
describePartitioner in interface Cluster
Returns:
Throws:
ConnectionException

describeSchemaVersions

public Map<String,List<String>> describeSchemaVersions()
                                                throws ConnectionException
Specified by:
describeSchemaVersions in interface Cluster
Throws:
ConnectionException

getVersion

public String getVersion()
                  throws ConnectionException
Get the version from the cluster

Specified by:
getVersion in interface Cluster
Returns:
Throws:
OperationException
ConnectionException

dropColumnFamily

public String dropColumnFamily(String keyspaceName,
                               String columnFamilyName)
                        throws OperationException,
                               ConnectionException
Description copied from interface: Cluster
Delete the column family from the keyspace

Specified by:
dropColumnFamily in interface Cluster
Returns:
Throws:
OperationException
ConnectionException

dropKeyspace

public String dropKeyspace(String keyspaceName)
                    throws OperationException,
                           ConnectionException
Description copied from interface: Cluster
Delete a keyspace from the cluster

Specified by:
dropKeyspace in interface Cluster
Returns:
Throws:
OperationException
ConnectionException

describeKeyspaces

public List<KeyspaceDefinition> describeKeyspaces()
                                           throws ConnectionException
Description copied from interface: Cluster
Return details about all keyspaces in the cluster

Specified by:
describeKeyspaces in interface Cluster
Returns:
Throws:
ConnectionException

describeKeyspace

public KeyspaceDefinition describeKeyspace(String ksName)
                                    throws ConnectionException
Description copied from interface: Cluster
Describe a single keyspace

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

getKeyspace

public Keyspace getKeyspace(String ksName)
Description copied from interface: Cluster
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.

Specified by:
getKeyspace in interface Cluster
Returns:

makeColumnFamilyDefinition

public ColumnFamilyDefinition makeColumnFamilyDefinition()
Description copied from interface: Cluster
Prepare a column family definition. Call execute() on the returned object to create the column family.

Specified by:
makeColumnFamilyDefinition in interface Cluster
Returns:

addColumnFamily

public String addColumnFamily(ColumnFamilyDefinition def)
                       throws ConnectionException
Description copied from interface: Cluster
Add a column family to an existing keyspace

Specified by:
addColumnFamily in interface Cluster
Parameters:
def - - Created by calling prepareColumnFamilyDefinition();
Returns:
Throws:
ConnectionException

updateColumnFamily

public String updateColumnFamily(ColumnFamilyDefinition def)
                          throws ConnectionException
Description copied from interface: Cluster
Update an existing column family

Specified by:
updateColumnFamily in interface Cluster
Parameters:
def - - Created by calling prepareColumnFamilyDefinition();
Returns:
Throws:
ConnectionException

makeKeyspaceDefinition

public KeyspaceDefinition makeKeyspaceDefinition()
Description copied from interface: Cluster
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 prepareColumnFamilyDefinition separately.

Specified by:
makeKeyspaceDefinition in interface Cluster
Returns:

addKeyspace

public String addKeyspace(KeyspaceDefinition def)
                   throws ConnectionException
Description copied from interface: Cluster
Add a new keyspace to the cluster. The keyspace object may include column families as well. Create a KeyspaceDefinition object by calling prepareKeyspaceDefinition().

Specified by:
addKeyspace in interface Cluster
Returns:
Throws:
ConnectionException

updateKeyspace

public String updateKeyspace(KeyspaceDefinition def)
                      throws ConnectionException
Description copied from interface: Cluster
Update a new keyspace in the cluster. The keyspace object may include column families as well. Create a KeyspaceDefinition object by calling prepareKeyspaceDefinition().

Specified by:
updateKeyspace in interface Cluster
Throws:
ConnectionException

makeColumnDefinition

public ColumnDefinition makeColumnDefinition()
Description copied from interface: Cluster
Make a column definitio to be added to a ColumnFamilyDefinition

Specified by:
makeColumnDefinition in interface Cluster
Returns:

getConfig

public AstyanaxConfiguration getConfig()
Description copied from interface: Cluster
Configuration object for this Cluster

Specified by:
getConfig in interface Cluster
Returns:


Copyright © 2012. All Rights Reserved.