Class PartitionMetadataTableNames

java.lang.Object
org.apache.beam.sdk.io.gcp.spanner.changestreams.dao.PartitionMetadataTableNames
All Implemented Interfaces:
Serializable

public class PartitionMetadataTableNames extends Object implements Serializable
Configuration for a partition metadata table. It encapsulates the name of the metadata table and indexes.
See Also:
  • Constructor Details

    • PartitionMetadataTableNames

      public PartitionMetadataTableNames(String tableName, String watermarkIndexName, String createdAtIndexName)
  • Method Details

    • generateRandom

      public static PartitionMetadataTableNames generateRandom(String databaseId)
      Generates a unique name for the partition metadata table and its indexes. The table name will be in the form of "Metadata_<databaseId>_<uuid>". The watermark index will be in the form of "WatermarkIdx_<databaseId>_<uuid>. The createdAt / start timestamp index will be in the form of "CreatedAtIdx_<databaseId>_<uuid>.
      Parameters:
      databaseId - The database id where the table will be created
      Returns:
      the unique generated names of the partition metadata ddl
    • fromExistingTable

      public static PartitionMetadataTableNames fromExistingTable(String databaseId, String table)
      Encapsulates a selected table name. Index names are generated, but will only be used if the given table does not exist. The watermark index will be in the form of "WatermarkIdx_<databaseId>_<uuid>. The createdAt / start timestamp index will be in the form of "CreatedAtIdx_<databaseId>_<uuid>.
      Parameters:
      databaseId - The database id for the table
      table - The table name to be used
      Returns:
      an instance with the table name and generated index names
    • getTableName

      public String getTableName()
    • getWatermarkIndexName

      public String getWatermarkIndexName()
    • getCreatedAtIndexName

      public String getCreatedAtIndexName()
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object