Package org.apache.cassandra.db
Class Mutation
- java.lang.Object
-
- org.apache.cassandra.db.Mutation
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Mutation.MutationSerializer
static class
Mutation.PartitionUpdateCollector
Collects finalized partition updatesstatic interface
Mutation.SimpleBuilder
Interface for building mutations geared towards human.
-
Field Summary
Fields Modifier and Type Field Description static Mutation.MutationSerializer
serializer
-
Fields inherited from interface org.apache.cassandra.db.IMutation
MAX_MUTATION_SIZE
-
-
Constructor Summary
Constructors Constructor Description Mutation(java.lang.String keyspaceName, DecoratedKey key, com.google.common.collect.ImmutableMap<TableId,PartitionUpdate> modifications, long approxCreatedAtNanos)
Mutation(java.lang.String keyspaceName, DecoratedKey key, com.google.common.collect.ImmutableMap<TableId,PartitionUpdate> modifications, long approxCreatedAtNanos, boolean cdcEnabled)
Mutation(PartitionUpdate update)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
apply()
void
apply(boolean durableWrites)
void
apply(boolean durableWrites, boolean isDroppable)
Future<?>
applyFuture()
void
applyUnsafe()
Mutation
get()
java.lang.String
getKeyspaceName()
PartitionUpdate
getPartitionUpdate(TableMetadata table)
com.google.common.collect.ImmutableCollection<PartitionUpdate>
getPartitionUpdates()
java.util.Collection<TableId>
getTableIds()
long
getTimeout(java.util.concurrent.TimeUnit unit)
java.util.function.Supplier<Mutation>
hintOnFailure()
boolean
isEmpty()
DecoratedKey
key()
static Mutation
merge(java.util.List<Mutation> mutations)
Creates a new mutation that merges all the provided mutations.int
serializedSize(int version)
static Mutation.SimpleBuilder
simpleBuilder(java.lang.String keyspaceName, DecoratedKey partitionKey)
Creates a new simple mutuation builder.int
smallestGCGS()
java.lang.String
toString()
java.lang.String
toString(boolean shallow)
boolean
trackedByCDC()
void
validateSize(int version, int overhead)
Validates size of mutation does not exceedDatabaseDescriptor.getMaxMutationSize()
.Mutation
without(java.util.Set<TableId> tableIds)
Mutation
without(TableId tableId)
-
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 Mutation.MutationSerializer serializer
-
-
Constructor Detail
-
Mutation
public Mutation(PartitionUpdate update)
-
Mutation
public Mutation(java.lang.String keyspaceName, DecoratedKey key, com.google.common.collect.ImmutableMap<TableId,PartitionUpdate> modifications, long approxCreatedAtNanos)
-
Mutation
public Mutation(java.lang.String keyspaceName, DecoratedKey key, com.google.common.collect.ImmutableMap<TableId,PartitionUpdate> modifications, long approxCreatedAtNanos, boolean cdcEnabled)
-
-
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
-
key
public DecoratedKey key()
-
getPartitionUpdates
public com.google.common.collect.ImmutableCollection<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.
-
getPartitionUpdate
public PartitionUpdate getPartitionUpdate(TableMetadata table)
-
isEmpty
public boolean isEmpty()
-
merge
public static Mutation merge(java.util.List<Mutation> mutations)
Creates a new mutation that merges all the provided mutations.- Parameters:
mutations
- the mutations to merge together. All mutation must be on the same keyspace and partition key. There should also be at least one mutation.- Returns:
- a mutation that contains all the modifications contained in
mutations
. - Throws:
java.lang.IllegalArgumentException
- if not all the mutations are on the same keyspace and key.
-
applyFuture
public Future<?> applyFuture()
-
apply
public void apply(boolean durableWrites, boolean isDroppable)
-
apply
public void apply(boolean durableWrites)
-
applyUnsafe
public void applyUnsafe()
-
getTimeout
public long getTimeout(java.util.concurrent.TimeUnit unit)
- Specified by:
getTimeout
in interfaceIMutation
-
smallestGCGS
public int smallestGCGS()
-
trackedByCDC
public boolean trackedByCDC()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
toString
public java.lang.String toString(boolean shallow)
-
serializedSize
public int serializedSize(int version)
-
simpleBuilder
public static Mutation.SimpleBuilder simpleBuilder(java.lang.String keyspaceName, DecoratedKey partitionKey)
Creates a new simple mutuation builder.- Parameters:
keyspaceName
- the name of the keyspace this is a mutation for.partitionKey
- the key of partition this if a mutation for.- Returns:
- a newly created builder.
-
-