sqlplugin

package
v1.29.0-139.3 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2025 License: MIT Imports: 27 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidKeywordListDataType = errors.New("Unexpected data type in keyword list")
	VersionColumnName             = "_version"
)
View Source
var (
	DatabaseUnavailableError = serviceerror.NewUnavailable("no usable database connection found")
)
View Source
var DbFields = getDbFields()

Functions

func BuildNamedPlaceholder added in v1.20.0

func BuildNamedPlaceholder(fields ...string) string

func GenerateSelectQuery added in v1.20.0

func GenerateSelectQuery(
	filter *VisibilitySelectFilter,
	convertToDbDateTime func(time.Time) time.Time,
) error

TODO (rodrigozhou): deprecate with standard visibility code. GenerateSelectQuery generates the SELECT query based on the fields of VisibilitySelectFilter for backward compatibility of any use case using old format (eg: unit test). It will be removed after all use cases change to use query converter.

func SwitchTaskQueuesTable added in v1.29.0

func SwitchTaskQueuesTable(baseQuery string, v MatchingTaskVersion) string

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 AddToBuildIdToTaskQueueMapping added in v1.21.0

type AddToBuildIdToTaskQueueMapping struct {
	NamespaceID   []byte
	TaskQueueName string
	BuildIds      []string
}

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
	GenericDB
	ExpectedVersion() string
	VerifyVersion() 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 ChasmNodeMapsAllFilter added in v1.28.0

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

ChasmNodeMapsAllFilter represents parameters to selecting all of a workflow's CHASM nodes.

type ChasmNodeMapsFilter added in v1.28.0

type ChasmNodeMapsFilter struct {
	ShardID     int32
	NamespaceID primitives.UUID
	WorkflowID  string
	RunID       primitives.UUID
	ChasmPaths  []string
}

ChasmNodeMapsFilter represents parameters to selecting a particular subset of a workflow's CHASM nodes.

type ChasmNodeMapsRow added in v1.28.0

type ChasmNodeMapsRow struct {
	ShardID          int32
	NamespaceID      primitives.UUID
	WorkflowID       string
	RunID            primitives.UUID
	ChasmPath        string
	Metadata         []byte
	MetadataEncoding string
	Data             []byte
	DataEncoding     string
}

ChasmNodeMapsRow represents a row in the chasm_node_maps 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, filter *ClusterMetadataFilter) (*ClusterMetadataRow, error)
	ListClusterMetadata(ctx context.Context, filter *ClusterMetadataFilter) ([]ClusterMetadataRow, error)
	DeleteClusterMetadata(ctx context.Context, filter *ClusterMetadataFilter) (sql.Result, error)
	WriteLockGetClusterMetadata(ctx context.Context, filter *ClusterMetadataFilter) (*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 ClusterMetadataFilter added in v1.14.0

type ClusterMetadataFilter struct {
	ClusterName string
	PageSize    *int
}

type ClusterMetadataRow

type ClusterMetadataRow struct {
	ClusterName  string
	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
	PrepareNamedContext(ctx context.Context, query string) (*sqlx.NamedStmt, error)
}

Conn defines the API for a single database connection

type CountTaskQueuesByBuildIdRequest added in v1.21.0

type CountTaskQueuesByBuildIdRequest struct {
	NamespaceID []byte
	BuildID     string
}

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
	StartTime        *time.Time
	LastWriteVersion int64
	State            enumsspb.WorkflowExecutionState
	Status           enumspb.WorkflowExecutionStatus
	Data             []byte
	DataEncoding     string
}

CurrentExecutionsRow represents a row in current_executions table

type DB

type DB interface {
	TableCRUD
	GenericDB
	BeginTx(ctx context.Context) (Tx, error)
	IsDupEntryError(err error) bool
}

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

type DatabaseHandle added in v1.25.0

type DatabaseHandle struct {

	// Ensures only one refresh call happens at a time
	sync.Mutex
	// contains filtered or unexported fields
}

func NewDatabaseHandle added in v1.25.0

