Class CloudExecutor.OutcomeSender
java.lang.Object
com.google.cloud.executor.spanner.CloudExecutor.OutcomeSender
- Enclosing class:
- CloudExecutor
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
ConstructorsConstructorDescriptionOutcomeSender(int actionId, com.google.cloud.executor.spanner.CloudClientExecutor.ExecutionFlowContext context) -
Method Summary
Modifier and TypeMethodDescriptionio.grpc.StatusAppend change stream record to result.io.grpc.StatusAdd another row to buffer.voidappendRowsModifiedInDml(Long rowsModified) Add rows modified in DML to result.io.grpc.StatusfinishWithError(io.grpc.Status err) Send the last outcome with given error status.io.grpc.StatusSend the last outcome with OK status.io.grpc.StatusSend the last outcome with aborted error, this will set the transactionRestarted to true.longlongbooleanvoidinitForBatchRead(String table, String index) Init the sender for batch read action, then set the table and index if there exists.voidinitForChangeStreamQuery(long changeStreamHeartbeatMilliseconds, String changeStreamName, String partitionToken) Init the sender for change stream query action.voidInit the sender for query action.voidinitForRead(String table, String index) Init the sender for read action, then set the table and index if there exists.io.grpc.StatussendOutcome(SpannerActionOutcome outcome) Send the given SpannerActionOutcome.voidsetRowType(StructType rowType) Set the rowType for appending row.voidsetTimestamp(com.google.protobuf.Timestamp timestamp) Set the timestamp for commit.voidupdateChangeStreamRecordReceivedTimestamp(long changeStreamRecordReceivedTimestamp) Update change stream record timestamp.
-
Constructor Details
-
OutcomeSender
public OutcomeSender(int actionId, com.google.cloud.executor.spanner.CloudClientExecutor.ExecutionFlowContext context)
-
-
Method Details
-
setTimestamp
public void setTimestamp(com.google.protobuf.Timestamp timestamp) Set the timestamp for commit. -
setRowType
Set the rowType for appending row. -
initForRead
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
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
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
Add another row to buffer. If buffer hits its size limit, buffered rows will be sent back. -
appendChangeStreamRecord
Append change stream record to result. -
sendOutcome
Send the given SpannerActionOutcome.
-