sqlplugin

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2021 License: MIT Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivityInfoMapsAllFilter added in v1.4.0

type ActivityInfoMapsAllFilter struct {
	ShardID     int32
	NamespaceID primitives.UUID
	WorkflowID  string
	RunID       primitives.UUID
}

type ActivityInfoMapsFilter

type ActivityInfoMapsFilter struct {
	ShardID     int32
	NamespaceID primitives.UUID
	WorkflowID  string
	RunID       primitives.UUID
	ScheduleIDs []int64
}

type ActivityInfoMapsRow

type ActivityInfoMapsRow struct {
	ShardID      int32
	NamespaceID  primitives.UUID
	WorkflowID   string
	RunID        primitives.UUID
	ScheduleID   int64
	Data         []byte
	DataEncoding string
}

ActivityInfoMapsRow represents a row in activity_info_maps table

type AdminCRUD added in v1.2.1

type AdminCRUD interface {
	CreateSchemaVersionTables() error
	ReadSchemaVersion(database string) (string, error)
	UpdateSchemaVersion(database string, newVersion string, minCompatibleVersion string) error
	WriteSchemaUpdateLog(oldVersion string, newVersion string, manifestMD5 string, desc string) error
	ListTables(database string) ([]string, error)
	DropTable(table string) error
	DropAllTables(database string) error
	CreateDatabase(database string) error
	DropDatabase(database string) error
	Exec(stmt string, args ...interface{}) error
}

AdminCRUD defines admin operations for CLI and test suites

type AdminDB

type AdminDB interface {
	AdminCRUD
	PluginName() string
	ExpectedVersion() string
	VerifyVersion() error
	Close() error
}

AdminDB defines the API for admin SQL operations for CLI and testing suites

type BufferedEventsFilter

type BufferedEventsFilter struct {
	ShardID     int32
	NamespaceID primitives.UUID
	WorkflowID  string
	RunID       primitives.UUID
}

BufferedEventsFilter contains the column names within buffered_events table that can be used to filter results through a WHERE clause

type BufferedEventsRow

type BufferedEventsRow struct {
	ShardID      int32
	NamespaceID  primitives.UUID
	WorkflowID   string
	RunID        primitives.UUID
	Data         []byte
	DataEncoding string
}

BufferedEventsRow represents a row in buffered_events table

type ChildExecutionInfoMapsAllFilter added in v1.4.0

type ChildExecutionInfoMapsAllFilter struct {
	ShardID     int32
	NamespaceID primitives.UUID
	WorkflowID  string
	RunID       primitives.UUID
}

type ChildExecutionInfoMapsFilter

type ChildExecutionInfoMapsFilter struct {
	ShardID      int32
	NamespaceID  primitives.UUID
	WorkflowID   string
	RunID        primitives.UUID
	InitiatedIDs []int64
}

type ChildExecutionInfoMapsRow

type ChildExecutionInfoMapsRow struct {
	ShardID      int32
	NamespaceID  primitives.UUID
	WorkflowID   string
	RunID        primitives.UUID
	InitiatedID  int64
	Data         []byte
	DataEncoding string
}

ChildExecutionInfoMapsRow represents a row in child_execution_info_maps table

type ClusterMembershipFilter

type ClusterMembershipFilter struct {
	RPCAddressEquals    string
	HostIDEquals        []byte
	HostIDGreaterThan   []byte
	RoleEquals          persistence.ServiceType
	LastHeartbeatAfter  time.Time
	RecordExpiryAfter   time.Time
	SessionStartedAfter time.Time
	MaxRecordCount      int
}

ClusterMembershipFilter is used for GetClusterMembership queries

type ClusterMembershipRow

type ClusterMembershipRow struct {
	Role           persistence.ServiceType
	HostID         []byte
	RPCAddress     string
	RPCPort        uint16
	SessionStart   time.Time
	LastHeartbeat  time.Time
	RecordExpiry   time.Time
	InsertionOrder uint64
}

ClusterMembershipRow represents a row in the cluster_membership table

type ClusterMetadata added in v1.2.1

type ClusterMetadata interface {
	SaveClusterMetadata(ctx context.Context, row *ClusterMetadataRow) (sql.Result, error)
	GetClusterMetadata(ctx context.Context) (*ClusterMetadataRow, error)
	WriteLockGetClusterMetadata(ctx context.Context) (*ClusterMetadataRow, error)
	GetClusterMembers(ctx context.Context, filter *ClusterMembershipFilter) ([]ClusterMembershipRow, error)
	UpsertClusterMembership(ctx context.Context, row *ClusterMembershipRow) (sql.Result, error)
	PruneClusterMembership(ctx context.Context, filter *PruneClusterMembershipFilter) (sql.Result, error)
}

ClusterMetadata is the SQL persistence interface for cluster metadata

type ClusterMetadataRow

type ClusterMetadataRow struct {
	Data         []byte
	DataEncoding string
	Version      int64
}

ClusterMetadataRow represents a row in the cluster_metadata table

type Conn

type Conn interface {
	Rebind(query string) string
	ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
	NamedExecContext(ctx context.Context, query string, arg interface{}) (sql.Result, error)
	GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
	SelectContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
}

Conn defines the API for a single database connection

type CurrentExecutionsFilter

type CurrentExecutionsFilter struct {
	ShardID     int32
	NamespaceID primitives.UUID
	WorkflowID  string
	RunID       primitives.UUID
}

CurrentExecutionsFilter contains the column names within current_executions table that can be used to filter results through a WHERE clause

type CurrentExecutionsRow

type CurrentExecutionsRow struct {
	ShardID          int32
	NamespaceID      primitives.UUID
	WorkflowID       string
	RunID            primitives.UUID
	CreateRequestID  string
	StartVersion     int64
	LastWriteVersion int64
	State            enumsspb.WorkflowExecutionState
	Status           enumspb.WorkflowExecutionStatus
}

CurrentExecutionsRow represents a row in current_executions table

type DB

type DB interface {
	TableCRUD

	BeginTx(ctx context.Context) (Tx, error)
	PluginName() string
	IsDupEntryError(err error) bool
	Close() error
}

DB defines the API for regular SQL operations of a Temporal server

type DbKind added in v1.5.7

type DbKind int
const (
	DbKindUnknown DbKind = iota
	DbKindMain
	DbKindVisibility
)

type ExecutionVersion added in v1.9.0

type ExecutionVersion struct {
	DBRecordVersion int64
	NextEventID     int64
}

TODO remove this block in 1.12.x

type ExecutionsFilter

type ExecutionsFilter struct {
	ShardID     int32
	NamespaceID primitives.UUID
	WorkflowID  string
	RunID       primitives.UUID
}

ExecutionsFilter contains the column names within executions table that can be used to filter results through a WHERE clause

type ExecutionsRow

type ExecutionsRow struct {
	ShardID          int32
	NamespaceID      primitives.UUID
	WorkflowID       string
	RunID            primitives.UUID
	NextEventID      int64
	LastWriteVersion int64
	Data             []byte
	DataEncoding     string
	State            []byte
	StateEncoding    string
	DBRecordVersion  int64
}

ExecutionsRow represents a row in executions table

type HistoryExecution added in v1.1.0

type HistoryExecution interface {
	InsertIntoExecutions(ctx context.Context, row *ExecutionsRow) (sql.Result, error)
	UpdateExecutions(ctx context.Context, row *ExecutionsRow) (sql.Result, error)
	SelectFromExecutions(ctx context.Context, filter ExecutionsFilter) (*ExecutionsRow, error)
	DeleteFromExecutions(ctx context.Context, filter ExecutionsFilter) (sql.Result, error)
	ReadLockExecutions(ctx context.Context, filter ExecutionsFilter) (int64, int64, error)
	WriteLockExecutions(ctx context.Context, filter ExecutionsFilter) (int64, int64, error)

	LockCurrentExecutionsJoinExecutions(ctx context.Context, filter CurrentExecutionsFilter) ([]CurrentExecutionsRow, error)

	InsertIntoCurrentExecutions(ctx context.Context, row *CurrentExecutionsRow) (sql.Result, error)
	UpdateCurrentExecutions(ctx context.Context, row *CurrentExecutionsRow) (sql.Result, error)
	// SelectFromCurrentExecutions returns one or more rows from current_executions table
	// Required params - {shardID, namespaceID, workflowID}
	SelectFromCurrentExecutions(ctx context.Context, filter CurrentExecutionsFilter) (*CurrentExecutionsRow, error)
	// DeleteFromCurrentExecutions deletes a single row that matches the filter criteria
	// If a row exist, that row will be deleted and this method will return success
	// If there is no row matching the filter criteria, this method will still return success
	// Callers can check the output of Result.RowsAffected() to see if a row was deleted or not
	// Required params - {shardID, namespaceID, workflowID, runID}
	DeleteFromCurrentExecutions(ctx context.Context, filter CurrentExecutionsFilter) (sql.Result, error)
	LockCurrentExecutions(ctx context.Context, filter CurrentExecutionsFilter) (*CurrentExecutionsRow, error)
}

HistoryExecution is the SQL persistence interface for history executions

type HistoryExecutionActivity added in v1.1.0

type HistoryExecutionActivity interface {
	// ReplaceIntoActivityInfoMaps replace one or more into activity_info_maps table
	ReplaceIntoActivityInfoMaps(ctx context.Context, rows []ActivityInfoMapsRow) (sql.Result, error)
	// SelectAllFromActivityInfoMaps returns all rows from activity_info_maps table
	SelectAllFromActivityInfoMaps(ctx context.Context, filter ActivityInfoMapsAllFilter) ([]ActivityInfoMapsRow, error)
	// DeleteFromActivityInfoMaps deletes one or more row from activity_info_maps table
	DeleteFromActivityInfoMaps(ctx context.Context, filter ActivityInfoMapsFilter) (sql.Result, error)
	// DeleteAllFromActivityInfoMaps deletes all from activity_info_maps table
	DeleteAllFromActivityInfoMaps(ctx context.Context, filter ActivityInfoMapsAllFilter) (sql.Result, error)
}

HistoryExecutionActivity is the SQL persistence interface for history nodes and history execution activities

type HistoryExecutionBuffer added in v1.1.0

type HistoryExecutionBuffer interface {
	InsertIntoBufferedEvents(ctx context.Context, rows []BufferedEventsRow) (sql.Result, error)
	SelectFromBufferedEvents(ctx context.Context, filter BufferedEventsFilter) ([]BufferedEventsRow, error)
	DeleteFromBufferedEvents(ctx context.Context, filter BufferedEventsFilter) (sql.Result, error)
}

HistoryExecutionBuffer is the SQL persistence interface for history nodes and history execution buffer events

type HistoryExecutionChildWorkflow added in v1.1.0