func NewDatabaseHandle(
	connect func() (*sqlx.DB, error),
	needsRefresh func(error) bool,
	logger log.Logger,
	metricsHandler metrics.Handler,
	timeSource clock.TimeSource,
) *DatabaseHandle

func (*DatabaseHandle) Close added in v1.25.0

func (h *DatabaseHandle) Close()

func (*DatabaseHandle) Conn added in v1.25.0

func (h *DatabaseHandle) Conn() Conn

func (*DatabaseHandle) ConvertError added in v1.25.0

func (h *DatabaseHandle) ConvertError(err error) error

func (*DatabaseHandle) DB added in v1.25.0

func (h *DatabaseHandle) DB() (*sqlx.DB, error)

type DbKind added in v1.5.7

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

func (DbKind) String added in v1.24.0

func (k DbKind) String() string

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 FairLevel added in v1.29.0

type FairLevel struct {
	TaskPass int64
	TaskID   int64
}

type GenericDB added in v1.28.0

type GenericDB interface {
	DbName() string
	PluginName() string
	Close() error
}

type GetTaskQueueUserDataRequest added in v1.21.0

type GetTaskQueueUserDataRequest struct {
	NamespaceID   []byte
	TaskQueueName string
}

type GetTaskQueuesByBuildIdRequest added in v1.21.0

type GetTaskQueuesByBuildIdRequest struct {
	NamespaceID []byte
	BuildID     string
}

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 HistoryExecutionChasm added in v1.28.0

type HistoryExecutionChasm interface {
	// SelectAllFromChasmNodeMaps returns all rows related to a particular workflow from the chasm_node_maps table.
	SelectAllFromChasmNodeMaps(ctx context.Context, filter ChasmNodeMapsAllFilter) ([]ChasmNodeMapsRow, error)

	// ReplaceIntoChasmNodeMaps replaces one or more rows in the chasm_node_maps table.
	ReplaceIntoChasmNodeMaps(ctx context.Context, rows []ChasmNodeMapsRow) (sql.Result, error)

	// DeleteFromChasmNodeMaps deletes one or more rows in the chasm_node_maps table.
	DeleteFromChasmNodeMaps(ctx context.Context, filter ChasmNodeMapsFilter) (sql.Result, error)

	// DeleteAllFromChasmNodeMaps deletes all rows related to a particular workflow in the chasm_node_maps table.
	DeleteAllFromChasmNodeMaps(ctx context.Context, filter ChasmNodeMapsAllFilter) (sql.Result, error)
}

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 HistoryImmediateTask added in v1.19.0

type HistoryImmediateTask interface {
	// InsertIntoHistoryImmediateTasks inserts rows that into history_immediate_tasks table.
	InsertIntoHistoryImmediateTasks(ctx context.Context, rows []HistoryImmediateTasksRow) (sql.Result, error)
	// RangeSelectFromHistoryImmediateTasks returns rows that match filter criteria from history_immediate_tasks table.
	RangeSelectFromHistoryImmediateTasks(ctx context.Context, filter HistoryImmediateTasksRangeFilter) ([]HistoryImmediateTasksRow, error)
	// DeleteFromHistoryImmediateTasks deletes one rows from history_immediate_tasks table.
	DeleteFromHistoryImmediateTasks(ctx context.Context, filter HistoryImmediateTasksFilter) (sql.Result, error)
	// RangeDeleteFromHistoryImmediateTasks deletes one or more rows from history_immediate_tasks table.
	//  HistoryImmediateTasksRangeFilter - {PageSize} will be ignored
	RangeDeleteFromHistoryImmediateTasks(ctx context.Context, filter HistoryImmediateTasksRangeFilter) (sql.Result, error)
}

HistoryImmediateTask is the SQL persistence interface for history immediate tasks

type HistoryImmediateTasksFilter added in v1.19.0

type HistoryImmediateTasksFilter struct {
	ShardID    int32
	CategoryID int32
	TaskID     int64
}

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

type HistoryImmediateTasksRangeFilter added in v1.19.0

type HistoryImmediateTasksRangeFilter struct {
	ShardID            int32
	CategoryID         int32
	InclusiveMinTaskID int64
	ExclusiveMaxTaskID int64
	PageSize           int
}

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

type HistoryImmediateTasksRow added in v1.19.0

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

HistoryImmediateTasksRow represents a row in history_immediate_tasks table

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
	MaxTxnID     int64
	PageSize     int
	MetadataOnly bool
	ReverseOrder 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)
	// 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 inserts rows that into replication_tasks table.
	InsertIntoReplicationTasks(ctx context.Context, rows []ReplicationTasksRow) (sql.Result, 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 HistoryScheduledTask added in v1.19.0

type HistoryScheduledTask interface {
	// InsertIntoHistoryScheduledTasks inserts rows that into history_scheduled_tasks table.
	InsertIntoHistoryScheduledTasks(ctx context.Context, rows []HistoryScheduledTasksRow) (sql.Result, error)
	// RangeSelectFromScheduledTasks returns one or more rows from history_scheduled_tasks table
	RangeSelectFromHistoryScheduledTasks(ctx context.Context, filter HistoryScheduledTasksRangeFilter) ([]HistoryScheduledTasksRow, error)
	// DeleteFromScheduledTasks deletes one or more rows from history_scheduled_tasks table
	DeleteFromHistoryScheduledTasks(ctx context.Context, filter HistoryScheduledTasksFilter) (sql.Result, error)
	// RangeDeleteFromScheduledTasks deletes one or more rows from history_scheduled_tasks table
	//  ScheduledTasksRangeFilter - {TaskID, PageSize} will be ignored
	RangeDeleteFromHistoryScheduledTasks(ctx context.Context, filter HistoryScheduledTasksRangeFilter) (sql.Result, error)
}

HistoryScheduledTask is the SQL persistence interface for history scheduled tasks

type HistoryScheduledTasksFilter added in v1.19.0

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

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

type HistoryScheduledTasksRangeFilter added in v1.19.0

type HistoryScheduledTasksRangeFilter struct {
	ShardID                         int32
	CategoryID                      int32
	InclusiveMinTaskID              int64
	InclusiveMinVisibilityTimestamp time.Time
	ExclusiveMaxVisibilityTimestamp time.Time
	PageSize                        int
}

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

type HistoryScheduledTasksRow added in v1.19.0

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

HistoryScheduledTasksRow represents a row in history_scheduled_tasks table

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 inserts rows that into timer_tasks table.
	InsertIntoTimerTasks(ctx context.Context, rows []TimerTasksRow) (sql.Result, 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 inserts rows that into transfer_tasks table.
	InsertIntoTransferTasks(ctx context.Context, rows []TransferTasksRow) (sql.Result, 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.
	//  TransferTasksRangeFilter - {PageSize} will be ignored
	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)
	PaginateBranchesFromHistoryTree(ctx context.Context, filter HistoryTreeBranchPage) ([]HistoryTreeRow, error)
}

HistoryTree is the SQL persistence interface for history trees

type HistoryTreeBranchPage added in v1.18.2

type HistoryTreeBranchPage struct {
	ShardID  int32
	TreeID   primitives.UUID
	BranchID primitives.UUID
	Limit    int
}

HistoryTreeBranchPage is a struct which represents a page of history tree branches to query.

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 inserts rows that into visibility_tasks table.
	InsertIntoVisibilityTasks(ctx context.Context, rows []VisibilityTasksRow) (sql.Result, 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.
	//  VisibilityTasksRangeFilter - {PageSize} will be ignored
	RangeDeleteFromVisibilityTasks(ctx context.Context, filter VisibilityTasksRangeFilter) (sql.Result, error)
}

HistoryVisibilityTask is the SQL persistence interface for history visibility tasks

type ListNexusEndpointsRequest added in v1.25.0

type ListNexusEndpointsRequest struct {
	LastID []byte
	Limit  int
}

type ListTaskQueueUserDataEntriesRequest added in v1.21.0

type ListTaskQueueUserDataEntriesRequest struct {
	NamespaceID       []byte
	LastTaskQueueName string
	Limit             int
}

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, inclusiveMinTaskID, exclusiveMaxTaskID, pageSize}
	SelectFromTasks(ctx context.Context, filter TasksFilter) ([]TasksRow, error)
	// DeleteFromTasks deletes multiple rows from tasks table
	// Required filter params:
	//    - {namespaceID, taskqueueName, taskType, exclusiveMaxTaskID, limit }
	//    - this will delete upto limit number of tasks less than the given max task id
	DeleteFromTasks(ctx context.Context, filter TasksFilter) (sql.Result, error)
}

MatchingTask is the SQL persistence interface for v1 matching tasks

type MatchingTaskQueue added in v1.1.0

type MatchingTaskQueue interface {
	InsertIntoTaskQueues(ctx context.Context, row *TaskQueuesRow, v MatchingTaskVersion) (sql.Result, error)
	UpdateTaskQueues(ctx context.Context, row *TaskQueuesRow, v MatchingTaskVersion) (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, v MatchingTaskVersion) ([]TaskQueuesRow, error)
	DeleteFromTaskQueues(ctx context.Context, filter TaskQueuesFilter, v MatchingTaskVersion) (sql.Result, error)
	LockTaskQueues(ctx context.Context, filter TaskQueuesFilter, v MatchingTaskVersion) (int64, error)
}

MatchingTaskQueue is the SQL persistence interface for matching task queues. This handles both "v1" and "v2" tables so that we don't have to duplicate as much code.

type MatchingTaskQueueUserData added in v1.29.0

type MatchingTaskQueueUserData interface {
	GetTaskQueueUserData(ctx context.Context, request *GetTaskQueueUserDataRequest) (*VersionedBlob, error)
	UpdateTaskQueueUserData(ctx context.Context, request *UpdateTaskQueueDataRequest) error
	ListTaskQueueUserDataEntries(ctx context.Context, request *ListTaskQueueUserDataEntriesRequest) ([]TaskQueueUserDataEntry, error)

	AddToBuildIdToTaskQueueMapping(ctx context.Context, request AddToBuildIdToTaskQueueMapping) error
	RemoveFromBuildIdToTaskQueueMapping(ctx context.Context, request RemoveFromBuildIdToTaskQueueMapping) error
	GetTaskQueuesByBuildId(ctx context.Context, request *GetTaskQueuesByBuildIdRequest) ([]string, error)
	CountTaskQueuesByBuildId(ctx context.Context, request *CountTaskQueuesByBuildIdRequest) (int, error)
}

type MatchingTaskV2 added in v1.29.0

type MatchingTaskV2 interface {
	// InsertIntoTasksV2 inserts one or more rows into tasks_v2 table for matching fairness
	InsertIntoTasksV2(ctx context.Context, rows []TasksRowV2) (sql.Result, error)
	// SelectFromTasks retrieves one or more rows from the tasks_v2 table
	// Required filter params - {RangeHash, TaskQueueID, InclusiveMinLevel, PageSize}
	// Returns tasks where the (pass, task_id) tuple is greater than or equal to the provided values,
	// effectively filtering tasks that are at or beyond a specific fairness pass and task ID boundary.
	SelectFromTasksV2(ctx context.Context, filter TasksFilterV2) ([]TasksRowV2, error)
	// DeleteFromTasks deletes multiple rows from tasks table
	// Required filter params:
	//    - {RangeHash, TaskQueueID, ExclusiveMaxLevel, Limit}
	//    - this will delete upto limit number of tasks less than the given max task id
	DeleteFromTasksV2(ctx context.Context, filter TasksFilterV2) (sql.Result, error)
}

MatchingTaskV2 is the SQL persistence interface for v2 matching tasks, which support fairness.

type MatchingTaskVersion added in v1.29.0

type MatchingTaskVersion int
const (
	MatchingTaskVersion1 MatchingTaskVersion = 1
	MatchingTaskVersion2 MatchingTaskVersion = 2
)

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 NexusEndpoints added in v1.25.0

