public final class TimebasedShardProvider extends Object implements ShardProvider
ShardProvider that generates a ShardId based on the current
system time of Cloud Spanner. The generated shard id groups a set of commit timestamps together.
The TimebasedShardProvider can only be used when all clients that write to the tables
that are being watched update the shard column with the most recent shard id for each update that
is written to the tables.for an
example on how to use this {@link ShardProvider}.| Modifier and Type | Class and Description |
|---|---|
static class |
TimebasedShardProvider.Interval |
static class |
TimebasedShardProvider.TimebasedShardId
A generated timebased shard id that has been fetched from Cloud Spanner.
|
| Modifier and Type | Method and Description |
|---|---|
void |
appendShardFilter(com.google.cloud.spanner.Statement.Builder statement)
Appends the required sharding filter to the given statement.
|
static TimebasedShardProvider |
create(String column,
TimebasedShardProvider.Interval interval)
Creates a
TimebasedShardProvider for the given database column and interval. |
com.google.cloud.spanner.Value |
getShardValue()
Returns the (fixed) value that is used by this
ShardProvider. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetColumnNamepublic static TimebasedShardProvider create(String column, TimebasedShardProvider.Interval interval)
TimebasedShardProvider for the given database column and interval.public void appendShardFilter(com.google.cloud.spanner.Statement.Builder statement)
ShardProviderappendShardFilter in interface ShardProvider@Nullable public com.google.cloud.spanner.Value getShardValue()
ShardProviderShardProvider. This value will be passed
to the CommitTimestampRepository to indicate the last seen commit timestamp for a
certain shard. This value will be null if the ShardProvider does not use a
fixed value.getShardValue in interface ShardProviderCopyright © 2022 Google LLC. All rights reserved.