type HistoryExecutionChildWorkflow interface {
	// DeleteFromChildExecutionInfoMaps replace one or more rows into child_execution_info_maps table
	ReplaceIntoChildExecutionInfoMaps(ctx context.Context, rows []ChildExecutionInfoMapsRow) (sql.Result, error)
	// SelectAllFromChildExecutionInfoMaps returns all rows into child_execution_info_maps table
	SelectAllFromChildExecutionInfoMaps(ctx context.Context, filter ChildExecutionInfoMapsAllFilter) ([]ChildExecutionInfoMapsRow, error)
	// DeleteFromChildExecutionInfoMaps deletes one or more rows from child_execution_info_maps table
	DeleteFromChildExecutionInfoMaps(ctx context.Context, filter ChildExecutionInfoMapsFilter) (sql.Result, error)
	// DeleteAllFromChildExecutionInfoMaps deletes all rows from child_execution_info_maps table
	DeleteAllFromChildExecutionInfoMaps(ctx context.Context, filter ChildExecutionInfoMapsAllFilter) (sql.Result, error)
}

HistoryExecutionChildWorkflow is the SQL persistence interface for history execution child workflows

type HistoryExecutionRequestCancel added in v1.1.0

type HistoryExecutionRequestCancel interface {
	// ReplaceIntoRequestCancelInfoMaps replace one or more rows into request_cancel_info_maps table
	ReplaceIntoRequestCancelInfoMaps(ctx context.Context, rows []RequestCancelInfoMapsRow) (sql.Result, error)
	// SelectAllFromRequestCancelInfoMaps returns all rows from request_cancel_info_maps table
	SelectAllFromRequestCancelInfoMaps(ctx context.Context, filter RequestCancelInfoMapsAllFilter) ([]RequestCancelInfoMapsRow, error)
	// DeleteFromRequestCancelInfoMaps deletes one or more rows from request_cancel_info_maps table
	DeleteFromRequestCancelInfoMaps(ctx context.Context, filter RequestCancelInfoMapsFilter) (sql.Result, error)
	// DeleteAllFromRequestCancelInfoMaps deletes all rows from request_cancel_info_maps table
	DeleteAllFromRequestCancelInfoMaps(ctx context.Context, filter RequestCancelInfoMapsAllFilter) (sql.Result, error)
}

HistoryExecutionRequestCancel is the SQL persistence interface for history execution request cancels

type HistoryExecutionSignal added in v1.1.0

type HistoryExecutionSignal interface {
	// ReplaceIntoSignalInfoMaps replace one or more rows into signal_info_maps table
	ReplaceIntoSignalInfoMaps(ctx context.Context, rows []SignalInfoMapsRow) (sql.Result, error)
	// SelectAllFromSignalInfoMaps returns one or more rows from signal_info_maps table
	SelectAllFromSignalInfoMaps(ctx context.Context, filter SignalInfoMapsAllFilter) ([]SignalInfoMapsRow, error)
	// DeleteFromSignalInfoMaps deletes one or more rows from signal_info_maps table
	DeleteFromSignalInfoMaps(ctx context.Context, filter SignalInfoMapsFilter) (sql.Result, error)
	// DeleteFromSignalInfoMaps deletes one or more rows from signal_info_maps table
	DeleteAllFromSignalInfoMaps(ctx context.Context, filter SignalInfoMapsAllFilter) (sql.Result, error)
}

HistoryExecutionSignal is the SQL persistence interface for history execution signals

type HistoryExecutionSignalRequest added in v1.1.0

type HistoryExecutionSignalRequest interface {
	// ReplaceIntoSignalsRequestedSets replace one or more rows into signals_requested_sets table
	ReplaceIntoSignalsRequestedSets(ctx context.Context, rows []SignalsRequestedSetsRow) (sql.Result, error)
	// SelectAllFromSignalsRequestedSets returns all rows from signals_requested_sets table
	SelectAllFromSignalsRequestedSets(ctx context.Context, filter SignalsRequestedSetsAllFilter) ([]SignalsRequestedSetsRow, error)
	// DeleteFromSignalsRequestedSets deletes one or more rows from signals_requested_sets table
	DeleteFromSignalsRequestedSets(ctx context.Context, filter SignalsRequestedSetsFilter) (sql.Result, error)
	// DeleteAllFromSignalsRequestedSets deletes all rows from signals_requested_sets table
	DeleteAllFromSignalsRequestedSets(ctx context.Context, filter SignalsRequestedSetsAllFilter) (sql.Result, error)
}

HistoryExecutionSignalRequest is the SQL persistence interface for history execution signal request

type HistoryExecutionTimer added in v1.1.0

type HistoryExecutionTimer interface {
	// ReplaceIntoTimerInfoMaps replace one or more rows into timer_info_maps table
	ReplaceIntoTimerInfoMaps(ctx context.Context, rows []TimerInfoMapsRow) (sql.Result, error)
	// SelectAllFromTimerInfoMaps returns all rows from timer_info_maps table
	SelectAllFromTimerInfoMaps(ctx context.Context, filter TimerInfoMapsAllFilter) ([]TimerInfoMapsRow, error)
	// DeleteFromTimerInfoMaps deletes one or more rows from timer_info_maps table
	DeleteFromTimerInfoMaps(ctx context.Context, filter TimerInfoMapsFilter) (sql.Result, error)
	// DeleteAllFromTimerInfoMaps deletes all rows from timer_info_maps table
	DeleteAllFromTimerInfoMaps(ctx context.Context, filter TimerInfoMapsAllFilter) (sql.Result, error)
}

HistoryExecutionTimer is the SQL persistence interface for history execution timers

type HistoryNode added in v1.1.0

