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();
Constructors
ChangeStreamMutation()
public ChangeStreamMutation()
Methods
getCommitTimestamp()
public abstract long getCommitTimestamp()
Get the commit timestamp of the current mutation.
Type | Description |
long |
getEntries()
public abstract ImmutableList<Entry> getEntries()
Get the list of mods of the current mutation.
Type | Description |
com.google.common.collect.ImmutableList<Entry> |
getEstimatedLowWatermark()
public abstract long getEstimatedLowWatermark()
Get the low watermark of the current mutation.
Type | Description |
long |
getRowKey()
public abstract ByteString getRowKey()
Get the row key of the current mutation.
Type | Description |
ByteString |
getSourceClusterId()
public abstract String getSourceClusterId()
Get the source cluster id of the current mutation.
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.
Type | Description |
int |
getToken()
public abstract String getToken()
Get the token of the current mutation, which can be used to resume the changestream.
Type | Description |
String |
getType()
public abstract ChangeStreamMutation.MutationType getType()
Get the type of the current mutation.
Type | Description |
ChangeStreamMutation.MutationType |
toRowMutation(String tableId)
public RowMutation toRowMutation(String tableId)
Name | Description |
tableId | String |
Type | Description |
RowMutation |
toRowMutationEntry()
public RowMutationEntry toRowMutationEntry()
Type | Description |
RowMutationEntry |