Class ChildPartitionsRecord

  • All Implemented Interfaces:
    java.io.Serializable, ChangeStreamRecord

    @DefaultCoder(org.apache.beam.sdk.extensions.avro.coders.AvroCoder.class)
    public class ChildPartitionsRecord
    extends java.lang.Object
    implements ChangeStreamRecord
    Represents a ChildPartitionsRecord. This record will be emitted in one of the following cases: a partition has been moved into a new partition, a partition has been split into multiple new child partitions or partitions have been merged into a new partition

    When receiving this record, the caller should perform new queries using the child partition tokens received.

    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      ChildPartitionsRecord​(com.google.cloud.Timestamp startTimestamp, java.lang.String recordSequence, java.util.List<ChildPartition> childPartitions, ChangeStreamRecordMetadata metadata)
      Constructs a child partitions record containing one or more child partitions.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      java.util.List<ChildPartition> getChildPartitions()
      List of child partitions yielded within this record.
      java.lang.String getRecordSequence()
      Indicates the order in which a record was put to the stream.
      com.google.cloud.Timestamp getRecordTimestamp()
      Returns the timestamp that which this partition started being valid in Cloud Spanner.
      com.google.cloud.Timestamp getStartTimestamp()
      It is the partition_start_time of the child partition token.
      int hashCode()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ChildPartitionsRecord

        public ChildPartitionsRecord​(com.google.cloud.Timestamp startTimestamp,
                                     java.lang.String recordSequence,
                                     java.util.List<ChildPartition> childPartitions,
                                     ChangeStreamRecordMetadata metadata)
        Constructs a child partitions record containing one or more child partitions.
        Parameters:
        startTimestamp - the timestamp which this partition started being valid in Cloud Spanner
        recordSequence - the order within a partition and a transaction in which the record was put to the stream
        childPartitions - child partition tokens emitted within this record
        metadata - connector execution metadata for the given record
    • Method Detail

      • getRecordTimestamp

        public com.google.cloud.Timestamp getRecordTimestamp()
        Returns the timestamp that which this partition started being valid in Cloud Spanner. The caller must use this time as the change stream query start timestamp for the new partitions.
        Specified by:
        getRecordTimestamp in interface ChangeStreamRecord
        Returns:
        the start timestamp of the partition
      • getStartTimestamp

        public com.google.cloud.Timestamp getStartTimestamp()
        It is the partition_start_time of the child partition token. This partition_start_time is guaranteed to be the same across all the child partitions yielded from a parent. When users start new queries with the child partition tokens, the returned records must have a timestamp >= partition_start_time.
        Returns:
        the start timestamp of the partition
      • getRecordSequence

        public java.lang.String getRecordSequence()
        Indicates the order in which a record was put to the stream. Is unique and increasing within a partition. It is relative to the scope of partition, commit timestamp, and server_transaction_id. It is useful for readers downstream to dedup any duplicate records that were read/recorded.
        Returns:
        record sequence of the record
      • getChildPartitions

        public java.util.List<ChildPartition> getChildPartitions()
        List of child partitions yielded within this record.
        Returns:
        child partitions
      • equals

        public boolean equals​(@Nullable
                              java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object