type HistoryNode interface {
	InsertIntoHistoryNode(ctx context.Context, row *HistoryNodeRow) (sql.Result, error)
	DeleteFromHistoryNode(ctx context.Context, row *HistoryNodeRow) (sql.Result, error)
	RangeSelectFromHistoryNode(ctx context.Context, filter HistoryNodeSelectFilter) ([]HistoryNodeRow, error)
	RangeDeleteFromHistoryNode(ctx context.Context, filter HistoryNodeDeleteFilter) (sql.Result, error)
}

HistoryNode is the SQL persistence interface for history nodes

type HistoryNodeDeleteFilter added in v1.1.0

type HistoryNodeDeleteFilter struct {
	ShardID   int32
	TreeID    primitives.UUID
	BranchID  primitives.UUID
	MinNodeID int64
}

HistoryNodeDeleteFilter contains the column names within history_node table that can be used to filter results through a WHERE clause

type HistoryNodeRow

type HistoryNodeRow struct {
	ShardID      int32
	TreeID       primitives.UUID
	BranchID     primitives.UUID
	NodeID       int64
	PrevTxnID    int64
	TxnID        int64
	Data         []byte
	DataEncoding string
}

HistoryNodeRow represents a row in history_node table

type HistoryNodeSelectFilter added in v1.1.0

type HistoryNodeSelectFilter struct {
	ShardID      int32
	TreeID       primitives.UUID
	BranchID     primitives.UUID
	MinNodeID    int64
	MinTxnID     int64
	MaxNodeID    int64
	PageSize     int
	MetadataOnly bool
}

HistoryNodeSelectFilter contains the column names within history_node table that can be used to filter results through a WHERE clause

type HistoryReplicationDLQTask added in v1.2.1

type HistoryReplicationDLQTask interface {
	// InsertIntoReplicationDLQTasks puts the replication task into DLQ
	InsertIntoReplicationDLQTasks(ctx context.Context, row []ReplicationDLQTasksRow) (sql.Result, error)
	// SelectFromReplicationDLQTasks returns one or more rows from replication_tasks_dlq table
	SelectFromReplicationDLQTasks(ctx context.Context, filter ReplicationDLQTasksFilter) ([]ReplicationDLQTasksRow, error)
	// RangeSelectFromReplicationDLQTasks returns one or more rows from replication_tasks_dlq table
	RangeSelectFromReplicationDLQTasks(ctx context.Context, filter ReplicationDLQTasksRangeFilter) ([]ReplicationDLQTasksRow, error)
	// DeleteFromReplicationDLQTasks deletes one row from replication_tasks_dlq table
	DeleteFromReplicationDLQTasks(ctx context.Context, filter ReplicationDLQTasksFilter) (sql.Result, error)
	// RangeDeleteFromReplicationDLQTasks deletes one or more rows from replication_tasks_dlq table
	//  ReplicationDLQTasksRangeFilter - {PageSize} will be ignored
	RangeDeleteFromReplicationDLQTasks(ctx context.Context, filter ReplicationDLQTasksRangeFilter) (sql.Result, error)
}

HistoryReplicationDLQTask is the SQL persistence interface for history replication tasks DLQ

type HistoryReplicationTask added in v1.1.0

type HistoryReplicationTask interface {
	InsertIntoReplicationTasks(ctx context.Context, rows []ReplicationTasksRow) (sql.Result, error)
	// SelectFromReplicationTasks returns one or more rows from replication_tasks table
	SelectFromReplicationTasks(ctx context.Context, filter ReplicationTasksFilter) ([]ReplicationTasksRow, error)
	// RangeSelectFromReplicationTasks returns one or more rows from replication_tasks table
	RangeSelectFromReplicationTasks(ctx context.Context, filter ReplicationTasksRangeFilter) ([]ReplicationTasksRow, error)
	// DeleteFromReplicationTasks deletes a row from replication_tasks table
	DeleteFromReplicationTasks(ctx context.Context, filter ReplicationTasksFilter) (sql.Result, error)
	// DeleteFromReplicationTasks deletes multi rows from replication_tasks table
	//  ReplicationTasksRangeFilter - {PageSize} will be ignored
	RangeDeleteFromReplicationTasks(ctx context.Context, filter ReplicationTasksRangeFilter) (sql.Result, error)
}

HistoryReplicationTask is the SQL persistence interface for history replication tasks

type HistoryShard added in v1.1.0

type HistoryShard interface {
	InsertIntoShards(ctx context.Context, rows *ShardsRow) (sql.Result, error)
	UpdateShards(ctx context.Context, row *ShardsRow) (sql.Result, error)
	SelectFromShards(ctx context.Context, filter ShardsFilter) (*ShardsRow, error)
	ReadLockShards(ctx context.Context, filter ShardsFilter) (int64, error)
	WriteLockShards(ctx context.Context, filter ShardsFilter) (int64, error)
}

HistoryShard is the SQL persistence interface for history shards

type HistoryTimerTask added in v1.1.0

type HistoryTimerTask interface {
	InsertIntoTimerTasks(ctx context.Context, rows []TimerTasksRow) (sql.Result, error)
	// SelectFromTimerTasks returns one or more rows from timer_tasks table
	SelectFromTimerTasks(ctx context.Context, filter TimerTasksFilter) ([]TimerTasksRow, error)
	// RangeSelectFromTimerTasks returns one or more rows from timer_tasks table
	RangeSelectFromTimerTasks(ctx context.Context, filter TimerTasksRangeFilter) ([]TimerTasksRow, error)
	// DeleteFromTimerTasks deletes one or more rows from timer_tasks table
	DeleteFromTimerTasks(ctx context.Context, filter TimerTasksFilter) (sql.Result, error)
	// RangeDeleteFromTimerTasks deletes one or more rows from timer_tasks table
	//  TimerTasksRangeFilter - {TaskID, PageSize} will be ignored
	RangeDeleteFromTimerTasks(ctx context.Context, filter TimerTasksRangeFilter) (sql.Result, error)
}

