Class ChangeStreamMutation

  • All Implemented Interfaces:
    ChangeStreamRecord, Serializable

    @InternalApi("Intended for use by the BigtableIO in apache/beam only.")
    public abstract class ChangeStreamMutation
    extends Object
    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();
     
    See Also:
    Serialized Form
    • Constructor Detail

      • ChangeStreamMutation

        public ChangeStreamMutation()
    • Method Detail

      • getRowKey

        @Nonnull
        public abstract com.google.protobuf.ByteString getRowKey()
        Get the row key of the current mutation.
      • getSourceClusterId

        @Nonnull
        public abstract String getSourceClusterId()
        Get the source cluster id of the current mutation.
      • getCommitTimestamp

        public abstract org.threeten.bp.Instant getCommitTimestamp()
        Get the commit timestamp of the current mutation.
      • 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.
      • getToken

        @Nonnull
        public abstract String getToken()
        Get the token of the current mutation, which can be used to resume the changestream.
      • getEstimatedLowWatermark

        public abstract org.threeten.bp.Instant getEstimatedLowWatermark()
        Get the low watermark of the current mutation.
      • getEntries

        @Nonnull
        public abstract com.google.common.collect.ImmutableList<Entry> getEntries()
        Get the list of mods of the current mutation.