Class CloudExecutor.OutcomeSender (6.56.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
NameDescription
actionIdint
contextcom.google.cloud.executor.spanner.CloudClientExecutor.ExecutionFlowContext

Methods

appendChangeStreamRecord(ChangeStreamRecord record)

public Status appendChangeStreamRecord(ChangeStreamRecord record)

Append change stream record to result.

Parameter
NameDescription
recordChangeStreamRecord
Returns
TypeDescription
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
NameDescription
rowValueList
Returns
TypeDescription
io.grpc.Status

appendRowsModifiedInDml(Long rowsModified)

public void appendRowsModifiedInDml(Long rowsModified)

Add rows modified in DML to result.

Parameter
NameDescription
rowsModifiedLong

finishWithError(Status err)

public Status finishWithError(Status err)

Send the last outcome with given error status.

Parameter
NameDescription
errio.grpc.Status
Returns
TypeDescription
io.grpc.Status

finishWithOK()

public Status finishWithOK()

Send the last outcome with OK status.

Returns
TypeDescription
io.grpc.Status

finishWithTransactionRestarted()

public Status finishWithTransactionRestarted()

Send the last outcome with aborted error, this will set the transactionRestarted to true.

Returns
TypeDescription
io.grpc.Status

getChangeStreamHeartbeatMilliSeconds()

public long getChangeStreamHeartbeatMilliSeconds()
Returns
TypeDescription
long

getChangeStreamRecordReceivedTimestamp()

public long getChangeStreamRecordReceivedTimestamp()
Returns
TypeDescription
long

getIsPartitionedChangeStreamQuery()

public boolean getIsPartitionedChangeStreamQuery()
Returns
TypeDescription
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
NameDescription
tableString
indexString

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
NameDescription
changeStreamHeartbeatMillisecondslong
changeStreamNameString
partitionTokenString

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
NameDescription
tableString
indexString

sendOutcome(SpannerActionOutcome outcome)

public Status sendOutcome(SpannerActionOutcome outcome)

Send the given SpannerActionOutcome.

Parameter
NameDescription
outcomeSpannerActionOutcome
Returns
TypeDescription
io.grpc.Status

setRowType(StructType rowType)

public void setRowType(StructType rowType)

Set the rowType for appending row.

Parameter
NameDescription
rowTypeStructType

setTimestamp(Timestamp timestamp)

public void setTimestamp(Timestamp timestamp)

Set the timestamp for commit.

Parameter
NameDescription
timestampTimestamp

updateChangeStreamRecordReceivedTimestamp(long changeStreamRecordReceivedTimestamp)

public void updateChangeStreamRecordReceivedTimestamp(long changeStreamRecordReceivedTimestamp)

Update change stream record timestamp.

Parameter
NameDescription
changeStreamRecordReceivedTimestamplong