HistoryTimerTask is the SQL persistence interface for history timer tasks

type HistoryTransferTask added in v1.1.0

type HistoryTransferTask interface {
	InsertIntoTransferTasks(ctx context.Context, rows []TransferTasksRow) (sql.Result, error)
	// SelectFromTransferTasks returns rows that match filter criteria from transfer_tasks table.
	SelectFromTransferTasks(ctx context.Context, filter TransferTasksFilter) ([]TransferTasksRow, error)
	// RangeSelectFromTransferTasks returns rows that match filter criteria from transfer_tasks table.
	RangeSelectFromTransferTasks(ctx context.Context, filter TransferTasksRangeFilter) ([]TransferTasksRow, error)
	// DeleteFromTransferTasks deletes one rows from transfer_tasks table.
	DeleteFromTransferTasks(ctx context.Context, filter TransferTasksFilter) (sql.Result, error)
	// RangeDeleteFromTransferTasks deletes one or more rows from transfer_tasks table.
	RangeDeleteFromTransferTasks(ctx context.Context, filter TransferTasksRangeFilter) (sql.Result, error)
}

HistoryTransferTask is the SQL persistence interface for history transfer tasks

type HistoryTree added in v1.1.0

type HistoryTree interface {
	InsertIntoHistoryTree(ctx context.Context, row *HistoryTreeRow) (sql.Result, error)
	SelectFromHistoryTree(ctx context.Context, filter HistoryTreeSelectFilter) ([]HistoryTreeRow, error)
	DeleteFromHistoryTree(ctx context.Context, filter HistoryTreeDeleteFilter) (sql.Result, error)
}

HistoryNode is the SQL persistence interface for history trees

type HistoryTreeDeleteFilter added in v1.1.0

type HistoryTreeDeleteFilter struct {
	ShardID  int32
	TreeID   primitives.UUID
	BranchID primitives.UUID
}

HistoryTreeDeleteFilter contains the column names within history_tree table that can be used to filter results through a WHERE clause

type HistoryTreeRow

type HistoryTreeRow struct {
	ShardID      int32
	TreeID       primitives.UUID
	BranchID     primitives.UUID
	Data         []byte
	DataEncoding string
}

HistoryTreeRow represents a row in history_tree table

type HistoryTreeSelectFilter added in v1.1.0

type HistoryTreeSelectFilter struct {
	ShardID int32
	TreeID  primitives.UUID
}

HistoryTreeSelectFilter contains the column names within history_tree table that can be used to filter results through a WHERE clause

type HistoryVisibilityTask added in v1.5.0

type HistoryVisibilityTask interface {
	InsertIntoVisibilityTasks(ctx context.Context, rows []VisibilityTasksRow) (sql.Result, error)
	// SelectFromVisibilityTasks returns rows that match filter criteria from visibility_tasks table.
	SelectFromVisibilityTasks(ctx context.Context, filter VisibilityTasksFilter) ([]VisibilityTasksRow, error)
	// RangeSelectFromVisibilityTasks returns rows that match filter criteria from visibility_tasks table.
	RangeSelectFromVisibilityTasks(ctx context.Context, filter VisibilityTasksRangeFilter) ([]VisibilityTasksRow, error)
	// DeleteFromVisibilityTasks deletes one rows from visibility_tasks table.
	DeleteFromVisibilityTasks(ctx context.Context, filter VisibilityTasksFilter) (sql.Result, error)
	// RangeDeleteFromVisibilityTasks deletes one or more rows from visibility_tasks table.
	RangeDeleteFromVisibilityTasks(ctx context.Context, filter VisibilityTasksRangeFilter) (sql.Result, error)
}

HistoryVisibilityTask is the SQL persistence interface for history visibility tasks

type MatchingTask added in v1.1.0

type MatchingTask interface {
	InsertIntoTasks(ctx context.Context, rows []TasksRow) (sql.Result, error)
	// SelectFromTasks retrieves one or more rows from the tasks table
	// Required filter params - {namespaceID, taskqueueName, taskType, minTaskID, maxTaskID, pageSize}
	SelectFromTasks(ctx context.Context, filter TasksFilter) ([]TasksRow, error)
	// DeleteFromTasks deletes a row from tasks table
	// Required filter params:
	//  to delete single row
	//     - {namespaceID, taskqueueName, taskType, taskID}
	//  to delete multiple rows
	//    - {namespaceID, taskqueueName, taskType, taskIDLessThanEquals, limit }
	//    - this will delete upto limit number of tasks less than or equal to the given task id
	DeleteFromTasks(ctx context.Context, filter TasksFilter) (sql.Result, error)
}

MatchingTask is the SQL persistence interface for matching tasks

type MatchingTaskQueue added in v1.1.0

