Package com.google.cloud.spanner.watcher
Class SpannerCommitTimestampRepository
- java.lang.Object
-
- com.google.cloud.spanner.watcher.SpannerCommitTimestampRepository
-
- All Implemented Interfaces:
CommitTimestampRepository
public class SpannerCommitTimestampRepository extends Object implements CommitTimestampRepository
CommitTimestampRepositorythat stores the last seen commit timestamp for a table in a Cloud Spanner database table. The default table definition to use is
The table name and column names are configurable.CREATE TABLE LAST_SEEN_COMMIT_TIMESTAMPS ( DATABASE_NAME STRING(MAX) NOT NULL, TABLE_CATALOG STRING(MAX) NOT NULL, TABLE_SCHEMA STRING(MAX) NOT NULL, TABLE_NAME STRING(MAX) NOT NULL, SHARD_ID_BOOL BOOL, SHARD_ID_BYTES BYTES(MAX), SHARD_ID_DATE DATE, SHARD_ID_FLOAT64 FLOAT64, SHARD_ID_INT64 INT64, SHARD_ID_STRING STRING(MAX), SHARD_ID_TIMESTAMP TIMESTAMP, LAST_SEEN_COMMIT_TIMESTAMP TIMESTAMP NOT NULL ) PRIMARY KEY (DATABASE_NAME, TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, SHARD_ID_BOOL, SHARD_ID_BYTES, SHARD_ID_DATE, SHARD_ID_FLOAT64, SHARD_ID_INT64, SHARD_ID_STRING, SHARD_ID_TIMESTAMP)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSpannerCommitTimestampRepository.BuilderBuilder for aSpannerCommitTimestampRepository.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.cloud.Timestampget(TableId table)Returns the last seen commit timestamp for the given table.com.google.cloud.Timestampget(TableId table, com.google.cloud.spanner.Value shardValue)Returns the last seen commit timestamp for the given table and shard value.static SpannerCommitTimestampRepository.BuildernewBuilder(com.google.cloud.spanner.Spanner spanner, com.google.cloud.spanner.DatabaseId databaseId)voidset(TableId table, com.google.cloud.spanner.Value shardValue, com.google.cloud.Timestamp commitTimestamp)Sets the last seen commit timestamp for the given table and shard value.voidset(TableId table, com.google.cloud.Timestamp commitTimestamp)Sets the last seen commit timestamp for the given table.
-
-
-
Method Detail
-
newBuilder
public static SpannerCommitTimestampRepository.Builder newBuilder(com.google.cloud.spanner.Spanner spanner, com.google.cloud.spanner.DatabaseId databaseId)
-
get
public com.google.cloud.Timestamp get(TableId table)
Description copied from interface:CommitTimestampRepositoryReturns the last seen commit timestamp for the given table.- Specified by:
getin interfaceCommitTimestampRepository
-
get
public com.google.cloud.Timestamp get(TableId table, com.google.cloud.spanner.Value shardValue)
Description copied from interface:CommitTimestampRepositoryReturns the last seen commit timestamp for the given table and shard value. This method is optional and the default implementation will throwUnsupportedOperationException.- Specified by:
getin interfaceCommitTimestampRepository
-
set
public void set(TableId table, com.google.cloud.Timestamp commitTimestamp)
Description copied from interface:CommitTimestampRepositorySets the last seen commit timestamp for the given table.- Specified by:
setin interfaceCommitTimestampRepository
-
set
public void set(TableId table, com.google.cloud.spanner.Value shardValue, com.google.cloud.Timestamp commitTimestamp)
Description copied from interface:CommitTimestampRepositorySets the last seen commit timestamp for the given table and shard value. This method is optional and the default implementation will throwUnsupportedOperationException.- Specified by:
setin interfaceCommitTimestampRepository
-
-