Class DataChangeRecord
- java.lang.Object
-
- org.apache.beam.sdk.io.gcp.spanner.changestreams.model.DataChangeRecord
-
- All Implemented Interfaces:
java.io.Serializable
,ChangeStreamRecord
@DefaultCoder(org.apache.beam.sdk.coders.AvroCoder.class) public class DataChangeRecord extends java.lang.Object implements ChangeStreamRecord
A data change record encodes modifications to Cloud Spanner rows. A record will contain one or more modifications made in one table with the sameModType
. There can be multiple data change records for a transaction and commit timestamp.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DataChangeRecord(java.lang.String partitionToken, com.google.cloud.Timestamp commitTimestamp, java.lang.String serverTransactionId, boolean isLastRecordInTransactionInPartition, java.lang.String recordSequence, java.lang.String tableName, java.util.List<ColumnType> rowType, java.util.List<Mod> mods, ModType modType, ValueCaptureType valueCaptureType, long numberOfRecordsInTransaction, long numberOfPartitionsInTransaction, java.lang.String transactionTag, boolean isSystemTransaction, ChangeStreamRecordMetadata metadata)
Constructs a data change record for a given partition, at a given timestamp, for a given transaction.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
com.google.cloud.Timestamp
getCommitTimestamp()
The timestamp at which the modifications within were committed in Cloud Spanner.ChangeStreamRecordMetadata
getMetadata()
The connector execution metadata for this record.java.util.List<Mod>
getMods()
The modifications within this record.ModType
getModType()
The type of operation that caused the modifications within this record.long
getNumberOfPartitionsInTransaction()
The total number of partitions for the given transaction.long
getNumberOfRecordsInTransaction()
The total number of data change records for the given transaction.java.lang.String
getPartitionToken()
The unique identifier of the partition that generated this record.java.lang.String
getRecordSequence()
Indicates the order in which this record was put into the change stream in the scope of a partition, commit timestamp and transaction tuple.com.google.cloud.Timestamp
getRecordTimestamp()
The timestamp at which the modifications within were committed in Cloud Spanner.java.util.List<ColumnType>
getRowType()
The type of the primary keys and modified columns within this record.java.lang.String
getServerTransactionId()
The unique transaction id in which the modifications occurred.java.lang.String
getTableName()
The name of the table in which the modifications within this record occurred.java.lang.String
getTransactionTag()
The transaction tag associated with the given transaction.ValueCaptureType
getValueCaptureType()
The capture type of the change stream that generated this record.int
hashCode()
boolean
isLastRecordInTransactionInPartition()
Indicates whether this record is the last emitted for the given transaction in the given partition.boolean
isSystemTransaction()
Whether the given transaction is Spanner system transaction.java.lang.String
toString()
-
-
-
Constructor Detail
-
DataChangeRecord
public DataChangeRecord(java.lang.String partitionToken, com.google.cloud.Timestamp commitTimestamp, java.lang.String serverTransactionId, boolean isLastRecordInTransactionInPartition, java.lang.String recordSequence, java.lang.String tableName, java.util.List<ColumnType> rowType, java.util.List<Mod> mods, ModType modType, ValueCaptureType valueCaptureType, long numberOfRecordsInTransaction, long numberOfPartitionsInTransaction, java.lang.String transactionTag, boolean isSystemTransaction, ChangeStreamRecordMetadata metadata)
Constructs a data change record for a given partition, at a given timestamp, for a given transaction. The data change record needs to be given information about the table modified, the type of primary keys and modified columns, the modifications themselves and other metadata.- Parameters:
partitionToken
- the unique identifier of the partition that generated this recordcommitTimestamp
- the timestamp at which the modifications within were committed in Cloud SpannerserverTransactionId
- the unique transaction id in which the modifications occurredisLastRecordInTransactionInPartition
- indicates whether this record is the last emitted for the given transaction in the given partitionrecordSequence
- indicates the order in which this record was put into the change stream in the scope of a partition, commit timestamp and transaction tupletableName
- the name of the table in which the modifications occurredrowType
- the type of the primary keys and modified columnsmods
- the modifications occurredmodType
- the operation that caused the modification to occurvalueCaptureType
- the capture type of the change streamnumberOfRecordsInTransaction
- the total number of records for the given transactionnumberOfPartitionsInTransaction
- the total number of partitions within the given transactiontransactionTag
- the transaction tag associated with the given transactionisSystemTransaction
- whether the given transaction is Spanner system transaction (or user transaction)metadata
- connector execution metadata for the given record
-
-
Method Detail
-
getRecordTimestamp
public com.google.cloud.Timestamp getRecordTimestamp()
The timestamp at which the modifications within were committed in Cloud Spanner.- Specified by:
getRecordTimestamp
in interfaceChangeStreamRecord
- Returns:
- the timestamp at which this record has occurred.
-
getPartitionToken
public java.lang.String getPartitionToken()
The unique identifier of the partition that generated this record.
-
getCommitTimestamp
public com.google.cloud.Timestamp getCommitTimestamp()
The timestamp at which the modifications within were committed in Cloud Spanner.
-
getServerTransactionId
public java.lang.String getServerTransactionId()
The unique transaction id in which the modifications occurred.
-
isLastRecordInTransactionInPartition
public boolean isLastRecordInTransactionInPartition()
Indicates whether this record is the last emitted for the given transaction in the given partition.
-
getRecordSequence
public java.lang.String getRecordSequence()
Indicates the order in which this record was put into the change stream in the scope of a partition, commit timestamp and transaction tuple.
-
getTableName
public java.lang.String getTableName()
The name of the table in which the modifications within this record occurred.
-
getRowType
public java.util.List<ColumnType> getRowType()
The type of the primary keys and modified columns within this record.
-
getMods
public java.util.List<Mod> getMods()
The modifications within this record.
-
getModType
public ModType getModType()
The type of operation that caused the modifications within this record.
-
getValueCaptureType
public ValueCaptureType getValueCaptureType()
The capture type of the change stream that generated this record.
-
getNumberOfRecordsInTransaction
public long getNumberOfRecordsInTransaction()
The total number of data change records for the given transaction.
-
getNumberOfPartitionsInTransaction
public long getNumberOfPartitionsInTransaction()
The total number of partitions for the given transaction.
-
getTransactionTag
public java.lang.String getTransactionTag()
The transaction tag associated with the given transaction.
-
isSystemTransaction
public boolean isSystemTransaction()
Whether the given transaction is Spanner system transaction. Otherwise it is user/application transaction.
-
getMetadata
public ChangeStreamRecordMetadata getMetadata()
The connector execution metadata for this record.
-
equals
public boolean equals(@Nullable java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-