type MatchingTaskQueue interface {
	InsertIntoTaskQueues(ctx context.Context, row *TaskQueuesRow) (sql.Result, error)
	UpdateTaskQueues(ctx context.Context, row *TaskQueuesRow) (sql.Result, error)
	// SelectFromTaskQueues returns one or more rows from task_queues table
	// Required Filter params:
	//  to read a single row: {shardID, namespaceID, name, taskType}
	//  to range read multiple rows: {shardID, namespaceIDGreaterThan, nameGreaterThan, taskTypeGreaterThan, pageSize}
	SelectFromTaskQueues(ctx context.Context, filter TaskQueuesFilter) ([]TaskQueuesRow, error)
	DeleteFromTaskQueues(ctx context.Context, filter TaskQueuesFilter) (sql.Result, error)
	LockTaskQueues(ctx context.Context, filter TaskQueuesFilter) (int64, error)
}

MatchingTaskQueue is the SQL persistence interface for matching task queues

type Namespace added in v1.1.0

type Namespace interface {
	InsertIntoNamespace(ctx context.Context, rows *NamespaceRow) (sql.Result, error)
	UpdateNamespace(ctx context.Context, row *NamespaceRow) (sql.Result, error)
	// SelectFromNamespace returns namespaces that match filter criteria. Either ID or
	// Name can be specified to filter results. If both are not specified, all rows
	// will be returned
	SelectFromNamespace(ctx context.Context, filter NamespaceFilter) ([]NamespaceRow, error)
	// DeleteNamespace deletes a single row. One of ID or Name MUST be specified
	DeleteFromNamespace(ctx context.Context, filter NamespaceFilter) (sql.Result, error)

	LockNamespaceMetadata(ctx context.Context) (*NamespaceMetadataRow, error)
	UpdateNamespaceMetadata(ctx context.Context, row *NamespaceMetadataRow) (sql.Result, error)
	SelectFromNamespaceMetadata(ctx context.Context) (*NamespaceMetadataRow, error)
}

Namespace is the SQL persistence interface for namespaces

type NamespaceFilter

type NamespaceFilter struct {
	ID            *primitives.UUID
	Name          *string
	GreaterThanID *primitives.UUID
	PageSize      *int
}

NamespaceFilter contains the column names within namespace table that can be used to filter results through a WHERE clause. When ID is not nil, it will be used for WHERE condition. If ID is nil and Name is non-nil, Name will be used for WHERE condition. When both ID and Name are nil, no WHERE clause will be used

type NamespaceMetadataRow

type NamespaceMetadataRow struct {
	NotificationVersion int64
}

NamespaceMetadataRow represents a row in namespace_metadata table

type NamespaceRow

type NamespaceRow struct {
	ID                  primitives.UUID
	Name                string
	Data                []byte
	DataEncoding        string
	IsGlobal            bool
	NotificationVersion int64
}

NamespaceRow represents a row in namespace table

type Plugin

type Plugin interface {
	CreateDB(dbKind DbKind, cfg *config.SQL, r resolver.ServiceResolver) (DB, error)
	CreateAdminDB(dbKind DbKind, cfg *config.SQL, r resolver.ServiceResolver) (AdminDB, error)
}

Plugin defines the interface for any SQL database that needs to implement

type PruneClusterMembershipFilter

type PruneClusterMembershipFilter struct {
	PruneRecordsBefore time.Time
	MaxRecordsAffected int
}

PruneClusterMembershipFilter is used for PruneClusterMembership queries

type QueueMessage added in v1.3.0

type QueueMessage interface {
	InsertIntoMessages(ctx context.Context, row []QueueMessageRow) (sql.Result, error)
	SelectFromMessages(ctx context.Context, filter QueueMessagesFilter) ([]QueueMessageRow, error)
	RangeSelectFromMessages(ctx context.Context, filter QueueMessagesRangeFilter) ([]QueueMessageRow, error)
	DeleteFromMessages(ctx context.Context, filter QueueMessagesFilter) (sql.Result, error)
	RangeDeleteFromMessages(ctx context.Context, filter QueueMessagesRangeFilter) (sql.Result, error)

	GetLastEnqueuedMessageIDForUpdate(ctx context.Context, queueType persistence.QueueType) (int64, error)
}

type QueueMessageRow added in v1.4.0

type QueueMessageRow struct {
	QueueType       persistence.QueueType
	MessageID       int64
	MessagePayload  []byte
	MessageEncoding string
}

QueueMessageRow represents a row in queue table

type QueueMessagesFilter added in v1.3.0

type QueueMessagesFilter struct {
	QueueType persistence.QueueType
	MessageID int64
}

QueueMessagesFilter

type QueueMessagesRangeFilter added in v1.3.0

type QueueMessagesRangeFilter struct {
	QueueType    persistence.QueueType
	MinMessageID int64
	MaxMessageID int64
	PageSize     int
}

QueueMessagesRangeFilter

type QueueMetadata added in v1.4.0

type QueueMetadata interface {
	InsertIntoQueueMetadata(ctx context.Context, row *QueueMetadataRow) (sql.Result, error)
	UpdateQueueMetadata(ctx context.Context, row *QueueMetadataRow) (sql.Result, error)
	SelectFromQueueMetadata(ctx context.Context, filter QueueMetadataFilter) (*QueueMetadataRow, error)

	LockQueueMetadata(ctx context.Context, filter QueueMetadataFilter) (*QueueMetadataRow, error)
}

type QueueMetadataFilter added in v1.4.0

type QueueMetadataFilter struct {
	QueueType persistence.QueueType
}

type QueueMetadataRow

type QueueMetadataRow struct {
	QueueType    persistence.QueueType
	Data         []byte
	DataEncoding string
	Version      int64
}

QueueMetadataRow represents a row in queue_metadata table

type ReplicationDLQTasksFilter added in v1.2.1

