Class Mutation (2.45.1)

public final class Mutation implements MutationApi<Mutation>, Serializable

The concrete implementation of MutationApi that can be used to create and represent a list of mutations. It used by RowMutation and ConditionalRowMutation to encapsulate a list of mutations that will to be applied to a single row.

Inheritance

java.lang.Object > Mutation

Implements

com.google.cloud.bigtable.data.v2.models.MutationApi<com.google.cloud.bigtable.data.v2.models.Mutation>, Serializable

Static Methods

create()

public static Mutation create()

Creates new instance of Mutation object.

Returns
Type Description
Mutation

createUnsafe()

public static Mutation createUnsafe()

Creates new instance of Mutation object which allows setCell operation to use server side timestamp. This is dangerous because mutations will no longer be idempotent, which might cause multiple duplicate values to be stored in Bigtable. This option should only be used for advanced usecases with extreme care.

Returns
Type Description
Mutation

fromProtoUnsafe(Iterable<Mutation> protos)

public static Mutation fromProtoUnsafe(Iterable<Mutation> protos)

Wraps the List of protobuf com.google.bigtable.v2.Mutation. This methods, like #createUnsafe(), allows setCell operation to use server side timestamp. This is dangerous because mutations will no longer be idempotent, which might cause multiple duplicate values to be stored in Bigtable. This option should only be used for advanced usecases with extreme care.

Parameter
Name Description
protos Iterable<com.google.bigtable.v2.Mutation>
Returns
Type Description
Mutation

fromProtoUnsafe(List<Mutation> protos)

public static Mutation fromProtoUnsafe(List<Mutation> protos)

Wraps the List of protobuf com.google.bigtable.v2.Mutation. This methods, like #createUnsafe(), allows setCell operation to use server side timestamp. This is dangerous because mutations will no longer be idempotent, which might cause multiple duplicate values to be stored in Bigtable. This option should only be used for advanced usecases with extreme care.

Parameter
Name Description
protos List<com.google.bigtable.v2.Mutation>
Returns
Type Description
Mutation

Methods

addToCell(String familyName, Value qualifier, Value timestamp, Value value)

public Mutation addToCell(String familyName, Value qualifier, Value timestamp, Value value)

Adds a Value to an aggregate cell. The column family must be an aggregate family and have an input type matching the type of Value or this mutation will be rejected.

Note: The timestamp values are in microseconds but must match the granularity of the table(defaults to MILLIS). Therefore, the given value must be a multiple of 1000 (millisecond granularity). For example: 1571902339435000.

Parameters
Name Description
familyName String
qualifier Value
timestamp Value
value Value
Returns
Type Description
Mutation

deleteCells(String familyName, ByteString qualifier)

public Mutation deleteCells(String familyName, ByteString qualifier)

Adds a mutation which deletes cells from the specified column.

Parameters
Name Description
familyName String
qualifier ByteString
Returns
Type Description
Mutation

deleteCells(String familyName, ByteString qualifier, Range.TimestampRange timestampRange)

public Mutation deleteCells(String familyName, ByteString qualifier, Range.TimestampRange timestampRange)

Adds a mutation which deletes cells from the specified column, restricted to a given timestamp range.

Parameters
Name Description
familyName String
qualifier ByteString
timestampRange Range.TimestampRange
Returns
Type Description
Mutation

deleteCells(String familyName, String qualifier)

public Mutation deleteCells(String familyName, String qualifier)

Adds a mutation which deletes cells from the specified column.

Parameters
Name Description
familyName String
qualifier String
Returns
Type Description
Mutation

deleteFamily(String familyName)

public Mutation deleteFamily(String familyName)

Adds a mutation which deletes all cells from the specified column family.

Parameter
Name Description
familyName String
Returns
Type Description
Mutation

deleteRow()

public Mutation deleteRow()

Adds a mutation which deletes all cells from the containing row.

Returns
Type Description
Mutation

mergeToCell(String familyName, Value qualifier, Value timestamp, Value value)

public Mutation mergeToCell(String familyName, Value qualifier, Value timestamp, Value value)

Merges a Value accumulator to an aggregate cell. The column family must be an aggregate family or this mutation will be rejected.

Note: The timestamp values are in microseconds but must match the granularity of the table(defaults to MILLIS). Therefore, the given value must be a multiple of 1000 (millisecond granularity). For example: 1571902339435000.

Parameters
Name Description
familyName String
qualifier Value
timestamp Value
value Value
Returns
Type Description
Mutation

setCell(String familyName, ByteString qualifier, ByteString value)

public Mutation setCell(String familyName, ByteString qualifier, ByteString value)

Adds a mutation which sets the value of the specified cell.

Uses microseconds since epoch as the timestamp.

Parameters
Name Description
familyName String
qualifier ByteString
value ByteString
Returns
Type Description
Mutation

setCell(String familyName, ByteString qualifier, long value)

public Mutation setCell(String familyName, ByteString qualifier, long value)

Adds a mutation which sets the value of the specified cell.

Uses microseconds since epoch as the timestamp.

Parameters
Name Description
familyName String
qualifier ByteString
value long
Returns
Type Description
Mutation

setCell(String familyName, ByteString qualifier, long timestamp, ByteString value)

public Mutation setCell(String familyName, ByteString qualifier, long timestamp, ByteString value)

Adds a mutation which sets the value of the specified cell.

Note: The timestamp values are in microseconds but must match the granularity of the table(defaults to MILLIS). Therefore, the given value must be a multiple of 1000 (millisecond granularity). For example: 1571902339435000.

Parameters
Name Description
familyName String
qualifier ByteString
timestamp long
value ByteString
Returns
Type Description
Mutation

setCell(String familyName, ByteString qualifier, long timestamp, long value)

public Mutation setCell(String familyName, ByteString qualifier, long timestamp, long value)

Adds a mutation which sets the value of the specified cell.

Note: The timestamp values are in microseconds but must match the granularity of the table(defaults to MILLIS). Therefore, the given value must be a multiple of 1000 (millisecond granularity). For example: 1571902339435000.

Parameters
Name Description
familyName String
qualifier ByteString
timestamp long
value long
Returns
Type Description
Mutation

setCell(String familyName, String qualifier, String value)

public Mutation setCell(String familyName, String qualifier, String value)

Adds a mutation which sets the value of the specified cell.

This a convenience method that converts Strings to ByteStrings and uses microseconds since epoch as the timestamp.

Parameters
Name Description
familyName String
qualifier String
value String
Returns
Type Description
Mutation

setCell(String familyName, String qualifier, long value)

public Mutation setCell(String familyName, String qualifier, long value)

Adds a mutation which sets the value of the specified cell.

This a convenience method that converts Strings to ByteStrings and uses microseconds since epoch as the timestamp. Also it accepts long value.

Parameters
Name Description
familyName String
qualifier String
value long
Returns
Type Description
Mutation

setCell(String familyName, String qualifier, long timestamp, String value)

public Mutation setCell(String familyName, String qualifier, long timestamp, String value)

Adds a mutation which sets the value of the specified cell.

This is a convenience override that converts Strings to ByteStrings.

Note: The timestamp values are in microseconds but must match the granularity of the table(defaults to MILLIS). Therefore, the given value must be a multiple of 1000 (millisecond granularity). For example: 1571902339435000.

Parameters
Name Description
familyName String
qualifier String
timestamp long
value String
Returns
Type Description
Mutation

setCell(String familyName, String qualifier, long timestamp, long value)

public Mutation setCell(String familyName, String qualifier, long timestamp, long value)

Adds a mutation which sets the value of the specified cell.

This is a convenience override that converts Strings to ByteStrings.

Note: The timestamp values are in microseconds but must match the granularity of the table(defaults to MILLIS). Therefore, the given value must be a multiple of 1000 (millisecond granularity). For example: 1571902339435000.

Parameters
Name Description
familyName String
qualifier String
timestamp long
value long
Returns
Type Description
Mutation