|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object me.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
|
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 blockUntilComplete)
Drops a column family and wait for schema cluster agreement if blockUntilComplete
is set to true. |
String |
dropKeyspace(String keyspace)
Drops the Keyspace from the cluster. |
String |
dropKeyspace(String keyspace,
boolean blockUntilComplete)
Drops a Keyspace and wait for schema cluster agreement if blockUntilComplete
is set to true. |
String |
getClusterName()
|
HConnectionManager |
getConnectionManager()
|
Map<String,String> |
getCredentials()
|
Set<CassandraHost> |
getKnownPoolHosts(boolean refresh)
|
String |
getName()
Descriptive name of the cluster. |
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 |
---|
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 Cluster
public Set<CassandraHost> getKnownPoolHosts(boolean refresh)
getKnownPoolHosts
in interface Cluster
public void addHost(CassandraHost cassandraHost, boolean skipApplyConfig)
Cluster
addHost
in interface Cluster
public String getName()
Cluster
getName
in interface Cluster
public List<KeyspaceDefinition> describeKeyspaces() throws HectorException
describeKeyspaces
in interface Cluster
HectorException
public String describeClusterName() throws HectorException
describeClusterName
in interface Cluster
HectorException
public String describeThriftVersion() throws HectorException
describeThriftVersion
in interface Cluster
HectorException
public KeyspaceDefinition describeKeyspace(String keyspace) throws HectorException
describeKeyspace
in interface Cluster
HectorException
public String getClusterName() throws HectorException
getClusterName
in interface Cluster
HectorException
public String dropKeyspace(String keyspace) throws HectorException
Cluster
dropKeyspace
in interface Cluster
HectorException
public String dropKeyspace(String keyspace, boolean blockUntilComplete) throws HectorException
Cluster
blockUntilComplete
is set to true. Otherwise it behaves exactly like: Cluster.dropKeyspace(String)
dropKeyspace
in interface Cluster
HectorException
public String describePartitioner() throws HectorException
describePartitioner
in interface Cluster
HectorException
public String dropColumnFamily(String keyspaceName, String columnFamily) throws HectorException
Cluster
dropColumnFamily
in interface Cluster
HectorException
public String dropColumnFamily(String keyspaceName, String columnFamily, boolean blockUntilComplete) throws HectorException
Cluster
blockUntilComplete
is set to true. Otherwise it behaves exactly like: Cluster.dropColumnFamily(String, String)
dropColumnFamily
in interface Cluster
HectorException
public Map<String,String> getCredentials()
getCredentials
in interface Cluster
public void truncate(String keyspaceName, String columnFamily) throws HectorException
truncate
in interface Cluster
HectorException
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 |