public class EntityManager extends Object
EntityManager
is the persistence module that is responsible for
all interactions with Cassandra database. It interfaces with the Dao
at one end and with Astyanax Client for Cassandra at the other end.
The basic responsibility of EntityManager is to support CRUD operations. The other responsibilities include creation of Column Families, supporting Astyanax operations and so on.
Modifier | Constructor and Description |
---|---|
|
EntityManager(ConnectionManager connManager)
Constructor.
|
protected |
EntityManager(com.netflix.astyanax.Keyspace keyspace) |
Modifier and Type | Method and Description |
---|---|
<K extends Serializable,C extends Serializable & Comparable<C>> |
countColumns(com.netflix.astyanax.model.ColumnFamily<K,C> colFamily,
K rowKey)
countColumns(com.netflix.astyanax.model.ColumnFamily<K, C>, K) counts the number of columns in a
given row of a given column family. |
<K extends Serializable,C> |
countRows(com.netflix.astyanax.model.ColumnFamily<K,C> colFamily)
countRows(ColumnFamily) retrieves a count
of all rows in a given column family |
static void |
createColumnFamily(ColumnFamilyDefinition<?,?> cf)
createColumnFamily(com.hp.util.persistence.cassandra.entitymgr.ColumnFamilyDefinition<?, ?>) creates a new Cassandra
Column Family.This method is a single way to create a Cassandra
Column Family in the DAO framework. |
<K extends Serializable,C extends Serializable & Comparable<C>> |
delete(com.netflix.astyanax.model.ColumnFamily<K,C> columnFamily,
K rowKey,
ColumnName<C,?> columnName)
Deletes a single column.
|
<K extends Serializable,C extends Serializable & Comparable<C>> |
deleteColumns(com.netflix.astyanax.model.ColumnFamily<K,C> columnFamily,
K rowKey,
Collection<ColumnName<C,?>> columnsNames)
Deletes a collection of columns.
|
static void |
dropColumnFamily(com.netflix.astyanax.model.ColumnFamily<?,?> cf)
Drops a column family.
|
void |
executeOperation()
executeOperation() executes a Write Operation. |
<I extends Serializable,K extends Serializable & Comparable<K>> |
get(com.netflix.astyanax.model.ColumnFamily<I,K> cf,
Provider<ColumnDecoder<K,?>,ColumnName<K,?>> decoderProvider,
I id)
|
<K extends Serializable,C extends Serializable & Comparable<C>> |
get(com.netflix.astyanax.model.ColumnFamily<K,C> colFamily,
Collection<K> rows,
Collection<ColumnName<C,?>> columns,
Provider<ColumnDecoder<C,?>,ColumnName<C,?>> decoder)
get(com.netflix.astyanax.model.ColumnFamily<I, K>, com.hp.util.Provider<com.hp.util.persistence.cassandra.entitymgr.column.ColumnDecoder<K, ?>, com.hp.util.persistence.cassandra.entitymgr.column.ColumnName<K, ?>>, I) retrieves a collection of rows with specified
columns. |
<K extends Serializable,C extends Serializable & Comparable<C>> |
get(com.netflix.astyanax.model.ColumnFamily<K,C> colFamily,
Collection<K> rowKeys,
ColumnName<C,?> startColumn,
ColumnName<C,?> endColumn,
boolean reversed,
int limit,
Provider<ColumnDecoder<C,?>,ColumnName<C,?>> decoder)
get(com.netflix.astyanax.model.ColumnFamily<I, K>, com.hp.util.Provider<com.hp.util.persistence.cassandra.entitymgr.column.ColumnDecoder<K, ?>, com.hp.util.persistence.cassandra.entitymgr.column.ColumnName<K, ?>>, I) retrieves a collection of specified rows
and a specified range of columns in each row. |
<K extends Serializable,C extends Serializable & Comparable<C>> |
get(com.netflix.astyanax.model.ColumnFamily<K,C> colFamily,
Collection<K> rowKeys,
Provider<ColumnDecoder<C,?>,ColumnName<C,?>> decoderProvider)
get(com.netflix.astyanax.model.ColumnFamily<I, K>, com.hp.util.Provider<com.hp.util.persistence.cassandra.entitymgr.column.ColumnDecoder<K, ?>, com.hp.util.persistence.cassandra.entitymgr.column.ColumnName<K, ?>>, I) retrieves Cassandra multiple rows from a
column family. |
<K extends Serializable,C extends Serializable & Comparable<C>> |
get(com.netflix.astyanax.model.ColumnFamily<K,C> cf,
ColumnName<C,?> column,
boolean key,
Provider<ColumnDecoder<C,?>,ColumnName<C,?>> decoder)
|
<K extends Serializable,C extends Serializable & Comparable<C>> |
get(com.netflix.astyanax.model.ColumnFamily<K,C> cf,
ColumnName<C,?> column,
int key,
Provider<ColumnDecoder<C,?>,ColumnName<C,?>> decoder)
|
<K extends Serializable,C extends Serializable & Comparable<C>> |
get(com.netflix.astyanax.model.ColumnFamily<K,C> cf,
ColumnName<C,?> column,
String key,
Provider<ColumnDecoder<C,?>,ColumnName<C,?>> decoder)
|
<K extends Serializable,C extends Serializable & Comparable<C>> |
get(com.netflix.astyanax.model.ColumnFamily<K,C> colFamily,
K rowKey,
ByteBuffer startColumn,
ByteBuffer endColumn,
boolean reversed,
int limit,
Provider<ColumnDecoder<C,?>,ColumnName<C,?>> decoder)
get(com.netflix.astyanax.model.ColumnFamily<I, K>, com.hp.util.Provider<com.hp.util.persistence.cassandra.entitymgr.column.ColumnDecoder<K, ?>, com.hp.util.persistence.cassandra.entitymgr.column.ColumnName<K, ?>>, I) is used to retrieve a range of pre-constructed
columns. |
<K extends Serializable,C extends Serializable & Comparable<C>> |
get(com.netflix.astyanax.model.ColumnFamily<K,C> colFamily,
K rowKey,
com.netflix.astyanax.model.ByteBufferRange range,
Provider<ColumnDecoder<C,?>,ColumnName<C,?>> decoder)
|
<K extends Serializable,C extends Serializable & Comparable<C>> |
get(com.netflix.astyanax.model.ColumnFamily<K,C> colFamily,
K rowKey,
Collection<ColumnName<C,?>> columns,
Provider<ColumnDecoder<C,?>,ColumnName<C,?>> decoder)
get(com.netflix.astyanax.model.ColumnFamily<I, K>, com.hp.util.Provider<com.hp.util.persistence.cassandra.entitymgr.column.ColumnDecoder<K, ?>, com.hp.util.persistence.cassandra.entitymgr.column.ColumnName<K, ?>>, I) is used for reading a non-contiguous set of
columns from the database. |
<K extends Serializable,C extends Serializable & Comparable<C>> |
get(com.netflix.astyanax.model.ColumnFamily<K,C> colFamily,
K rowKey,
ColumnName<C,?> startColumn,
ColumnName<C,?> endColumn,
boolean reversed,
int limit,
Provider<ColumnDecoder<C,?>,ColumnName<C,?>> decoder)
|
<K extends Serializable,C extends Serializable & Comparable<C>> |
get(com.netflix.astyanax.model.ColumnFamily<K,C> colFamily,
K rowKey,
MarkPageRequest<C> request,
com.netflix.astyanax.serializers.CompositeRangeBuilder range,
Provider<ColumnDecoder<C,?>,ColumnName<C,?>> decoder) |
<K extends Serializable,C extends Serializable & Comparable<C>> |
get(com.netflix.astyanax.model.ColumnFamily<K,C> colFamily,
K rowKey,
MarkPageRequest<C> request,
Provider<ColumnDecoder<C,?>,ColumnName<C,?>> decoder) |
<K extends Serializable,C extends Serializable & Comparable<C>> |
get(com.netflix.astyanax.model.ColumnFamily<K,C> colFamily,
K rowKey,
Provider<ColumnDecoder<C,?>,ColumnName<C,?>> decoder,
ColumnName<C,?>... columnNames)
get(com.netflix.astyanax.model.ColumnFamily<I, K>, com.hp.util.Provider<com.hp.util.persistence.cassandra.entitymgr.column.ColumnDecoder<K, ?>, com.hp.util.persistence.cassandra.entitymgr.column.ColumnName<K, ?>>, I) retrieves a set of non-contiguous columns as
per the user request. |
<K extends Serializable,C extends Serializable & Comparable<C>> |
get(com.netflix.astyanax.model.ColumnFamily<K,C> colFamily,
Provider<ColumnDecoder<C,?>,ColumnName<C,?>> decoder)
|
<I extends Serializable,K extends Serializable & Comparable<K>> |
prepareDeleteMutation(com.netflix.astyanax.model.ColumnFamily<I,K> colFamily,
I rowKey,
Collection<ColumnName<K,?>> colNames) |
<K extends Serializable,C> |
prepareDeleteMutation(com.netflix.astyanax.model.ColumnFamily<K,C> colFamily,
K id)
prepareDeleteMutation(com.netflix.astyanax.model.ColumnFamily<K, C>, K) creates a delete Mutation
and adds it to the MutationBatch . |
<I extends Serializable,K extends Serializable & Comparable<K>,P extends Storable<I>> |
prepareMutation(com.netflix.astyanax.model.ColumnFamily<I,K> colFamily,
P storable)
prepareMutation(com.netflix.astyanax.model.ColumnFamily<I, K>, P) creates a write mutation
and adds it to the MutationBatch . |
static void |
setKeySpace(com.netflix.astyanax.Keyspace keyspace) |
static void |
truncateColumnFamily(com.netflix.astyanax.model.ColumnFamily<?,?> cf)
Deletes all data from a column family.
|
public EntityManager(ConnectionManager connManager)
Keyspace
object.connManager
- The Connection Manager object that contains all
relevant keyspace/database configuration.protected EntityManager(com.netflix.astyanax.Keyspace keyspace)
public static void setKeySpace(com.netflix.astyanax.Keyspace keyspace)
public static void createColumnFamily(ColumnFamilyDefinition<?,?> cf) throws PersistenceConnException
createColumnFamily(com.hp.util.persistence.cassandra.entitymgr.ColumnFamilyDefinition<?, ?>)
creates a new Cassandra
Column Family.This method is a single way to create a Cassandra
Column Family in the DAO framework.
Any DAO that needs to create a Column Family needs to follow these steps. 1. Define a Column Family Definition with the following parameters. a. Column Family Name b. Key Validator - This is the data type of the Row Key/Primary Key c. Default Validator - This is the Default data type of Column Value. If the column validators are not specified, Cassandra will use Default validator to validate the inserted values. d. Comparator - This is the data type of the Column Name. In Cassandra, a Column is a Tuple(Column Name, Column Value, Timestamp). Each have their own data types. The Comparator validates the inserted column name and also sorts columns in ascending order. e. Secondary Indexes - These are Cassandra Native Secondary Indexes. They should have a validator, index name and index type defined. Index Type is always "KEYS" because thats the only type of secondary index that is natively supported. Validator is the same as described above. Index name is generally the name of the column. f. CF Meta data - Every column in a static column family is known at the data modelling time. These columns have their own data type and hence a validator. This can be specified in the column definition as well. 2. The Column Family Definition should be passed down to this method.
cf
- ColumnFamily Definition that contains enough information
to create a column family in cassandra.PersistenceConnException
- If Astyanax is unable to create a column
family it throws a ConnectionException
and should be handled in the upper
layers.public static void dropColumnFamily(com.netflix.astyanax.model.ColumnFamily<?,?> cf) throws PersistenceConnException
cf
- column family to drop.PersistenceConnException
- if errors occur while executing the
operation.public static void truncateColumnFamily(com.netflix.astyanax.model.ColumnFamily<?,?> cf) throws PersistenceConnException
cf
- column family to truncate.PersistenceConnException
- if errors occur while executing the
operation.public <K extends Serializable,C> void prepareDeleteMutation(com.netflix.astyanax.model.ColumnFamily<K,C> colFamily, K id)
prepareDeleteMutation(com.netflix.astyanax.model.ColumnFamily<K, C>, K)
creates a delete Mutation
and adds it to the MutationBatch
. The dao calls this method
repetatively for every row that needs to be deleted. This helps to
delete all rows in a single batch operation.colFamily
- The column family that needs to be operated on.id
- The Row Key of the row that needs to be deleted.public <I extends Serializable,K extends Serializable & Comparable<K>> void prepareDeleteMutation(com.netflix.astyanax.model.ColumnFamily<I,K> colFamily, I rowKey, Collection<ColumnName<K,?>> colNames)
public <I extends Serializable,K extends Serializable & Comparable<K>,P extends Storable<I>> void prepareMutation(com.netflix.astyanax.model.ColumnFamily<I,K> colFamily, P storable)
prepareMutation(com.netflix.astyanax.model.ColumnFamily<I, K>, P)
creates a write mutation
and adds it to the MutationBatch
.
The dao calls this method repetatively for each row that needs to be
written. Also, rows of different column families can be added to the
same MutationBatch. This helps in keeping the Commit Log in a stable
condition. Should there be a failure, the log is replayed.
try {
//TODO : Support Paging
return null;
//return convertToStorable(result, decoder);
} catch (ConnectionException e) {
throw new RuntimeException(e);
}colFamily
- Column family to which a row needs to be written.storable
- This is a Cassandra row that needs to be written.public <I extends Serializable,K extends Serializable & Comparable<K>> CassandraStorable<I,K> get(com.netflix.astyanax.model.ColumnFamily<I,K> cf, Provider<ColumnDecoder<K,?>,ColumnName<K,?>> decoderProvider, I id) throws PersistenceConnException
get(com.netflix.astyanax.model.ColumnFamily<I, K>, com.hp.util.Provider<com.hp.util.persistence.cassandra.entitymgr.column.ColumnDecoder<K, ?>, com.hp.util.persistence.cassandra.entitymgr.column.ColumnName<K, ?>>, I)
retrieves a row from a Cassandra Column Family.
The fetched row is identified by the supplied Row Key/Primary key
from the DAO.cf
- The Column Family to read from.decoderProvider
- The Decoder Provider for all columns of the given
column family. This decoder provider is customised
for a CF and hence each CF needs to provide an
implementation of DecoderProviderid
- The Row Key of the row to be readPersistenceConnException
- If the connection to the DB cannot be
established, this exception is thrown.public <K extends Serializable,C extends Serializable & Comparable<C>> CassandraStorable<K,C> get(com.netflix.astyanax.model.ColumnFamily<K,C> colFamily, K rowKey, com.netflix.astyanax.model.ByteBufferRange range, Provider<ColumnDecoder<C,?>,ColumnName<C,?>> decoder) throws PersistenceConnException
get(com.netflix.astyanax.model.ColumnFamily<I, K>, com.hp.util.Provider<com.hp.util.persistence.cassandra.entitymgr.column.ColumnDecoder<K, ?>, com.hp.util.persistence.cassandra.entitymgr.column.ColumnName<K, ?>>, I)
retrieves a list of columns based on a
column range. It does not retrieve the entire row.
This is a variation of the entire row read using Astyanax slice queries.
This method is used for reading composite column slices.colFamily
- Column Family to retrieve data fromrowKey
- The Row to retrieve columns fromrange
- The ByteBuffer slice Rangedecoder
- Decoder for the given column Family.PersistenceConnException
- If the connection to the DB cannot be
established, this exception is thrownpublic <K extends Serializable,C extends Serializable & Comparable<C>> CassandraStorable<K,C> get(com.netflix.astyanax.model.ColumnFamily<K,C> colFamily, K rowKey, ColumnName<C,?> startColumn, ColumnName<C,?> endColumn, boolean reversed, int limit, Provider<ColumnDecoder<C,?>,ColumnName<C,?>> decoder) throws PersistenceConnException
get(com.netflix.astyanax.model.ColumnFamily<I, K>, com.hp.util.Provider<com.hp.util.persistence.cassandra.entitymgr.column.ColumnDecoder<K, ?>, com.hp.util.persistence.cassandra.entitymgr.column.ColumnName<K, ?>>, I)
is used to retrieve a range of simple columns.
The order of retrieval and the size of the retrieved set can be
specified in this method.colFamily
- Column Family to retrieve columns fromrowKey
- Row key to lookup data columnsstartColumn
- First column in the rangeendColumn
- Last column in the rangereversed
- True if the order should be reversed.
Note that for reversed, startColumn should be greater than
endColumn.limit
- Maximum number of columns to returndecoder
- Decoder for the given column family.PersistenceConnException
- If the connection to the DB cannot be
established, this exception is thrownpublic <K extends Serializable,C extends Serializable & Comparable<C>> CassandraStorable<K,C> get(com.netflix.astyanax.model.ColumnFamily<K,C> colFamily, K rowKey, ByteBuffer startColumn, ByteBuffer endColumn, boolean reversed, int limit, Provider<ColumnDecoder<C,?>,ColumnName<C,?>> decoder) throws PersistenceConnException
get(com.netflix.astyanax.model.ColumnFamily<I, K>, com.hp.util.Provider<com.hp.util.persistence.cassandra.entitymgr.column.ColumnDecoder<K, ?>, com.hp.util.persistence.cassandra.entitymgr.column.ColumnName<K, ?>>, I)
is used to retrieve a range of pre-constructed
columns. This method is used for retrieving composite columns bounded
by a start and a end. The order can be reversed and the size of columns
can be limited to a certain number of columns.colFamily
- Column Family to retrieve data fromrowKey
- Row Key to look upstartColumn
- First Column in the Composite Column RangeendColumn
- Last Column in the Composite Column Rangereversed
- True if the order needs to be reversed. For reversed,
startColumn should be greater than endColumnlimit
- The maximum number of columns to retrieve.decoder
- Column Decoder for the Column Family.PersistenceConnException
- If the connection to the DB cannot be
established, this exception is thrownpublic <K extends Serializable,C extends Serializable & Comparable<C>> CassandraStorable<K,C> get(com.netflix.astyanax.model.ColumnFamily<K,C> colFamily, K rowKey, Provider<ColumnDecoder<C,?>,ColumnName<C,?>> decoder, ColumnName<C,?>... columnNames) throws PersistenceConnException
get(com.netflix.astyanax.model.ColumnFamily<I, K>, com.hp.util.Provider<com.hp.util.persistence.cassandra.entitymgr.column.ColumnDecoder<K, ?>, com.hp.util.persistence.cassandra.entitymgr.column.ColumnName<K, ?>>, I)
retrieves a set of non-contiguous columns as
per the user request. This method expects a set of columns to read.colFamily
- Column Family to retrieve data fromrowKey
- Row Key to look up datadecoder
- The Column Decoder for the Column FamilycolumnNames
- The set of Columns to be readPersistenceConnException
- If the connection to the DB cannot be
established, this exception is thrownpublic <K extends Serializable,C extends Serializable & Comparable<C>> CassandraStorable<K,C> get(com.netflix.astyanax.model.ColumnFamily<K,C> colFamily, K rowKey, Collection<ColumnName<C,?>> columns, Provider<ColumnDecoder<C,?>,ColumnName<C,?>> decoder) throws PersistenceConnException
get(com.netflix.astyanax.model.ColumnFamily<I, K>, com.hp.util.Provider<com.hp.util.persistence.cassandra.entitymgr.column.ColumnDecoder<K, ?>, com.hp.util.persistence.cassandra.entitymgr.column.ColumnName<K, ?>>, I)
is used for reading a non-contiguous set of
columns from the database.colFamily
- Column Family to retrieve data fromrowKey
- Row Key to lookup a rowcolumns
- Collection of Columns to readdecoder
- Decoder for the Column FamilyPersistenceConnException
- If the connection to the DB cannot be
established, this exception is thrownpublic <K extends Serializable,C extends Serializable & Comparable<C>> Collection<CassandraStorable<K,C>> get(com.netflix.astyanax.model.ColumnFamily<K,C> colFamily, Collection<K> rowKeys, Provider<ColumnDecoder<C,?>,ColumnName<C,?>> decoderProvider) throws PersistenceConnException
get(com.netflix.astyanax.model.ColumnFamily<I, K>, com.hp.util.Provider<com.hp.util.persistence.cassandra.entitymgr.column.ColumnDecoder<K, ?>, com.hp.util.persistence.cassandra.entitymgr.column.ColumnName<K, ?>>, I)
retrieves Cassandra multiple rows from a
column family. This method is generally used to get the final
result set in a read operation with filters.colFamily
- Column Family to read fromrowKeys
- The collection of rowKeys to read fromdecoderProvider
- Decoder Provider for each column of this column
familyPersistenceConnException
- If the connection to the DB cannot be
established, this exception is thrownpublic <K extends Serializable,C extends Serializable & Comparable<C>> Collection<CassandraStorable<K,C>> get(com.netflix.astyanax.model.ColumnFamily<K,C> colFamily, Collection<K> rows, Collection<ColumnName<C,?>> columns, Provider<ColumnDecoder<C,?>,ColumnName<C,?>> decoder) throws PersistenceConnException
get(com.netflix.astyanax.model.ColumnFamily<I, K>, com.hp.util.Provider<com.hp.util.persistence.cassandra.entitymgr.column.ColumnDecoder<K, ?>, com.hp.util.persistence.cassandra.entitymgr.column.ColumnName<K, ?>>, I)
retrieves a collection of rows with specified
columns. This method expects a set of Rows and a set of Columns to be
read from the Database. This method improves the read response time as
it does not read the entire row for each row key specified.colFamily
- Column Family to read datarows
- A set of row keys to be readcolumns
- A set of columns to read in each rowdecoder
- Column decoder for the given Column FamilyPersistenceConnException
- If the connection to the DB cannot be
established, this exception is thrownpublic <K extends Serializable,C extends Serializable & Comparable<C>> Collection<CassandraStorable<K,C>> get(com.netflix.astyanax.model.ColumnFamily<K,C> colFamily, Collection<K> rowKeys, ColumnName<C,?> startColumn, ColumnName<C,?> endColumn, boolean reversed, int limit, Provider<ColumnDecoder<C,?>,ColumnName<C,?>> decoder) throws PersistenceConnException
get(com.netflix.astyanax.model.ColumnFamily<I, K>, com.hp.util.Provider<com.hp.util.persistence.cassandra.entitymgr.column.ColumnDecoder<K, ?>, com.hp.util.persistence.cassandra.entitymgr.column.ColumnName<K, ?>>, I)
retrieves a collection of specified rows
and a specified range of columns in each row.colFamily
- Column Family to retrieve data fromrowKeys
- A set of row keys to readstartColumn
- First column of the range in each rowendColumn
- Last column of the range in each rowreversed
- True if read is done in reverse order. In reverse order
read, the start column should be greater than end columnlimit
- Maximum number of columns in the range.decoder
- Column decoder for the given Column FamilyPersistenceConnException
- If the connection to the DB cannot be
established, this exception is thrownpublic <K extends Serializable,C extends Serializable & Comparable<C>> Collection<CassandraStorable<K,C>> get(com.netflix.astyanax.model.ColumnFamily<K,C> colFamily, Provider<ColumnDecoder<C,?>,ColumnName<C,?>> decoder)
get(com.netflix.astyanax.model.ColumnFamily<I, K>, com.hp.util.Provider<com.hp.util.persistence.cassandra.entitymgr.column.ColumnDecoder<K, ?>, com.hp.util.persistence.cassandra.entitymgr.column.ColumnName<K, ?>>, I)
retrieves all rows of a given Column Family.colFamily
- Column Family to read all rows fromdecoder
- Column decoder for the given column familypublic <K extends Serializable,C extends Serializable & Comparable<C>> MarkPage<Column<C,?>> get(com.netflix.astyanax.model.ColumnFamily<K,C> colFamily, K rowKey, MarkPageRequest<C> request, Provider<ColumnDecoder<C,?>,ColumnName<C,?>> decoder) throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
com.netflix.astyanax.connectionpool.exceptions.ConnectionException
public <K extends Serializable,C extends Serializable & Comparable<C>> MarkPage<Column<C,?>> get(com.netflix.astyanax.model.ColumnFamily<K,C> colFamily, K rowKey, MarkPageRequest<C> request, com.netflix.astyanax.serializers.CompositeRangeBuilder range, Provider<ColumnDecoder<C,?>,ColumnName<C,?>> decoder) throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException
com.netflix.astyanax.connectionpool.exceptions.ConnectionException
public <K extends Serializable,C extends Serializable & Comparable<C>> Collection<CassandraStorable<K,C>> get(com.netflix.astyanax.model.ColumnFamily<K,C> cf, ColumnName<C,?> column, boolean key, Provider<ColumnDecoder<C,?>,ColumnName<C,?>> decoder) throws PersistenceConnException
get(com.netflix.astyanax.model.ColumnFamily<I, K>, com.hp.util.Provider<com.hp.util.persistence.cassandra.entitymgr.column.ColumnDecoder<K, ?>, com.hp.util.persistence.cassandra.entitymgr.column.ColumnName<K, ?>>, I)
retrieves rows using index.cf
- Column Family from which to read rowscolumn
- Column to determine secondary indexkey
- boolean key to search indexdecoder
- Column decoder for the given column familyPersistenceConnException
- If the connection to the DB cannot be
established, this exception is thrownpublic <K extends Serializable,C extends Serializable & Comparable<C>> Collection<CassandraStorable<K,C>> get(com.netflix.astyanax.model.ColumnFamily<K,C> cf, ColumnName<C,?> column, String key, Provider<ColumnDecoder<C,?>,ColumnName<C,?>> decoder) throws PersistenceConnException
get(com.netflix.astyanax.model.ColumnFamily<I, K>, com.hp.util.Provider<com.hp.util.persistence.cassandra.entitymgr.column.ColumnDecoder<K, ?>, com.hp.util.persistence.cassandra.entitymgr.column.ColumnName<K, ?>>, I)
retrieves rows using index.cf
- Column Family from which to read rowscolumn
- Column to determine secondary indexkey
- string key to search indexdecoder
- Column decoder for the given column familyPersistenceConnException
- If the connection to the DB cannot be
established, this exception is thrownpublic <K extends Serializable,C extends Serializable & Comparable<C>> Collection<CassandraStorable<K,C>> get(com.netflix.astyanax.model.ColumnFamily<K,C> cf, ColumnName<C,?> column, int key, Provider<ColumnDecoder<C,?>,ColumnName<C,?>> decoder) throws PersistenceConnException
get(com.netflix.astyanax.model.ColumnFamily<I, K>, com.hp.util.Provider<com.hp.util.persistence.cassandra.entitymgr.column.ColumnDecoder<K, ?>, com.hp.util.persistence.cassandra.entitymgr.column.ColumnName<K, ?>>, I)
retrieves rows using index.cf
- Column Family from which to read rowscolumn
- Column to determine secondary indexkey
- integer key to search indexdecoder
- Column decoder for the given column familyPersistenceConnException
- If the connection to the DB cannot be
established, this exception is thrownpublic <K extends Serializable,C extends Serializable & Comparable<C>> long countColumns(com.netflix.astyanax.model.ColumnFamily<K,C> colFamily, K rowKey) throws PersistenceConnException
countColumns(com.netflix.astyanax.model.ColumnFamily<K, C>, K)
counts the number of columns in a
given row of a given column family.
countColumns(com.netflix.astyanax.model.ColumnFamily<K, C>, K)
counts the number of columns in a
given row of a given column family.colFamily
- The column family to read fromrowKey
- The Row Key of the Column Family to count columns from.PersistenceConnException
- If the connection to the DB cannot be
established, this exception is thrownpublic <K extends Serializable,C> int countRows(com.netflix.astyanax.model.ColumnFamily<K,C> colFamily) throws PersistenceException
countRows(ColumnFamily)
retrieves a count
of all rows in a given column familycolFamily
- Column Family to get the count from.PersistenceException
- A General Persistence Exception.public <K extends Serializable,C extends Serializable & Comparable<C>> void delete(com.netflix.astyanax.model.ColumnFamily<K,C> columnFamily, K rowKey, ColumnName<C,?> columnName)
columnName
- name of the column to delete.rowKey
- row key.columnFamily
- column family.public <K extends Serializable,C extends Serializable & Comparable<C>> void deleteColumns(com.netflix.astyanax.model.ColumnFamily<K,C> columnFamily, K rowKey, Collection<ColumnName<C,?>> columnsNames)
columnsNames
- names of the columns to delete.rowKey
- row key.columnFamily
- column family.public void executeOperation() throws PersistenceConnException
executeOperation()
executes a Write Operation.PersistenceConnException
- If the connection to Database is not
established, then this exception
is thrown.Copyright © 2015. All Rights Reserved.