public class PartitionMetadataDao
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
PartitionMetadataDao.InTransactionContext
Represents the execution of a read / write transaction in Cloud Spanner.
|
static class |
PartitionMetadataDao.TransactionResult<T>
Represents a result from executing a Cloud Spanner read / write transaction.
|
Modifier and Type | Method and Description |
---|---|
com.google.cloud.spanner.Struct |
getPartition(java.lang.String partitionToken)
Fetches the partition metadata row data for the given partition token.
|
com.google.cloud.spanner.ResultSet |
getPartitionsInState(PartitionMetadata.State state)
Fetches all the partitions from the partition metadata table that are in the given state and
returns them ordered by the
PartitionMetadataAdminDao.COLUMN_START_TIMESTAMP column in
ascending order. |
com.google.cloud.Timestamp |
getUnfinishedMinWatermark()
Fetches the earliest partition watermark from the partition metadata table that is not in a
PartitionMetadata.State.FINISHED state. |
com.google.cloud.Timestamp |
insert(PartitionMetadata row)
Inserts the partition metadata.
|
<T> PartitionMetadataDao.TransactionResult<T> |
runInTransaction(java.util.function.Function<PartitionMetadataDao.InTransactionContext,T> callable)
Runs a given function in a transaction context.
|
com.google.cloud.Timestamp |
updateToFinished(java.lang.String partitionToken)
Updates a partition row to
PartitionMetadata.State.FINISHED state. |
com.google.cloud.Timestamp |
updateToRunning(java.lang.String partitionToken)
Updates a partition row to
PartitionMetadata.State.RUNNING state. |
com.google.cloud.Timestamp |
updateToScheduled(java.lang.String partitionToken)
Updates a partition row to
PartitionMetadata.State.SCHEDULED state. |
void |
updateWatermark(java.lang.String partitionToken,
com.google.cloud.Timestamp watermark)
Update the partition watermark to the given timestamp.
|
@Nullable public com.google.cloud.spanner.Struct getPartition(java.lang.String partitionToken)
partitionToken
- the partition unique identifierpublic com.google.cloud.spanner.ResultSet getPartitionsInState(PartitionMetadata.State state)
PartitionMetadataAdminDao.COLUMN_START_TIMESTAMP
column in
ascending order.state
- the PartitionMetadata.State
to fetch all the partitionsResultSet
with the partition rows fetched@Nullable public com.google.cloud.Timestamp getUnfinishedMinWatermark()
PartitionMetadata.State.FINISHED
state.PartitionMetadata.State.FINISHED
state.public com.google.cloud.Timestamp insert(PartitionMetadata row)
row
- the partition metadata to be insertedpublic com.google.cloud.Timestamp updateToScheduled(java.lang.String partitionToken)
PartitionMetadata.State.SCHEDULED
state.partitionToken
- the partition unique identifierpublic com.google.cloud.Timestamp updateToRunning(java.lang.String partitionToken)
PartitionMetadata.State.RUNNING
state.partitionToken
- the partition unique identifierpublic com.google.cloud.Timestamp updateToFinished(java.lang.String partitionToken)
PartitionMetadata.State.FINISHED
state.partitionToken
- the partition unique identifierpublic void updateWatermark(java.lang.String partitionToken, com.google.cloud.Timestamp watermark)
partitionToken
- the partition unique identifierwatermark
- the new partition watermarkpublic <T> PartitionMetadataDao.TransactionResult<T> runInTransaction(java.util.function.Function<PartitionMetadataDao.InTransactionContext,T> callable)
T
- the return type to be returned from the input transactional functioncallable
- the function to be executed within the transaction context