public class CloudExecutor.OutcomeSender
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.
Constructors
OutcomeSender(int actionId, CloudClientExecutor.ExecutionFlowContext context)
public OutcomeSender(int actionId, CloudClientExecutor.ExecutionFlowContext context)
Parameters |
---|
Name | Description |
actionId | int
|
context | com.google.cloud.executor.spanner.CloudClientExecutor.ExecutionFlowContext
|
Methods
appendChangeStreamRecord(ChangeStreamRecord record)
public Status appendChangeStreamRecord(ChangeStreamRecord record)
Append change stream record to result.
Parameter |
---|
Name | Description |
record | com.google.spanner.executor.v1.ChangeStreamRecord
|
Returns |
---|
Type | Description |
io.grpc.Status | |
appendRow(ValueList row)
public Status appendRow(ValueList row)
Add another row to buffer. If buffer hits its size limit, buffered rows will be sent back.
Parameter |
---|
Name | Description |
row | com.google.spanner.executor.v1.ValueList
|
Returns |
---|
Type | Description |
io.grpc.Status | |
appendRowsModifiedInDml(Long rowsModified)
public void appendRowsModifiedInDml(Long rowsModified)
Add rows modified in DML to result.
Parameter |
---|
Name | Description |
rowsModified | Long
|
finishWithError(Status err)
public Status finishWithError(Status err)
Send the last outcome with given error status.
Parameter |
---|
Name | Description |
err | io.grpc.Status
|
Returns |
---|
Type | Description |
io.grpc.Status | |
finishWithOK()
public Status finishWithOK()
Send the last outcome with OK status.
Returns |
---|
Type | Description |
io.grpc.Status | |
finishWithTransactionRestarted()
public Status finishWithTransactionRestarted()
Send the last outcome with aborted error, this will set the transactionRestarted to true.
Returns |
---|
Type | Description |
io.grpc.Status | |
getChangeStreamHeartbeatMilliSeconds()
public long getChangeStreamHeartbeatMilliSeconds()
Returns |
---|
Type | Description |
long | |
getChangeStreamRecordReceivedTimestamp()
public long getChangeStreamRecordReceivedTimestamp()
Returns |
---|
Type | Description |
long | |
getIsPartitionedChangeStreamQuery()
public boolean getIsPartitionedChangeStreamQuery()
initForBatchRead(String table, String index)
public void initForBatchRead(String table, String index)
Init the sender for batch read action, then set the table and index if there exists.
initForChangeStreamQuery(long changeStreamHeartbeatMilliseconds, String changeStreamName, String partitionToken)
public void initForChangeStreamQuery(long changeStreamHeartbeatMilliseconds, String changeStreamName, String partitionToken)
Init the sender for change stream query action.
Parameters |
---|
Name | Description |
changeStreamHeartbeatMilliseconds | long
|
changeStreamName | String
|
partitionToken | String
|
initForQuery()
public void initForQuery()
Init the sender for query action.
initForRead(String table, String index)
public void initForRead(String table, String index)
Init the sender for read action, then set the table and index if there exists.
sendOutcome(SpannerActionOutcome outcome)
public Status sendOutcome(SpannerActionOutcome outcome)
Send the given SpannerActionOutcome.
Parameter |
---|
Name | Description |
outcome | com.google.spanner.executor.v1.SpannerActionOutcome
|
Returns |
---|
Type | Description |
io.grpc.Status | |
setRowType(StructType rowType)
public void setRowType(StructType rowType)
Set the rowType for appending row.
setTimestamp(Timestamp timestamp)
public void setTimestamp(Timestamp timestamp)
Set the timestamp for commit.
updateChangeStreamRecordReceivedTimestamp(long changeStreamRecordReceivedTimestamp)
public void updateChangeStreamRecordReceivedTimestamp(long changeStreamRecordReceivedTimestamp)
Update change stream record timestamp.
Parameter |
---|
Name | Description |
changeStreamRecordReceivedTimestamp | long
|