Class 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 Detail

      • OutcomeSender

        public OutcomeSender​(int actionId,
                             com.google.cloud.executor.spanner.CloudClientExecutor.ExecutionFlowContext context)
    • 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.