|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
K - public interface MutationBatch
Batch mutator which operates at the row level assuming the hierarchy: RowKey -> ColumnFamily -> Mutation. This hierarchy serves two purposes. First, it makes it possible to perform multiple operations on the same row without having to repeat specifying the row key. Second, it mirrors the underlying Thrift data structure which averts unnecessary operations to convert from one data structure to another. The mutator is not thread safe If successful, all the mutations are cleared and new mutations may be created. Any previously acquired ColumnFamilyMutations are no longer valid and should be discarded. No data is actually returned after a mutation is executed, hence the Void return value type. Example:
{
@code
ColumnFamily<String, String> cf = AFactory.makeColumnFamily("COLUMN_FAMILY_NAME", // Name
// of
// CF
// in
// Cassandra
StringSerializer.get(), // Row key serializer (implies string type)
StringSerializer.get(), // Column name serializer (implies string
// type)
ColumnType.STANDARD); // This is a standard row
// Create a batch mutation
RowMutationBatch m = keyspace.prepareMutationBatch();
// Start mutate a column family for a specific row key
ColumnFamilyMutation<String> cfm = m.row(cfSuper, "UserId").putColumn("Address", "976 Elm St.")
.putColumn("Age", 50).putColumn("Gender", "Male");
// To delete a row
m.row(cfSuper, "UserId").delete();
// Finally, execute the query
m.execute();
}
| Method Summary | ||
|---|---|---|
|
deleteRow(java.lang.Iterable<? extends ColumnFamily<K,?>> columnFamilies,
K rowKey)
Delete the row for all the specified column families. |
|
void |
deserialize(java.nio.ByteBuffer data)
Re-recreate a mutation batch from a serialized ByteBuffer created by a call to serialize(). |
|
void |
discardMutations()
Discard any pending mutations. |
|
int |
getRowCount()
|
|
java.util.Map<java.nio.ByteBuffer,java.util.Set<java.lang.String>> |
getRowKeys()
|
|
boolean |
isEmpty()
|
|
MutationBatch |
lockCurrentTimestamp()
Force all future mutations to have the same timestamp. |
|
void |
mergeShallow(MutationBatch other)
Perform a shallow merge of mutations from another batch. |
|
MutationBatch |
pinToHost(com.netflix.astyanax.connectionpool.Host host)
Pin this operation to a specific host |
|
java.nio.ByteBuffer |
serialize()
|
|
MutationBatch |
setConsistencyLevel(ConsistencyLevel consistencyLevel)
Set the consistency level for this mutation (same as withConsistencyLevel) |
|
MutationBatch |
setTimeout(long timeout)
Deprecated. |
|
MutationBatch |
setTimestamp(long timestamp)
Set the timestamp for all subsequent operations on this mutation (same as withTimestamp) |
|
MutationBatch |
usingWriteAheadLog(WriteAheadLog manager)
Specify a write ahead log implementation to use for this mutation |
|
MutationBatch |
withConsistencyLevel(ConsistencyLevel consistencyLevel)
Set the consistency level for this mutation (same as setConsistencyLevel) |
|
MutationBatch |
withRetryPolicy(com.netflix.astyanax.retry.RetryPolicy retry)
Set the retry policy to use instead of the one specified in the configuration |
|
|
withRow(ColumnFamily<K,C> columnFamily,
K rowKey)
Mutate a row. |
|
MutationBatch |
withTimestamp(long timestamp)
Set the timestamp for all subsequent operations on this mutation. |
|
| Methods inherited from interface com.netflix.astyanax.Execution |
|---|
execute, executeAsync |
| Method Detail |
|---|
<K,C> ColumnListMutation<C> withRow(ColumnFamily<K,C> columnFamily,
K rowKey)
rowKey -
<K> void deleteRow(java.lang.Iterable<? extends ColumnFamily<K,?>> columnFamilies,
K rowKey)
columnFamilies - void discardMutations()
void mergeShallow(MutationBatch other)
java.lang.UnsupportedOperationException - if the other mutation is of a different typeboolean isEmpty()
int getRowCount()
java.util.Map<java.nio.ByteBuffer,java.util.Set<java.lang.String>> getRowKeys()
MutationBatch pinToHost(com.netflix.astyanax.connectionpool.Host host)
host - MutationBatch setConsistencyLevel(ConsistencyLevel consistencyLevel)
consistencyLevel - MutationBatch withConsistencyLevel(ConsistencyLevel consistencyLevel)
consistencyLevel - MutationBatch withRetryPolicy(com.netflix.astyanax.retry.RetryPolicy retry)
retry - MutationBatch usingWriteAheadLog(WriteAheadLog manager)
manager - MutationBatch lockCurrentTimestamp()
@Deprecated MutationBatch setTimeout(long timeout)
- MutationBatch setTimestamp(long timestamp)
timestamp - in microsecondsMutationBatch withTimestamp(long timestamp)
timestamp - in microsecond
java.nio.ByteBuffer serialize()
throws java.lang.Exception
java.lang.Exception
void deserialize(java.nio.ByteBuffer data)
throws java.lang.Exception
data -
java.lang.Exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||