Package com.google.cloud.spanner.watcher
Interface ShardProvider
-
- All Known Implementing Classes:
FixedShardProvider,TimebasedShardProvider
public interface ShardProviderInterface for providing a shard id for Spanner Table Change watchers. The shard id will be used by the change watcher when querying the table for the most recent changes. This can be used to prevent full table scans when polling a table.See https://cloud.google.com/spanner/docs/schema-design#fix_hash_the_key for more information on how logical shards should be implemented in Cloud Spanner.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidappendShardFilter(com.google.cloud.spanner.Statement.Builder statementBuilder)Appends the required sharding filter to the given statement.com.google.cloud.spanner.ValuegetShardValue()Returns the (fixed) value that is used by thisShardProvider.
-
-
-
Method Detail
-
appendShardFilter
void appendShardFilter(com.google.cloud.spanner.Statement.Builder statementBuilder)
Appends the required sharding filter to the given statement. This could be an SQL fragment or one or more parameters or a combination of both.
-
getShardValue
@Nullable com.google.cloud.spanner.Value getShardValue()
Returns the (fixed) value that is used by thisShardProvider. This value will be passed to theCommitTimestampRepositoryto indicate the last seen commit timestamp for a certain shard. This value will benullif theShardProviderdoes not use a fixed value.
-
-