actions

package
v1.73.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	None currentActiveTransaction = iota
	Read
	ReadWrite
	Batch
)

Current transaction status

Variables

This section is empty.

Functions

This section is empty.

Types

type 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.

type 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

type 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

type 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.

type 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.

type ExecutionFlowContext

type ExecutionFlowContext struct {
	Database string // current database path

	DbClient *spanner.Client // Current database client

	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.

type 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.

type 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.

type 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.

type 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.

type 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.

type 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.

type 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.

type 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

type 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.

type 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL