Package cloud.google.com/go/spanner/test/cloudexecutor/executor/actions (v1.54.0)

Constants

None, Read, ReadWrite, Batch

const (
	None currentActiveTransaction = iota
	Read
	ReadWrite
	Batch
)

Current transaction status

AdminActionHandler

type AdminActionHandler struct {
	Action        *executorpb.AdminAction
	FlowContext   *ExecutionFlowContext
	OutcomeSender *outputstream.OutcomeSender
	Options       []option.ClientOption
}

AdminActionHandler holds the necessary components and options required for performing admin tasks.

func (*AdminActionHandler) ExecuteAction

func (h *AdminActionHandler) ExecuteAction(ctx context.Context) error

ExecuteAction execute admin actions by action case, using OutcomeSender to send status and results back.

BatchDmlHandler

type BatchDmlHandler struct {
	Action        *executorpb.BatchDmlAction
	FlowContext   *ExecutionFlowContext
	OutcomeSender *outputstream.OutcomeSender
}

BatchDmlHandler holds the necessary components required for BatchDmlAction.

func (*BatchDmlHandler) ExecuteAction

func (h *BatchDmlHandler) ExecuteAction(ctx context.Context) error

ExecuteAction that execute a BatchDml update action request, store the results in the OutcomeSender

CloseBatchTxnHandler

type CloseBatchTxnHandler struct {
	Action        *executorpb.CloseBatchTransactionAction
	FlowContext   *ExecutionFlowContext
	OutcomeSender *outputstream.OutcomeSender
}

CloseBatchTxnHandler holds the necessary components required for closing batch transaction.

func (*CloseBatchTxnHandler) ExecuteAction

func (h *CloseBatchTxnHandler) ExecuteAction(ctx context.Context) error

ExecuteAction that finishes a batch transaction

DmlActionHandler

type DmlActionHandler struct {
	Action        *executorpb.DmlAction
	FlowContext   *ExecutionFlowContext
	OutcomeSender *outputstream.OutcomeSender
}

DmlActionHandler holds the necessary components required for DML action.

func (*DmlActionHandler) ExecuteAction

func (h *DmlActionHandler) ExecuteAction(ctx context.Context) error

ExecuteAction executes a DML update action request, store the results in the outputstream.OutcomeSender.

ExecutePartition

type ExecutePartition struct {
	Action        *executorpb.ExecutePartitionAction
	FlowContext   *ExecutionFlowContext
	OutcomeSender *outputstream.OutcomeSender
}

ExecutePartition holds the necessary components required for executing partition.

func (*ExecutePartition) ExecuteAction

func (h *ExecutePartition) ExecuteAction(ctx context.Context) error

ExecuteAction executes a read or query for the given partitions.

ExecutionFlowContext

type ExecutionFlowContext struct {
	Database string // current database path

	TxnContext context.Context
	// contains filtered or unexported fields
}

ExecutionFlowContext represents a context in which SpannerActions are executed. Among other things, it includes currently active transactions and table metadata. There is exactly one instance of this per stubby call, created when the call is initialized and shared with all actionHandlers.

func (*ExecutionFlowContext) CloseOpenTransactions

func (c *ExecutionFlowContext) CloseOpenTransactions()

CloseOpenTransactions cleans up all the active transactions if the stubby call is closing.

func (*ExecutionFlowContext) IsTransactionActive

func (c *ExecutionFlowContext) IsTransactionActive() bool

IsTransactionActive returns true if any kind of transaction is currently active.

FinishTxnHandler

type FinishTxnHandler struct {
	Action        *executorpb.FinishTransactionAction
	FlowContext   *ExecutionFlowContext
	OutcomeSender *outputstream.OutcomeSender
}

FinishTxnHandler holds the necessary components and options required for finish transaction action.

func (*FinishTxnHandler) ExecuteAction

func (h *FinishTxnHandler) ExecuteAction(ctx context.Context) error

ExecuteAction that finish a transaction. For read-write transaction, either commit or abandon the transaction is allowed. Batch transaction is not supported here.

MutationActionHandler

type MutationActionHandler struct {
	Action        *executorpb.MutationAction
	FlowContext   *ExecutionFlowContext
	OutcomeSender *outputstream.OutcomeSender
}