type ReplicationDLQTasksFilter struct {
	ShardID           int32
	SourceClusterName string
	TaskID            int64
}

ReplicationDLQTasksFilter contains the column names within replication_tasks_dlq table that can be used to filter results through a WHERE clause

type ReplicationDLQTasksRangeFilter added in v1.2.1

type ReplicationDLQTasksRangeFilter struct {
	ShardID           int32
	SourceClusterName string
	MinTaskID         int64
	MaxTaskID         int64
	PageSize          int
}

ReplicationDLQTasksRangeFilter

type ReplicationDLQTasksRow added in v1.2.1

type ReplicationDLQTasksRow struct {
	SourceClusterName string
	ShardID           int32
	TaskID            int64
	Data              []byte
	DataEncoding      string
}

ReplicationDLQTasksRow represents a row in replication_tasks_dlq table

type ReplicationTasksFilter

type ReplicationTasksFilter struct {
	ShardID int32
	TaskID  int64
}

ReplicationTasksFilter contains the column names within replication_tasks table that can be used to filter results through a WHERE clause

type ReplicationTasksRangeFilter added in v1.2.1

type ReplicationTasksRangeFilter struct {
	ShardID   int32
	MinTaskID int64
	MaxTaskID int64
	PageSize  int
}

ReplicationTasksFilter contains the column names within replication_tasks table that can be used to filter results through a WHERE clause

type ReplicationTasksRow

type ReplicationTasksRow struct {
	ShardID      int32
	TaskID       int64
	Data         []byte
	DataEncoding string
}

ReplicationTasksRow represents a row in replication_tasks table

type RequestCancelInfoMapsAllFilter added in v1.4.0

type RequestCancelInfoMapsAllFilter struct {
	ShardID     int32
	NamespaceID primitives.UUID
	WorkflowID  string
	RunID       primitives.UUID
}

type RequestCancelInfoMapsFilter

type RequestCancelInfoMapsFilter struct {
	ShardID      int32
	NamespaceID  primitives.UUID
	WorkflowID   string
	RunID        primitives.UUID
	InitiatedIDs []int64
}

type RequestCancelInfoMapsRow

type RequestCancelInfoMapsRow struct {
	ShardID      int32
	NamespaceID  primitives.UUID
	WorkflowID   string
	RunID        primitives.UUID
	InitiatedID  int64
	Data         []byte
	DataEncoding string
}

RequestCancelInfoMapsRow represents a row in request_cancel_info_maps table

type ShardsFilter

type ShardsFilter struct {
	ShardID int32
}

ShardsFilter contains the column names within shards table that can be used to filter results through a WHERE clause

type ShardsRow

type ShardsRow struct {
	ShardID      int32
	RangeID      int64
	Data         []byte
	DataEncoding string
}

ShardsRow represents a row in shards table

type SignalInfoMapsAllFilter added in v1.4.0

type SignalInfoMapsAllFilter struct {
	ShardID     int32
	NamespaceID primitives.UUID
	WorkflowID  string
	RunID       primitives.UUID
}

type SignalInfoMapsFilter

type SignalInfoMapsFilter struct {
	ShardID      int32
	NamespaceID  primitives.UUID
	WorkflowID   string
	RunID        primitives.UUID
	InitiatedIDs []int64
}

type SignalInfoMapsRow

type SignalInfoMapsRow struct {
	ShardID      int32
	NamespaceID  primitives.UUID
	WorkflowID   string
	RunID        primitives.UUID
	InitiatedID  int64
	Data         []byte
	DataEncoding string
}

SignalInfoMapsRow represents a row in signal_info_maps table

type SignalsRequestedSetsAllFilter added in v1.4.0

type SignalsRequestedSetsAllFilter struct {
	ShardID     int32
	NamespaceID primitives.UUID
	WorkflowID  string
	RunID       primitives.UUID
}

type SignalsRequestedSetsFilter

type SignalsRequestedSetsFilter struct {
	ShardID     int32
	NamespaceID primitives.UUID
	WorkflowID  string
	RunID       primitives.UUID
	SignalIDs   []string
}

type SignalsRequestedSetsRow

type SignalsRequestedSetsRow struct {
	ShardID     int32
	NamespaceID primitives.UUID
	WorkflowID  string
	RunID       primitives.UUID
	SignalID    string
}

SignalsRequestedSetsRow represents a row in signals_requested_sets table

type TaskQueuesFilter

type TaskQueuesFilter struct {
	RangeHash                   uint32
	RangeHashGreaterThanEqualTo uint32
	RangeHashLessThanEqualTo    uint32
	TaskQueueID                 []byte
	TaskQueueIDGreaterThan      []byte
	RangeID                     *int64
	PageSize                    *int
}

TaskQueuesFilter contains the column names within task_queues table that can be used to filter results through a WHERE clause

type TaskQueuesRow

type TaskQueuesRow struct {
	RangeHash    uint32
	TaskQueueID  []byte
	RangeID      int64
	Data         []byte
	DataEncoding string
}

TaskQueuesRow represents a row in task_queues table

type TasksFilter

type TasksFilter struct {
	RangeHash            uint32
	TaskQueueID          []byte
	TaskID               *int64
	MinTaskID            *int64
	MaxTaskID            *int64
	TaskIDLessThanEquals *int64
	Limit                *int
	PageSize             *int
}

TasksFilter contains the column names within tasks table that can be used to filter results through a WHERE clause

type TasksRow

