public class CqlKeyspaceImpl
extends java.lang.Object
implements com.netflix.astyanax.Keyspace, com.netflix.astyanax.connectionpool.ConnectionPoolProxy.SeedHostListener
Keyspace that implements ddl operations as well as row queries and mutation batches.
The class encapsulates a java driver cluster and session object to provide all the functionality.
Note that due to the way the object is setup via AstyanaxContext and CqlFamilyFactory, it needs to implements
a ConnectionPoolProxy.SeedHostListener so that it can construct the cluster and session object appropriately once the seed hosts
have been provided by the HostSupplier object.| Modifier and Type | Class and Description |
|---|---|
class |
CqlKeyspaceImpl.KeyspaceContext |
| Modifier and Type | Field and Description |
|---|---|
com.datastax.driver.core.Cluster |
cluster |
com.datastax.driver.core.Session |
session |
| Constructor and Description |
|---|
CqlKeyspaceImpl(CqlKeyspaceImpl.KeyspaceContext ksContext) |
CqlKeyspaceImpl(java.lang.String ksName,
com.netflix.astyanax.AstyanaxConfiguration asConfig,
com.netflix.astyanax.KeyspaceTracerFactory tracerFactory,
com.netflix.astyanax.connectionpool.ConnectionPoolConfiguration cpConfig,
com.netflix.astyanax.connectionpool.ConnectionPoolMonitor cpMonitor) |
| Modifier and Type | Method and Description |
|---|---|
<K,C> com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> |
createColumnFamily(com.netflix.astyanax.model.ColumnFamily<K,C> columnFamily,
java.util.Map<java.lang.String,java.lang.Object> options) |
com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> |
createColumnFamily(java.util.Map<java.lang.String,java.lang.Object> options) |
com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> |
createColumnFamily(java.util.Properties props) |
com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> |
createKeyspace(java.util.Map<java.lang.String,java.lang.Object> options) |
com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> |
createKeyspace(java.util.Map<java.lang.String,java.lang.Object> options,
java.util.Map<com.netflix.astyanax.model.ColumnFamily,java.util.Map<java.lang.String,java.lang.Object>> cfs) |
com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> |
createKeyspace(java.util.Properties properties) |
com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> |
createKeyspaceIfNotExists(java.util.Map<java.lang.String,java.lang.Object> options) |
com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> |
createKeyspaceIfNotExists(java.util.Map<java.lang.String,java.lang.Object> options,
java.util.Map<com.netflix.astyanax.model.ColumnFamily,java.util.Map<java.lang.String,java.lang.Object>> cfs) |
com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> |
createKeyspaceIfNotExists(java.util.Properties properties) |
com.netflix.astyanax.ddl.KeyspaceDefinition |
describeKeyspace() |
java.lang.String |
describePartitioner() |
java.util.List<com.netflix.astyanax.connectionpool.TokenRange> |
describeRing() |
java.util.List<com.netflix.astyanax.connectionpool.TokenRange> |
describeRing(boolean cached) |
java.util.List<com.netflix.astyanax.connectionpool.TokenRange> |
describeRing(java.lang.String dc) |
java.util.List<com.netflix.astyanax.connectionpool.TokenRange> |
describeRing(java.lang.String dc,
java.lang.String rack) |
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
describeSchemaVersions() |
<K,C> com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> |
dropColumnFamily(com.netflix.astyanax.model.ColumnFamily<K,C> columnFamily) |
com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> |
dropColumnFamily(java.lang.String columnFamilyName) |
com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> |
dropKeyspace() |
java.util.Properties |
getColumnFamilyProperties(java.lang.String columnFamily) |
com.netflix.astyanax.AstyanaxConfiguration |
getConfig() |
com.netflix.astyanax.connectionpool.ConnectionPool<?> |
getConnectionPool() |
java.lang.String |
getKeyspaceName() |
java.util.Properties |
getKeyspaceProperties() |
com.netflix.astyanax.partitioner.Partitioner |
getPartitioner() |
com.netflix.astyanax.SerializerPackage |
getSerializerPackage(java.lang.String cfName,
boolean ignoreErrors) |
<K,C> com.netflix.astyanax.ColumnMutation |
prepareColumnMutation(com.netflix.astyanax.model.ColumnFamily<K,C> columnFamily,
K rowKey,
C column) |
com.netflix.astyanax.cql.CqlStatement |
prepareCqlStatement() |
com.netflix.astyanax.MutationBatch |
prepareMutationBatch() |
<K,C> com.netflix.astyanax.query.ColumnFamilyQuery<K,C> |
prepareQuery(com.netflix.astyanax.model.ColumnFamily<K,C> cf) |
void |
setHosts(java.util.Collection<com.netflix.astyanax.connectionpool.Host> hosts,
int port) |
void |
shutdown() |
com.netflix.astyanax.connectionpool.OperationResult<java.lang.Void> |
testOperation(com.netflix.astyanax.connectionpool.Operation<?,?> operation) |
com.netflix.astyanax.connectionpool.OperationResult<java.lang.Void> |
testOperation(com.netflix.astyanax.connectionpool.Operation<?,?> operation,
com.netflix.astyanax.retry.RetryPolicy retry) |
<K,C> com.netflix.astyanax.connectionpool.OperationResult<java.lang.Void> |
truncateColumnFamily(com.netflix.astyanax.model.ColumnFamily<K,C> columnFamily) |
com.netflix.astyanax.connectionpool.OperationResult<java.lang.Void> |
truncateColumnFamily(java.lang.String columnFamily) |
<K,C> com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> |
updateColumnFamily(com.netflix.astyanax.model.ColumnFamily<K,C> columnFamily,
java.util.Map<java.lang.String,java.lang.Object> options) |
com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> |
updateColumnFamily(java.util.Map<java.lang.String,java.lang.Object> options) |
com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> |
updateColumnFamily(java.util.Properties props) |
com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> |
updateKeyspace(java.util.Map<java.lang.String,java.lang.Object> options) |
com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> |
updateKeyspace(java.util.Properties props) |
public volatile com.datastax.driver.core.Cluster cluster
public volatile com.datastax.driver.core.Session session
public CqlKeyspaceImpl(java.lang.String ksName,
com.netflix.astyanax.AstyanaxConfiguration asConfig,
com.netflix.astyanax.KeyspaceTracerFactory tracerFactory,
com.netflix.astyanax.connectionpool.ConnectionPoolConfiguration cpConfig,
com.netflix.astyanax.connectionpool.ConnectionPoolMonitor cpMonitor)
public CqlKeyspaceImpl(CqlKeyspaceImpl.KeyspaceContext ksContext)
public com.netflix.astyanax.AstyanaxConfiguration getConfig()
getConfig in interface com.netflix.astyanax.Keyspacepublic java.lang.String getKeyspaceName()
getKeyspaceName in interface com.netflix.astyanax.Keyspacepublic com.netflix.astyanax.partitioner.Partitioner getPartitioner()
throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
getPartitioner in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic java.lang.String describePartitioner()
throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
describePartitioner in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic java.util.List<com.netflix.astyanax.connectionpool.TokenRange> describeRing()
throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
describeRing in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic java.util.List<com.netflix.astyanax.connectionpool.TokenRange> describeRing(java.lang.String dc)
throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
describeRing in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic java.util.List<com.netflix.astyanax.connectionpool.TokenRange> describeRing(java.lang.String dc,
java.lang.String rack)
throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
describeRing in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic java.util.List<com.netflix.astyanax.connectionpool.TokenRange> describeRing(boolean cached)
throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
describeRing in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic com.netflix.astyanax.ddl.KeyspaceDefinition describeKeyspace()
throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
describeKeyspace in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic java.util.Properties getKeyspaceProperties()
throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
getKeyspaceProperties in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic java.util.Properties getColumnFamilyProperties(java.lang.String columnFamily)
throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
getColumnFamilyProperties in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic com.netflix.astyanax.SerializerPackage getSerializerPackage(java.lang.String cfName,
boolean ignoreErrors)
throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException,
com.netflix.astyanax.serializers.UnknownComparatorException
getSerializerPackage in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptioncom.netflix.astyanax.serializers.UnknownComparatorExceptionpublic com.netflix.astyanax.MutationBatch prepareMutationBatch()
prepareMutationBatch in interface com.netflix.astyanax.Keyspacepublic <K,C> com.netflix.astyanax.ColumnMutation prepareColumnMutation(com.netflix.astyanax.model.ColumnFamily<K,C> columnFamily,
K rowKey,
C column)
prepareColumnMutation in interface com.netflix.astyanax.Keyspacepublic <K,C> com.netflix.astyanax.query.ColumnFamilyQuery<K,C> prepareQuery(com.netflix.astyanax.model.ColumnFamily<K,C> cf)
prepareQuery in interface com.netflix.astyanax.Keyspacepublic 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
createKeyspace in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> createKeyspace(java.util.Properties properties)
throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
createKeyspace in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> createKeyspace(java.util.Map<java.lang.String,java.lang.Object> options,
java.util.Map<com.netflix.astyanax.model.ColumnFamily,java.util.Map<java.lang.String,java.lang.Object>> cfs)
throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
createKeyspace in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic 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
updateKeyspace in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> updateKeyspace(java.util.Properties props)
throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
updateKeyspace in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> dropKeyspace()
throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
dropKeyspace in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic <K,C> com.netflix.astyanax.connectionpool.OperationResult<java.lang.Void> truncateColumnFamily(com.netflix.astyanax.model.ColumnFamily<K,C> columnFamily)
throws com.netflix.astyanax.connectionpool.exceptions.OperationException,
com.netflix.astyanax.connectionpool.exceptions.ConnectionException
truncateColumnFamily in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.OperationExceptioncom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic com.netflix.astyanax.connectionpool.OperationResult<java.lang.Void> truncateColumnFamily(java.lang.String columnFamily)
throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
truncateColumnFamily in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic <K,C> com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> createColumnFamily(com.netflix.astyanax.model.ColumnFamily<K,C> columnFamily,
java.util.Map<java.lang.String,java.lang.Object> options)
throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
createColumnFamily in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> createColumnFamily(java.util.Properties props)
throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
createColumnFamily in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic 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
createColumnFamily in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic <K,C> com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> updateColumnFamily(com.netflix.astyanax.model.ColumnFamily<K,C> columnFamily,
java.util.Map<java.lang.String,java.lang.Object> options)
throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
updateColumnFamily in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> updateColumnFamily(java.util.Properties props)
throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
updateColumnFamily in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic 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
updateColumnFamily in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> dropColumnFamily(java.lang.String columnFamilyName)
throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
dropColumnFamily in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic <K,C> com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> dropColumnFamily(com.netflix.astyanax.model.ColumnFamily<K,C> columnFamily)
throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
dropColumnFamily in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic java.util.Map<java.lang.String,java.util.List<java.lang.String>> describeSchemaVersions()
throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
describeSchemaVersions in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic com.netflix.astyanax.cql.CqlStatement prepareCqlStatement()
prepareCqlStatement in interface com.netflix.astyanax.Keyspacepublic com.netflix.astyanax.connectionpool.ConnectionPool<?> getConnectionPool()
throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
getConnectionPool in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic com.netflix.astyanax.connectionpool.OperationResult<java.lang.Void> testOperation(com.netflix.astyanax.connectionpool.Operation<?,?> operation)
throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
testOperation in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic com.netflix.astyanax.connectionpool.OperationResult<java.lang.Void> testOperation(com.netflix.astyanax.connectionpool.Operation<?,?> operation,
com.netflix.astyanax.retry.RetryPolicy retry)
throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
testOperation in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic void setHosts(java.util.Collection<com.netflix.astyanax.connectionpool.Host> hosts,
int port)
setHosts in interface com.netflix.astyanax.connectionpool.ConnectionPoolProxy.SeedHostListenerpublic void shutdown()
shutdown in interface com.netflix.astyanax.connectionpool.ConnectionPoolProxy.SeedHostListenerpublic com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> createKeyspaceIfNotExists(java.util.Map<java.lang.String,java.lang.Object> options)
throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
createKeyspaceIfNotExists in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> createKeyspaceIfNotExists(java.util.Properties properties)
throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
createKeyspaceIfNotExists in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionExceptionpublic com.netflix.astyanax.connectionpool.OperationResult<com.netflix.astyanax.ddl.SchemaChangeResult> createKeyspaceIfNotExists(java.util.Map<java.lang.String,java.lang.Object> options,
java.util.Map<com.netflix.astyanax.model.ColumnFamily,java.util.Map<java.lang.String,java.lang.Object>> cfs)
throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
createKeyspaceIfNotExists in interface com.netflix.astyanax.Keyspacecom.netflix.astyanax.connectionpool.exceptions.ConnectionException