MutationActionHandler holds the necessary components required for Mutation action.

func (*MutationActionHandler) ExecuteAction

func (h *MutationActionHandler) ExecuteAction(ctx context.Context) error

ExecuteAction that execute a Mutation action request.

PartitionQueryActionHandler

type PartitionQueryActionHandler struct {
	Action        *executorpb.GenerateDbPartitionsForQueryAction
	FlowContext   *ExecutionFlowContext
	OutcomeSender *outputstream.OutcomeSender
}

PartitionQueryActionHandler holds the necessary components required for performing partition query action.

func (*PartitionQueryActionHandler) ExecuteAction

func (h *PartitionQueryActionHandler) ExecuteAction(ctx context.Context) error

ExecuteAction executes action that generates database partitions for the given query.

PartitionReadActionHandler

type PartitionReadActionHandler struct {
	Action        *executorpb.GenerateDbPartitionsForReadAction
	FlowContext   *ExecutionFlowContext
	OutcomeSender *outputstream.OutcomeSender
}

PartitionReadActionHandler holds the necessary components required for performing partition read action.

func (*PartitionReadActionHandler) ExecuteAction

func (h *PartitionReadActionHandler) ExecuteAction(ctx context.Context) error

ExecuteAction executes action that generates database partitions for the given read.

PartitionedUpdate

type PartitionedUpdate struct {
	Action        *executorpb.PartitionedUpdateAction
	FlowContext   *ExecutionFlowContext
	OutcomeSender *outputstream.OutcomeSender
}

PartitionedUpdate holds the necessary components required for performing partitioned update.

func (*PartitionedUpdate) ExecuteAction

func (h *PartitionedUpdate) ExecuteAction(ctx context.Context) error

ExecuteAction executes a partitioned update which runs different partitions in parallel.

QueryActionHandler

type QueryActionHandler struct {
	Action        *executorpb.QueryAction
	FlowContext   *ExecutionFlowContext
	OutcomeSender *outputstream.OutcomeSender
}

QueryActionHandler holds the necessary components required for executorpb.QueryAction.

func (*QueryActionHandler) ExecuteAction

func (h *QueryActionHandler) ExecuteAction(ctx context.Context) error

ExecuteAction executes a query action request, store the results in the OutcomeSender.

ReadActionHandler

type ReadActionHandler struct {
	Action        *executorpb.ReadAction
	FlowContext   *ExecutionFlowContext
	OutcomeSender *outputstream.OutcomeSender
}

ReadActionHandler holds the necessary components required for executorpb.ReadAction.

func (*ReadActionHandler) ExecuteAction

func (h *ReadActionHandler) ExecuteAction(ctx context.Context) error

ExecuteAction executes a read action request, store the results in the OutcomeSender.

StartBatchTxnHandler

type StartBatchTxnHandler struct {
	Action        *executorpb.StartBatchTransactionAction
	FlowContext   *ExecutionFlowContext
	OutcomeSender *outputstream.OutcomeSender
	Options       []option.ClientOption
}

StartBatchTxnHandler holds the necessary components and options required for start batch transaction action.

func (*StartBatchTxnHandler) ExecuteAction

func (h *StartBatchTxnHandler) ExecuteAction(ctx context.Context) error

ExecuteAction that starts a batch transaction

StartTxnHandler

type StartTxnHandler struct {
	Action        *executorpb.StartTransactionAction
	FlowContext   *ExecutionFlowContext
	OutcomeSender *outputstream.OutcomeSender
	Options       []option.ClientOption
}

StartTxnHandler holds the necessary components and options required for start transaction action.

func (*StartTxnHandler) ExecuteAction

func (h *StartTxnHandler) ExecuteAction(ctx context.Context) error

ExecuteAction that starts a read-write or read-only transaction.

WriteActionHandler

type WriteActionHandler struct {
	Action        *executorpb.MutationAction
	FlowContext   *ExecutionFlowContext
	OutcomeSender *outputstream.OutcomeSender
}

WriteActionHandler holds the necessary components required for Write action.

func (*WriteActionHandler) ExecuteAction

func (h *WriteActionHandler) ExecuteAction(ctx context.Context) error

ExecuteAction that execute a Write action request.