Class CloudExecutor.OutcomeSender
- java.lang.Object
-
- com.google.cloud.executor.spanner.CloudExecutor.OutcomeSender
-
- Enclosing class:
- CloudExecutor
public class CloudExecutor.OutcomeSender extends Object
OutcomeSender is a utility class used for sending action outcomes back to the client. For read actions, it buffers rows and sends partial read results in batches.
-
-
Constructor Summary
Constructors Constructor Description OutcomeSender(int actionId, com.google.cloud.executor.spanner.CloudClientExecutor.ExecutionFlowContext context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description io.grpc.Status
appendChangeStreamRecord(com.google.spanner.executor.v1.ChangeStreamRecord record)
Append change stream record to result.io.grpc.Status
appendRow(com.google.spanner.executor.v1.ValueList row)
Add another row to buffer.void
appendRowsModifiedInDml(Long rowsModified)
Add rows modified in DML to result.io.grpc.Status
finishWithError(io.grpc.Status err)
Send the last outcome with given error status.io.grpc.Status
finishWithOK()
Send the last outcome with OK status.io.grpc.Status
finishWithTransactionRestarted()
Send the last outcome with aborted error, this will set the transactionRestarted to true.long
getChangeStreamHeartbeatMilliSeconds()
long
getChangeStreamRecordReceivedTimestamp()
boolean
getIsPartitionedChangeStreamQuery()
void
initForBatchRead(String table, String index)
Init the sender for batch read action, then set the table and index if there exists.void
initForChangeStreamQuery(long changeStreamHeartbeatMilliseconds, String changeStreamName, String partitionToken)
Init the sender for change stream query action.void
initForQuery()
Init the sender for query action.void
initForRead(String table, String index)
Init the sender for read action, then set the table and index if there exists.io.grpc.Status
sendOutcome(com.google.spanner.executor.v1.SpannerActionOutcome outcome)
Send the given SpannerActionOutcome.void
setRowType(StructType rowType)
Set the rowType for appending row.void
setTimestamp(com.google.protobuf.Timestamp timestamp)
Set the timestamp for commit.void
updateChangeStreamRecordReceivedTimestamp(long changeStreamRecordReceivedTimestamp)
Update change stream record timestamp.
-
-
-
Method Detail
-
setTimestamp
public void setTimestamp(com.google.protobuf.Timestamp timestamp)
Set the timestamp for commit.
-
setRowType
public void setRowType(StructType rowType)
Set the rowType for appending row.
-
initForRead
public void initForRead(String table, String index)
Init the sender for read action, then set the table and index if there exists.
-
initForQuery
public void initForQuery()
Init the sender for query action.
-
initForBatchRead
public void initForBatchRead(String table, String index)
Init the sender for batch read action, then set the table and index if there exists.
-
initForChangeStreamQuery
public void initForChangeStreamQuery(long changeStreamHeartbeatMilliseconds, String changeStreamName, String partitionToken)
Init the sender for change stream query action.
-
updateChangeStreamRecordReceivedTimestamp
public void updateChangeStreamRecordReceivedTimestamp(long changeStreamRecordReceivedTimestamp)
Update change stream record timestamp.
-
appendRowsModifiedInDml
public void appendRowsModifiedInDml(Long rowsModified)
Add rows modified in DML to result.
-
getChangeStreamRecordReceivedTimestamp
public long getChangeStreamRecordReceivedTimestamp()
-
getChangeStreamHeartbeatMilliSeconds
public long getChangeStreamHeartbeatMilliSeconds()
-
getIsPartitionedChangeStreamQuery
public boolean getIsPartitionedChangeStreamQuery()
-
finishWithOK
public io.grpc.Status finishWithOK()
Send the last outcome with OK status.
-
finishWithTransactionRestarted
public io.grpc.Status finishWithTransactionRestarted()
Send the last outcome with aborted error, this will set the transactionRestarted to true.
-
finishWithError
public io.grpc.Status finishWithError(io.grpc.Status err)
Send the last outcome with given error status.
-
appendRow
public io.grpc.Status appendRow(com.google.spanner.executor.v1.ValueList row)
Add another row to buffer. If buffer hits its size limit, buffered rows will be sent back.
-
appendChangeStreamRecord
public io.grpc.Status appendChangeStreamRecord(com.google.spanner.executor.v1.ChangeStreamRecord record)
Append change stream record to result.
-
sendOutcome
public io.grpc.Status sendOutcome(com.google.spanner.executor.v1.SpannerActionOutcome outcome)
Send the given SpannerActionOutcome.
-
-