|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectme.prettyprint.cassandra.service.AbstractCluster
public abstract class AbstractCluster
A cluster instance the client side representation of a cassandra server cluster.
The cluster is usually the main entry point for programs using hector. To start operating on
cassandra cluster you first get or create a cluster, then a keyspace operator for the keyspace
you're interested in and then create mutations of queries
//get a cluster:
Cluster cluster = getOrCreateCluster("MyCluster", new CassandraHostConfigurator("127.0.0.1:9170"));
//get a keyspace from this cluster:
Keyspace ko = createKeyspace("Keyspace1", cluster);
//Create a mutator:
Mutator m = createMutator(ko);
// Make a mutation:
MutationResult mr = m.insert("key", cf, createColumn("name", "value", serializer, serializer));
THREAD SAFETY: This class is thread safe.
| Field Summary | |
|---|---|
protected HConnectionManager |
connectionManager
|
static int |
RING_DELAY
Linked to Cassandra StorageProxy. |
static int |
WAIT_FOR_SCHEMA_AGREEMENT_SLEEP_TIME
|
protected ExceptionsTranslator |
xtrans
|
| Constructor Summary | |
|---|---|
AbstractCluster(String clusterName,
CassandraHostConfigurator cassandraHostConfigurator)
|
|
AbstractCluster(String clusterName,
CassandraHostConfigurator cassandraHostConfigurator,
Map<String,String> credentials)
|
|
| Method Summary | |
|---|---|
void |
addHost(CassandraHost cassandraHost,
boolean skipApplyConfig)
Adds the host to this Cluster. |
String |
describeClusterName()
|
KeyspaceDefinition |
describeKeyspace(String keyspace)
|
List<KeyspaceDefinition> |
describeKeyspaces()
|
String |
describePartitioner()
|
String |
describeThriftVersion()
|
String |
dropColumnFamily(String keyspaceName,
String columnFamily)
Drops a column family and does not wait for schema agreement. |
String |
dropColumnFamily(String keyspaceName,
String columnFamily,
boolean waitForSchemaAgreement)
Drops a column family and waits for schema cluster agreement if waitForSchemaAgreement
is set to true. |
String |
dropKeyspace(String keyspace)
Drops the Keyspace from the cluster. |
String |
dropKeyspace(String keyspace,
boolean waitForSchemaAgreement)
Drops a Keyspace and waits for schema cluster agreement if waitForSchemaAgreement
is set to true. |
String |
getClusterName()
|
CassandraHostConfigurator |
getConfigurator()
|
HConnectionManager |
getConnectionManager()
|
Map<String,String> |
getCredentials()
|
Set<CassandraHost> |
getKnownPoolHosts(boolean refresh)
|
String |
getName()
Descriptive name of the cluster. |
void |
onStartup()
called after the cluster has been initialized. |
void |
truncate(String keyspaceName,
String columnFamily)
|
protected static void |
waitForSchemaAgreement(org.apache.cassandra.thrift.Cassandra.Client cassandra)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface me.prettyprint.hector.api.Cluster |
|---|
addColumnFamily, addColumnFamily, addKeyspace, addKeyspace, describeRing, describeSchemaVersions, updateColumnFamily, updateColumnFamily, updateKeyspace, updateKeyspace |
| Field Detail |
|---|
public static final int RING_DELAY
public static final int WAIT_FOR_SCHEMA_AGREEMENT_SLEEP_TIME
protected final HConnectionManager connectionManager
protected final ExceptionsTranslator xtrans
| Constructor Detail |
|---|
public AbstractCluster(String clusterName,
CassandraHostConfigurator cassandraHostConfigurator)
public AbstractCluster(String clusterName,
CassandraHostConfigurator cassandraHostConfigurator,
Map<String,String> credentials)
| Method Detail |
|---|
public HConnectionManager getConnectionManager()
getConnectionManager in interface Clusterpublic Set<CassandraHost> getKnownPoolHosts(boolean refresh)
getKnownPoolHosts in interface Cluster
public void addHost(CassandraHost cassandraHost,
boolean skipApplyConfig)
Cluster
addHost in interface Clusterpublic String getName()
Cluster
getName in interface Cluster
public List<KeyspaceDefinition> describeKeyspaces()
throws HectorException
describeKeyspaces in interface ClusterHectorException
public String describeClusterName()
throws HectorException
describeClusterName in interface ClusterHectorException
public String describeThriftVersion()
throws HectorException
describeThriftVersion in interface ClusterHectorException
public KeyspaceDefinition describeKeyspace(String keyspace)
throws HectorException
describeKeyspace in interface ClusterHectorException
public String getClusterName()
throws HectorException
getClusterName in interface ClusterHectorException
public String dropKeyspace(String keyspace)
throws HectorException
Cluster
dropKeyspace in interface ClusterHectorException
public String dropKeyspace(String keyspace,
boolean waitForSchemaAgreement)
throws HectorException
ClusterwaitForSchemaAgreement
is set to true. Otherwise it behaves exactly like: Cluster.dropKeyspace(String)
dropKeyspace in interface ClusterHectorException
public String describePartitioner()
throws HectorException
describePartitioner in interface ClusterHectorException
public String dropColumnFamily(String keyspaceName,
String columnFamily)
throws HectorException
Cluster
dropColumnFamily in interface ClusterHectorException
public String dropColumnFamily(String keyspaceName,
String columnFamily,
boolean waitForSchemaAgreement)
throws HectorException
ClusterwaitForSchemaAgreement
is set to true. Otherwise it behaves exactly like: Cluster.dropColumnFamily(String, String)
dropColumnFamily in interface ClusterHectorExceptionpublic Map<String,String> getCredentials()
getCredentials in interface Cluster
public void truncate(String keyspaceName,
String columnFamily)
throws HectorException
truncate in interface ClusterHectorExceptionpublic void onStartup()
Cluster
onStartup in interface Clusterpublic CassandraHostConfigurator getConfigurator()
protected static void waitForSchemaAgreement(org.apache.cassandra.thrift.Cassandra.Client cassandra)
throws org.apache.cassandra.thrift.InvalidRequestException,
org.apache.thrift.TException,
InterruptedException
org.apache.cassandra.thrift.InvalidRequestException
org.apache.thrift.TException
InterruptedException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||