type NexusEndpoints interface {
	InitializeNexusEndpointsTableVersion(ctx context.Context) (sql.Result, error)
	IncrementNexusEndpointsTableVersion(ctx context.Context, lastKnownTableVersion int64) (sql.Result, error)
	GetNexusEndpointsTableVersion(ctx context.Context) (int64, error)

	InsertIntoNexusEndpoints(ctx context.Context, row *NexusEndpointsRow) (sql.Result, error)
	UpdateNexusEndpoint(ctx context.Context, row *NexusEndpointsRow) (sql.Result, error)
	GetNexusEndpointByID(ctx context.Context, serviceID []byte) (*NexusEndpointsRow, error)
	ListNexusEndpoints(ctx context.Context, request *ListNexusEndpointsRequest) ([]NexusEndpointsRow, error)
	DeleteFromNexusEndpoints(ctx context.Context, id []byte) (sql.Result, error)
}

NexusEndpoints is the SQL persistence interface for Nexus endpoints

type NexusEndpointsRow added in v1.25.0

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

type Plugin

type Plugin interface {
	CreateDB(dbKind DbKind, cfg *config.SQL, r resolver.ServiceResolver, l log.Logger, mh metrics.Handler) (GenericDB, error)
}

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

type PruneClusterMembershipFilter

type PruneClusterMembershipFilter struct {
	PruneRecordsBefore time.Time
}

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 QueueV2Filter added in v1.23.0

type QueueV2Filter struct {
	QueueType persistence.QueueV2Type
	QueueName string
	Partition int
}

QueueV2Filter is used to filter rows in queues table

type QueueV2Message added in v1.23.0

type QueueV2Message interface {
	InsertIntoQueueV2Messages(ctx context.Context, row []QueueV2MessageRow) (sql.Result, error)
	RangeSelectFromQueueV2Messages(ctx context.Context, filter QueueV2MessagesFilter) ([]QueueV2MessageRow, error)
	RangeDeleteFromQueueV2Messages(ctx context.Context, filter QueueV2MessagesFilter) (sql.Result, error)
	GetLastEnqueuedMessageIDForUpdateV2(ctx context.Context, filter QueueV2Filter) (int64, error)
}

type QueueV2MessageRow added in v1.23.0

type QueueV2MessageRow struct {
	QueueType       persistence.QueueV2Type
	QueueName       string
	QueuePartition  int64
	MessageID       int64
	MessagePayload  []byte
	MessageEncoding string
}

QueueV2MessageRow represents a row in queue_messages table

type QueueV2MessagesFilter added in v1.23.0

type QueueV2MessagesFilter struct {
	QueueType    persistence.QueueV2Type
	QueueName    string
	Partition    int64
	MinMessageID int64
	MaxMessageID int64 // used for RangeDelete
	PageSize     int   // used for RangeSelect
}

QueueV2MessagesFilter is used to filter rows in queue_messages table

type QueueV2Metadata added in v1.23.0

type QueueV2Metadata interface {
	InsertIntoQueueV2Metadata(ctx context.Context, row *QueueV2MetadataRow) (sql.Result, error)
	UpdateQueueV2Metadata(ctx context.Context, row *QueueV2MetadataRow) (sql.Result, error)
	SelectFromQueueV2Metadata(ctx context.Context, filter QueueV2MetadataFilter) (*QueueV2MetadataRow, error)
	SelectFromQueueV2MetadataForUpdate(ctx context.Context, filter QueueV2MetadataFilter) (*QueueV2MetadataRow, error)
	SelectNameFromQueueV2Metadata(ctx context.Context, filter QueueV2MetadataTypeFilter) ([]QueueV2MetadataRow, error)
}

type QueueV2MetadataFilter added in v1.23.0

type QueueV2MetadataFilter struct {
	QueueType persistence.QueueV2Type
	QueueName string
}

type QueueV2MetadataRow added in v1.23.0

type QueueV2MetadataRow struct {
	QueueType        persistence.QueueV2Type
	QueueName        string
	MetadataPayload  []byte
	MetadataEncoding string
}

QueueV2MetadataRow represents a row in queue_metadata table

