Class CloudExecutor.OutcomeSender (6.82.0)

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.

Inheritance

java.lang.Object > CloudExecutor.OutcomeSender

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 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 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()
Returns
Type Description
boolean

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.

Parameters
Name Description
table String
index String

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.

Parameters
Name Description
table String
index String

sendOutcome(SpannerActionOutcome outcome)

public Status sendOutcome(SpannerActionOutcome outcome)

Send the given SpannerActionOutcome.

Parameter
Name Description
outcome SpannerActionOutcome
Returns
Type Description
io.grpc.Status

setRowType(StructType rowType)

public void setRowType(StructType rowType)

Set the rowType for appending row.

Parameter
Name Description
rowType StructType

setTimestamp(Timestamp timestamp)

public void setTimestamp(Timestamp timestamp)

Set the timestamp for commit.

Parameter
Name Description
timestamp Timestamp

updateChangeStreamRecordReceivedTimestamp(long changeStreamRecordReceivedTimestamp)

public void updateChangeStreamRecordReceivedTimestamp(long changeStreamRecordReceivedTimestamp)

Update change stream record timestamp.

Parameter
Name Description
changeStreamRecordReceivedTimestamp long