|
GigaSpaces XAP 9.7.2 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openspaces.persistency.cassandra.HectorCassandraClient
public class HectorCassandraClient
A wrapper around the Cassandra Hector client library.
Constructor Summary | |
---|---|
HectorCassandraClient(CassandraHostConfigurator config,
String keyspaceName,
String clusterName,
Integer columnFamilyGcGraceSeconds,
CassandraConsistencyLevel readConsistencyLevel,
CassandraConsistencyLevel writeConsistencyLevel)
|
Method Summary | |
---|---|
void |
addIndexesToColumnFamily(String typeName,
List<String> columnNames,
SpaceDocumentColumnFamilyMapper mapper)
Adds a secondary index to the provided columns in the column family matching the provided typeName. |
void |
close()
Closes hector's connection pool. |
void |
createColumnFamilyIfNecessary(ColumnFamilyMetadata metadata,
boolean shouldPersist)
Creates a column family on the configured keyspace if one does not already exist. |
void |
createMetadataColumnFamilyColumnFamilyIfNecessary()
|
ColumnFamilyMetadata |
fetchColumnFamilyMetadata(String typeName,
SpaceDocumentColumnFamilyMapper mapper)
Tries to read from the internal metadata column family, the ColumnFamilyMetadata metadata
matching the given type name. |
Map<String,ColumnFamilyMetadata> |
getColumnFamiliesMetadata()
|
ColumnFamilyMetadata |
getColumnFamilyMetadata(String typeName)
Reads from cache the ColumnFamilyMetadata instance matching the provided typeName |
CassandraConsistencyLevel |
getReadConsistencyLevel()
|
CassandraConsistencyLevel |
getWriteConsistencyLevel()
|
void |
performBatchOperation(List<ColumnFamilyRow> rows)
Writes the given ColumnFamilyRow 's in a mutate operation to the configured keyspace. |
Map<String,ColumnFamilyMetadata> |
populateColumnFamiliesMetadata(SpaceDocumentColumnFamilyMapper mapper)
Reads all the column families metadata for the internal metadata column family into cache. |
SpaceDocument |
readDocmentByKey(SpaceDocumentColumnFamilyMapper mapper,
String typeName,
Object keyValue)
Reads the entry matching the typeName and key value from the matching column family. |
Map<Object,SpaceDocument> |
readDocumentsByKeys(SpaceDocumentColumnFamilyMapper mapper,
String typeName,
Object[] keyValues)
Reads the entries matching the typeName and key values from the matching column family. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HectorCassandraClient(CassandraHostConfigurator config, String keyspaceName, String clusterName, Integer columnFamilyGcGraceSeconds, CassandraConsistencyLevel readConsistencyLevel, CassandraConsistencyLevel writeConsistencyLevel)
HectorCassandraClientConfigurer.create()
Method Detail |
---|
public void close()
public void createMetadataColumnFamilyColumnFamilyIfNecessary()
public void performBatchOperation(List<ColumnFamilyRow> rows)
ColumnFamilyRow
's in a mutate operation to the configured keyspace.
rows
- The ColumnFamilyRow
's to perform the mutate operation on.
Contract: It is assumed that all the rows in the passed list argument belong to the same column family.
Failure to comply with contract will most likely lead to some data corruption.public void createColumnFamilyIfNecessary(ColumnFamilyMetadata metadata, boolean shouldPersist)
metadata
- The metadata describing the column family to create.shouldPersist
- Should the ColumnFamilyMetadata
instance be persisted to the internal
metadata column family.public void addIndexesToColumnFamily(String typeName, List<String> columnNames, SpaceDocumentColumnFamilyMapper mapper)
typeName
- The type name describing the matchin column family.columnNames
- the columns to which secondary indexes should be added.mapper
- public ColumnFamilyMetadata fetchColumnFamilyMetadata(String typeName, SpaceDocumentColumnFamilyMapper mapper)
ColumnFamilyMetadata
metadata
matching the given type name.
If found, this metadata is stored in cache and can later be aquired by calling
getColumnFamilyMetadata(String)
typeName
- The typeName describing the matching column family.mapper
-
ColumnFamilyMetadata
instance if found, null otherwise.public Map<String,ColumnFamilyMetadata> populateColumnFamiliesMetadata(SpaceDocumentColumnFamilyMapper mapper)
mapper
-
Map
from type name to its matching ColumnFamilyMetadata
.
Of all the currently known column families.public SpaceDocument readDocmentByKey(SpaceDocumentColumnFamilyMapper mapper, String typeName, Object keyValue)
mapper
- typeName
- The typeName describing the matching column family.keyValue
- The key of the requested entry.
public Map<Object,SpaceDocument> readDocumentsByKeys(SpaceDocumentColumnFamilyMapper mapper, String typeName, Object[] keyValues)
mapper
- typeName
- The typeName describing the matching column family.keyValues
- The keys of the requested entry.
public ColumnFamilyMetadata getColumnFamilyMetadata(String typeName)
ColumnFamilyMetadata
instance matching the provided typeName
typeName
- The typeName describing the matching column family.
ColumnFamilyMetadata
instance if found, null otherwise.public Map<String,ColumnFamilyMetadata> getColumnFamiliesMetadata()
public CassandraConsistencyLevel getReadConsistencyLevel()
public CassandraConsistencyLevel getWriteConsistencyLevel()
|
GigaSpaces XAP 9.7.2 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |