com.netflix.astyanax.thrift
Class AbstractThriftMutationBatchImpl
java.lang.Object
com.netflix.astyanax.thrift.AbstractThriftMutationBatchImpl
- All Implemented Interfaces:
- com.netflix.astyanax.Execution<java.lang.Void>, com.netflix.astyanax.MutationBatch
public abstract class AbstractThriftMutationBatchImpl
- extends java.lang.Object
- implements com.netflix.astyanax.MutationBatch
Basic implementation of a mutation batch using the thrift data structures.
The thrift mutation data structure is,
Map of Keys -> Map of ColumnFamily -> MutationList
|
Constructor Summary |
AbstractThriftMutationBatchImpl(com.netflix.astyanax.Clock clock,
com.netflix.astyanax.model.ConsistencyLevel consistencyLevel,
com.netflix.astyanax.retry.RetryPolicy retry)
|
|
Method Summary |
|
deleteRow(java.lang.Iterable<? extends com.netflix.astyanax.model.ColumnFamily<K,?>> columnFamilies,
K rowKey)
|
void |
deserialize(java.nio.ByteBuffer data)
|
void |
discardMutations()
|
com.netflix.astyanax.model.ConsistencyLevel |
getConsistencyLevel()
|
java.util.Map<java.nio.ByteBuffer,java.util.Map<java.lang.String,java.util.List<org.apache.cassandra.thrift.Mutation>>> |
getMutationMap()
|
com.netflix.astyanax.connectionpool.Host |
getPinnedHost()
|
com.netflix.astyanax.retry.RetryPolicy |
getRetryPolicy()
|
int |
getRowCount()
|
java.util.Map<java.nio.ByteBuffer,java.util.Set<java.lang.String>> |
getRowKeys()
|
com.netflix.astyanax.WriteAheadLog |
getWriteAheadLog()
|
boolean |
isEmpty()
Checks whether the mutation object contains rows. |
com.netflix.astyanax.MutationBatch |
lockCurrentTimestamp()
|
void |
mergeShallow(com.netflix.astyanax.MutationBatch other)
|
com.netflix.astyanax.MutationBatch |
pinToHost(com.netflix.astyanax.connectionpool.Host host)
|
java.nio.ByteBuffer |
serialize()
|
com.netflix.astyanax.MutationBatch |
setConsistencyLevel(com.netflix.astyanax.model.ConsistencyLevel consistencyLevel)
|
com.netflix.astyanax.MutationBatch |
setTimeout(long timeout)
|
com.netflix.astyanax.MutationBatch |
setTimestamp(long timestamp)
|
java.lang.String |
toString()
Generate a string representation of the mutation with the following
syntax Key1: cf1: Mutation count cf2: Mutation count Key2: cf1: Mutation
count cf2: Mutation count |
boolean |
useAtomicBatch()
|
com.netflix.astyanax.MutationBatch |
usingWriteAheadLog(com.netflix.astyanax.WriteAheadLog manager)
|
com.netflix.astyanax.MutationBatch |
withAtomicBatch(boolean condition)
|
com.netflix.astyanax.MutationBatch |
withConsistencyLevel(com.netflix.astyanax.model.ConsistencyLevel consistencyLevel)
|
com.netflix.astyanax.MutationBatch |
withRetryPolicy(com.netflix.astyanax.retry.RetryPolicy retry)
|
<K,C> com.netflix.astyanax.ColumnListMutation<C> |
|
withRow(com.netflix.astyanax.model.ColumnFamily<K,C> columnFamily,
K rowKey)
|
com.netflix.astyanax.MutationBatch |
withTimestamp(long timestamp)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.netflix.astyanax.Execution |
execute, executeAsync |
timestamp
protected long timestamp
AbstractThriftMutationBatchImpl
public AbstractThriftMutationBatchImpl(com.netflix.astyanax.Clock clock,
com.netflix.astyanax.model.ConsistencyLevel consistencyLevel,
com.netflix.astyanax.retry.RetryPolicy retry)
withRow
public <K,C> com.netflix.astyanax.ColumnListMutation<C> withRow(com.netflix.astyanax.model.ColumnFamily<K,C> columnFamily,
K rowKey)
- Specified by:
withRow in interface com.netflix.astyanax.MutationBatch
discardMutations
public void discardMutations()
- Specified by:
discardMutations in interface com.netflix.astyanax.MutationBatch
deleteRow
public <K> void deleteRow(java.lang.Iterable<? extends com.netflix.astyanax.model.ColumnFamily<K,?>> columnFamilies,
K rowKey)
- Specified by:
deleteRow in interface com.netflix.astyanax.MutationBatch
isEmpty
public boolean isEmpty()
- Checks whether the mutation object contains rows. While the map may
contain row keys the row keys may not contain any mutations.
- Specified by:
isEmpty in interface com.netflix.astyanax.MutationBatch
- Returns:
toString
public java.lang.String toString()
- Generate a string representation of the mutation with the following
syntax Key1: cf1: Mutation count cf2: Mutation count Key2: cf1: Mutation
count cf2: Mutation count
- Overrides:
toString in class java.lang.Object
serialize
public java.nio.ByteBuffer serialize()
throws java.lang.Exception
- Specified by:
serialize in interface com.netflix.astyanax.MutationBatch
- Throws:
java.lang.Exception
deserialize
public void deserialize(java.nio.ByteBuffer data)
throws java.lang.Exception
- Specified by:
deserialize in interface com.netflix.astyanax.MutationBatch
- Throws:
java.lang.Exception
getRowKeys
public java.util.Map<java.nio.ByteBuffer,java.util.Set<java.lang.String>> getRowKeys()
- Specified by:
getRowKeys in interface com.netflix.astyanax.MutationBatch
getMutationMap
public java.util.Map<java.nio.ByteBuffer,java.util.Map<java.lang.String,java.util.List<org.apache.cassandra.thrift.Mutation>>> getMutationMap()
mergeShallow
public void mergeShallow(com.netflix.astyanax.MutationBatch other)
- Specified by:
mergeShallow in interface com.netflix.astyanax.MutationBatch
getRowCount
public int getRowCount()
- Specified by:
getRowCount in interface com.netflix.astyanax.MutationBatch
setTimeout
public com.netflix.astyanax.MutationBatch setTimeout(long timeout)
- Specified by:
setTimeout in interface com.netflix.astyanax.MutationBatch
setTimestamp
public com.netflix.astyanax.MutationBatch setTimestamp(long timestamp)
- Specified by:
setTimestamp in interface com.netflix.astyanax.MutationBatch
withTimestamp
public com.netflix.astyanax.MutationBatch withTimestamp(long timestamp)
- Specified by:
withTimestamp in interface com.netflix.astyanax.MutationBatch
lockCurrentTimestamp
public com.netflix.astyanax.MutationBatch lockCurrentTimestamp()
- Specified by:
lockCurrentTimestamp in interface com.netflix.astyanax.MutationBatch
setConsistencyLevel
public com.netflix.astyanax.MutationBatch setConsistencyLevel(com.netflix.astyanax.model.ConsistencyLevel consistencyLevel)
- Specified by:
setConsistencyLevel in interface com.netflix.astyanax.MutationBatch
withConsistencyLevel
public com.netflix.astyanax.MutationBatch withConsistencyLevel(com.netflix.astyanax.model.ConsistencyLevel consistencyLevel)
- Specified by:
withConsistencyLevel in interface com.netflix.astyanax.MutationBatch
getConsistencyLevel
public com.netflix.astyanax.model.ConsistencyLevel getConsistencyLevel()
pinToHost
public com.netflix.astyanax.MutationBatch pinToHost(com.netflix.astyanax.connectionpool.Host host)
- Specified by:
pinToHost in interface com.netflix.astyanax.MutationBatch
withRetryPolicy
public com.netflix.astyanax.MutationBatch withRetryPolicy(com.netflix.astyanax.retry.RetryPolicy retry)
- Specified by:
withRetryPolicy in interface com.netflix.astyanax.MutationBatch
usingWriteAheadLog
public com.netflix.astyanax.MutationBatch usingWriteAheadLog(com.netflix.astyanax.WriteAheadLog manager)
- Specified by:
usingWriteAheadLog in interface com.netflix.astyanax.MutationBatch
withAtomicBatch
public com.netflix.astyanax.MutationBatch withAtomicBatch(boolean condition)
- Specified by:
withAtomicBatch in interface com.netflix.astyanax.MutationBatch
useAtomicBatch
public boolean useAtomicBatch()
getPinnedHost
public com.netflix.astyanax.connectionpool.Host getPinnedHost()
getRetryPolicy
public com.netflix.astyanax.retry.RetryPolicy getRetryPolicy()
getWriteAheadLog
public com.netflix.astyanax.WriteAheadLog getWriteAheadLog()