Package org.apache.cassandra.db
Class CounterMutation
- java.lang.Object
-
- org.apache.cassandra.db.CounterMutation
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CounterMutation.CounterMutationSerializer
-
Field Summary
Fields Modifier and Type Field Description static CounterMutation.CounterMutationSerializer
serializer
-
Fields inherited from interface org.apache.cassandra.db.IMutation
MAX_MUTATION_SIZE
-
-
Constructor Summary
Constructors Constructor Description CounterMutation(Mutation mutation, ConsistencyLevel consistency)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
apply()
Mutation
applyCounterMutation()
Applies the counter mutation, returns the result Mutation (for replication to other nodes).ConsistencyLevel
consistency()
java.lang.String
getKeyspaceName()
Mutation
getMutation()
java.util.Collection<PartitionUpdate>
getPartitionUpdates()
java.util.Collection<TableId>
getTableIds()
long
getTimeout(java.util.concurrent.TimeUnit unit)
java.util.function.Supplier<Mutation>
hintOnFailure()
DecoratedKey
key()
int
serializedSize(int version)
java.lang.String
toString()
java.lang.String
toString(boolean shallow)
void
validateSize(int version, int overhead)
Validates size of mutation does not exceedDatabaseDescriptor.getMaxMutationSize()
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.cassandra.db.IMutation
validateIndexedColumns
-
-
-
-
Field Detail
-
serializer
public static final CounterMutation.CounterMutationSerializer serializer
-
-
Constructor Detail
-
CounterMutation
public CounterMutation(Mutation mutation, ConsistencyLevel consistency)
-
-
Method Detail
-
getKeyspaceName
public java.lang.String getKeyspaceName()
- Specified by:
getKeyspaceName
in interfaceIMutation
-
getTableIds
public java.util.Collection<TableId> getTableIds()
- Specified by:
getTableIds
in interfaceIMutation
-
getPartitionUpdates
public java.util.Collection<PartitionUpdate> getPartitionUpdates()
- Specified by:
getPartitionUpdates
in interfaceIMutation
-
hintOnFailure
public java.util.function.Supplier<Mutation> hintOnFailure()
- Specified by:
hintOnFailure
in interfaceIMutation
-
validateSize
public void validateSize(int version, int overhead)
Description copied from interface:IMutation
Validates size of mutation does not exceedDatabaseDescriptor.getMaxMutationSize()
.- Specified by:
validateSize
in interfaceIMutation
- Parameters:
version
- the MessagingService version the mutation is being serialized for. seeMessagingService.current_version
overhead
- overhadd to add for mutation size to validate. Pass zero if not required but not a negative value.
-
getMutation
public Mutation getMutation()
-
key
public DecoratedKey key()
-
consistency
public ConsistencyLevel consistency()
-
applyCounterMutation
public Mutation applyCounterMutation() throws WriteTimeoutException
Applies the counter mutation, returns the result Mutation (for replication to other nodes). 1. Grabs the striped cell-level locks in the proper order 2. Gets the current values of the counters-to-be-modified from the counter cache 3. Reads the rest of the current values (cache misses) from the CF 4. Writes the updated counter values 5. Updates the counter cache 6. Releases the lock(s) See CASSANDRA-4775 and CASSANDRA-6504 for further details.- Returns:
- the applied resulting Mutation
- Throws:
WriteTimeoutException
-
getTimeout
public long getTimeout(java.util.concurrent.TimeUnit unit)
- Specified by:
getTimeout
in interfaceIMutation
-
serializedSize
public int serializedSize(int version)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-