type TasksRow struct {
	RangeHash    uint32
	TaskQueueID  []byte
	TaskID       int64
	Data         []byte
	DataEncoding string
}

TasksRow represents a row in tasks table

type TimerInfoMapsAllFilter added in v1.4.0

type TimerInfoMapsAllFilter struct {
	ShardID     int32
	NamespaceID primitives.UUID
	WorkflowID  string
	RunID       primitives.UUID
}

type TimerInfoMapsFilter

type TimerInfoMapsFilter struct {
	ShardID     int32
	NamespaceID primitives.UUID
	WorkflowID  string
	RunID       primitives.UUID
	TimerIDs    []string
}

type TimerInfoMapsRow

type TimerInfoMapsRow struct {
	ShardID      int32
	NamespaceID  primitives.UUID
	WorkflowID   string
	RunID        primitives.UUID
	TimerID      string
	Data         []byte
	DataEncoding string
}

TimerInfoMapsRow represents a row in timer_info_maps table

type TimerTasksFilter

type TimerTasksFilter struct {
	ShardID             int32
	TaskID              int64
	VisibilityTimestamp time.Time
}

TimerTasksFilter contains the column names within timer_tasks table that can be used to filter results through a WHERE clause

type TimerTasksRangeFilter added in v1.1.0

type TimerTasksRangeFilter struct {
	ShardID                int32
	TaskID                 int64
	MinVisibilityTimestamp time.Time
	MaxVisibilityTimestamp time.Time
	PageSize               int
}

TimerTasksFilter contains the column names within timer_tasks table that can be used to filter results through a WHERE clause

type TimerTasksRow

type TimerTasksRow struct {
	ShardID             int32
	VisibilityTimestamp time.Time
	TaskID              int64
	Data                []byte
	DataEncoding        string
}

TimerTasksRow represents a row in timer_tasks table

type TransferTasksFilter

type TransferTasksFilter struct {
	ShardID int32
	TaskID  int64
}

TransferTasksFilter contains the column names within transfer_tasks table that can be used to filter results through a WHERE clause

type TransferTasksRangeFilter added in v1.1.0

type TransferTasksRangeFilter struct {
	ShardID   int32
	MinTaskID int64
	MaxTaskID int64
}

TransferTasksRangeFilter contains the column names within transfer_tasks table that can be used to filter results through a WHERE clause

type TransferTasksRow

type TransferTasksRow struct {
	ShardID      int32
	TaskID       int64
	Data         []byte
	DataEncoding string
}

TransferTasksRow represents a row in transfer_tasks table

type Tx

type Tx interface {
	TableCRUD
	Commit() error
	Rollback() error
}

Tx defines the API for a SQL transaction

type Visibility added in v1.1.0

type Visibility interface {
	// InsertIntoVisibility inserts a row into visibility table. If a row already exist,
	// no changes will be made by this API
	InsertIntoVisibility(ctx context.Context, row *VisibilityRow) (sql.Result, error)
	// ReplaceIntoVisibility deletes old row (if it exist) and inserts new row into visibility table
	ReplaceIntoVisibility(ctx context.Context, row *VisibilityRow) (sql.Result, error)
	// SelectFromVisibility returns one or more rows from visibility table
	// Required filter params:
	// - getClosedWorkflowExecution - retrieves single row - {namespaceID, runID, closed=true}
	// - All other queries retrieve multiple rows (range):
	//   - MUST specify following required params:
	//     - namespaceID, minStartTime, maxStartTime, runID and pageSize where some or all of these may come from previous page token
	//   - OPTIONALLY specify one of following params
	//     - workflowID, workflowTypeName, status (along with closed=true)
	SelectFromVisibility(ctx context.Context, filter VisibilitySelectFilter) ([]VisibilityRow, error)
	DeleteFromVisibility(ctx context.Context, filter VisibilityDeleteFilter) (sql.Result, error)
}

type VisibilityDeleteFilter added in v1.1.0

type VisibilityDeleteFilter struct {
	NamespaceID string
	RunID       string
}

type VisibilityRow

type VisibilityRow struct {
	NamespaceID      string
	RunID            string
	WorkflowTypeName string
	WorkflowID       string
	StartTime        time.Time
	ExecutionTime    time.Time
	Status           int32
	CloseTime        *time.Time
	HistoryLength    *int64
	Memo             []byte
	Encoding         string
}

VisibilityRow represents a row in executions_visibility table

type VisibilitySelectFilter added in v1.1.0

type VisibilitySelectFilter struct {
	NamespaceID      string
	RunID            *string
	WorkflowID       *string
	WorkflowTypeName *string
	Status           int32
	MinTime          *time.Time
	MaxTime          *time.Time
	PageSize         *int
}

VisibilitySelectFilter contains the column names within executions_visibility table that can be used to filter results through a WHERE clause

type VisibilityTasksFilter added in v1.5.0

type VisibilityTasksFilter struct {
	ShardID int32
	TaskID  int64
}

VisibilityTasksFilter contains the column names within visibility_tasks table that can be used to filter results through a WHERE clause

type VisibilityTasksRangeFilter added in v1.5.0

type VisibilityTasksRangeFilter struct {
	ShardID   int32
	MinTaskID int64
	MaxTaskID int64
}

VisibilityTasksRangeFilter contains the column names within visibility_tasks table that can be used to filter results through a WHERE clause

type VisibilityTasksRow added in v1.5.0

type VisibilityTasksRow struct {
	ShardID      int32
	TaskID       int64
	Data         []byte
	DataEncoding string
}

VisibilityTasksRow represents a row in visibility_tasks table

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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