Class ChangeStreamMutation (2.44.0)

public abstract class ChangeStreamMutation implements ChangeStreamRecord, Serializable

A ChangeStreamMutation represents a list of mods(represented by List<Entry>) targeted at a single row, which is concatenated by ChangeStreamRecordMerger. It represents a logical row mutation and can be converted to the original write request(i.e. RowMutation or RowMutationEntry.

A ChangeStreamMutation can be constructed in two ways, depending on whether it's a user initiated mutation or a Garbage Collection mutation. Either way, the caller should explicitly set token and estimatedLowWatermark before build(), otherwise it'll raise an error.

Case 1) User initiated mutation.


 ChangeStreamMutation.Builder builder = ChangeStreamMutation.createUserMutation(...);
 builder.setCell(...);
 builder.deleteFamily(...);
 builder.deleteCells(...);
 ChangeStreamMutation changeStreamMutation = builder.setToken(...).setEstimatedLowWatermark().build();
 

Case 2) Garbage Collection mutation.


 ChangeStreamMutation.Builder builder = ChangeStreamMutation.createGcMutation(...);
 builder.setCell(...);
 builder.deleteFamily(...);
 builder.deleteCells(...);
 ChangeStreamMutation changeStreamMutation = builder.setToken(...).setEstimatedLowWatermark().build();
 

Inheritance

java.lang.Object > ChangeStreamMutation

Constructors

ChangeStreamMutation()

public ChangeStreamMutation()

Methods

getCommitTimestamp()

public abstract Instant getCommitTimestamp()

Get the commit timestamp of the current mutation.

Returns
Type Description
org.threeten.bp.Instant

getEntries()

public abstract ImmutableList<Entry> getEntries()

Get the list of mods of the current mutation.

Returns
Type Description
com.google.common.collect.ImmutableList<Entry>

getEstimatedLowWatermark()

public abstract Instant getEstimatedLowWatermark()

Get the low watermark of the current mutation.

Returns
Type Description
org.threeten.bp.Instant

getRowKey()

public abstract ByteString getRowKey()

Get the row key of the current mutation.

Returns
Type Description
ByteString

getSourceClusterId()

public abstract String getSourceClusterId()

Get the source cluster id of the current mutation.

Returns
Type Description
String

getTieBreaker()

public abstract int getTieBreaker()

Get the tie breaker of the current mutation. This is used to resolve conflicts when multiple mutations are applied to different clusters at the same time.

Returns
Type Description
int

getToken()

public abstract String getToken()

Get the token of the current mutation, which can be used to resume the changestream.

Returns
Type Description
String

getType()

public abstract ChangeStreamMutation.MutationType getType()

Get the type of the current mutation.

Returns
Type Description
ChangeStreamMutation.MutationType

toRowMutation(String tableId)

public RowMutation toRowMutation(String tableId)
Parameter
Name Description
tableId String
Returns
Type Description
RowMutation

toRowMutationEntry()

public RowMutationEntry toRowMutationEntry()
Returns
Type Description
RowMutationEntry