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 classMutation.MutationSerializerstatic classMutation.PartitionUpdateCollectorCollects finalized partition updatesstatic interfaceMutation.SimpleBuilderInterface for building mutations geared towards human.
-
Field Summary
Fields Modifier and Type Field Description static Mutation.MutationSerializerserializer-
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 voidapply()voidapply(boolean durableWrites)voidapply(boolean durableWrites, boolean isDroppable)Future<?>applyFuture()voidapplyUnsafe()Mutationget()longgetApproxCreatedAtNanos()java.lang.StringgetKeyspaceName()PartitionUpdategetPartitionUpdate(TableMetadata table)com.google.common.collect.ImmutableCollection<PartitionUpdate>getPartitionUpdates()java.util.Collection<TableId>getTableIds()longgetTimeout(java.util.concurrent.TimeUnit unit)java.util.function.Supplier<Mutation>hintOnFailure()booleanisEmpty()DecoratedKeykey()static Mutationmerge(java.util.List<Mutation> mutations)Creates a new mutation that merges all the provided mutations.intserializedSize(int version)static Mutation.SimpleBuildersimpleBuilder(java.lang.String keyspaceName, DecoratedKey partitionKey)Creates a new simple mutuation builder.intsmallestGCGS()java.lang.StringtoString()java.lang.StringtoString(boolean shallow)booleantrackedByCDC()voidvalidateSize(int version, int overhead)Validates size of mutation does not exceedDatabaseDescriptor.getMaxMutationSize().Mutationwithout(java.util.Set<TableId> tableIds)Mutationwithout(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:
getKeyspaceNamein interfaceIMutation
-
getTableIds
public java.util.Collection<TableId> getTableIds()
- Specified by:
getTableIdsin interfaceIMutation
-
key
public DecoratedKey key()
-
getPartitionUpdates
public com.google.common.collect.ImmutableCollection<PartitionUpdate> getPartitionUpdates()
- Specified by:
getPartitionUpdatesin interfaceIMutation
-
hintOnFailure
public java.util.function.Supplier<Mutation> hintOnFailure()
- Specified by:
hintOnFailurein interfaceIMutation
-
validateSize
public void validateSize(int version, int overhead)Description copied from interface:IMutationValidates size of mutation does not exceedDatabaseDescriptor.getMaxMutationSize().- Specified by:
validateSizein interfaceIMutation- Parameters:
version- the MessagingService version the mutation is being serialized for. seeMessagingService.current_versionoverhead- overhadd to add for mutation size to validate. Pass zero if not required but not a negative value.
-
getPartitionUpdate
public PartitionUpdate getPartitionUpdate(TableMetadata table)
-
getApproxCreatedAtNanos
public long getApproxCreatedAtNanos()
-
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:
getTimeoutin interfaceIMutation
-
smallestGCGS
public int smallestGCGS()
-
trackedByCDC
public boolean trackedByCDC()
-
toString
public java.lang.String toString()
- Overrides:
toStringin 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.
-
-