type QueueV2MetadataTypeFilter added in v1.23.0

type QueueV2MetadataTypeFilter struct {
	QueueType  persistence.QueueV2Type
	PageSize   int
	PageOffset int64
}

type RemoveFromBuildIdToTaskQueueMapping added in v1.21.0

type RemoveFromBuildIdToTaskQueueMapping struct {
	NamespaceID   []byte
	TaskQueueName string
	BuildIds      []string
}

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
	InclusiveMinTaskID int64
	ExclusiveMaxTaskID 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
	InclusiveMinTaskID int64
	ExclusiveMaxTaskID 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 TaskQueueUserDataEntry added in v1.21.0

type TaskQueueUserDataEntry struct {
	TaskQueueName string
	VersionedBlob
}

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
	InclusiveMinTaskID *int64
	ExclusiveMaxTaskID *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 TasksFilterV2 added in v1.29.0

type TasksFilterV2 struct {
	RangeHash         uint32
	TaskQueueID       []byte
	InclusiveMinLevel *FairLevel
	ExclusiveMaxLevel *FairLevel
	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 TasksRowV2 added in v1.29.0

type TasksRowV2 struct {
	RangeHash   uint32
	TaskQueueID []byte
	FairLevel
	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
	InclusiveMinTaskID              int64
	InclusiveMinVisibilityTimestamp time.Time
	ExclusiveMaxVisibilityTimestamp 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
	InclusiveMinTaskID int64
	ExclusiveMaxTaskID int64
	PageSize           int
}

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 UpdateTaskQueueDataRequest added in v1.21.0

type UpdateTaskQueueDataRequest struct {
	NamespaceID   []byte
	TaskQueueName string
	Version       int64
	Data          []byte
	DataEncoding  string
}

type VersionedBlob added in v1.21.0

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

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)
	GetFromVisibility(ctx context.Context, filter VisibilityGetFilter) (*VisibilityRow, error)
	DeleteFromVisibility(ctx context.Context, filter VisibilityDeleteFilter) (sql.Result, error)
	CountFromVisibility(ctx context.Context, filter VisibilitySelectFilter) (int64, error)
	CountGroupByFromVisibility(ctx context.Context, filter VisibilitySelectFilter) ([]VisibilityCountRow, error)
}

type VisibilityCountRow added in v1.22.0

type VisibilityCountRow struct {
	GroupValues []any
	Count       int64
}

func ParseCountGroupByRows added in v1.22.0

func ParseCountGroupByRows(rows *sql.Rows, groupBy []string) ([]VisibilityCountRow, error)

type VisibilityDeleteFilter added in v1.1.0

type VisibilityDeleteFilter struct {
	NamespaceID string
	RunID       string
}

type VisibilityGetFilter added in v1.19.0

type VisibilityGetFilter 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
	HistorySizeBytes     *int64
	ExecutionDuration    *time.Duration
	StateTransitionCount *int64
	Memo                 []byte
	Encoding             string
	TaskQueue            string
	SearchAttributes     *VisibilitySearchAttributes
	ParentWorkflowID     *string
	ParentRunID          *string
	RootWorkflowID       string
	RootRunID            string

	// Version must be at the end because the version column has to be the last column in the insert statement.
	// Otherwise we may do partial updates as the version changes halfway through.
	// This is because MySQL doesn't support row versioning in a way that prevents out-of-order updates.
	Version int64 `db:"_version"`
}

VisibilityRow represents a row in executions_visibility table

type VisibilitySearchAttributes added in v1.20.0

type VisibilitySearchAttributes map[string]interface{}

VisibilitySearchAttributes represents the search attributes json in executions_visibility table

func (*VisibilitySearchAttributes) Scan added in v1.20.0

func (vsa *VisibilitySearchAttributes) Scan(src interface{}) error

func (VisibilitySearchAttributes) Value added in v1.20.0

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

	Query     string
	QueryArgs []interface{}
	GroupBy   []string
}

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
	InclusiveMinTaskID int64
	ExclusiveMaxTaskID int64
	PageSize           int
}

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