sqlplugin

package
v1.2.6-prerelease2 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// this means the query need to execute in one shard but the shard should be fixed/static, e.g. for domain, queue storage are single shard
	DbDefaultShard = 0
	// this is should never being used in sharded SQL driver. It is used in admin/schema operation in singleton driver, which ignores all the shardID parameter
	DbShardUndefined = -1
	// this means the query needs to execute in all dbShards in sharded SQL driver (currently not supported)
	DbAllShards = -2
)

This section defines the special dbShardID, they must all below 0

Variables

View Source
var (
	// ErrTTLNotSupported indicates the sql plugin does not support ttl
	ErrTTLNotSupported = errors.New("plugin implementation does not support ttl")
)

Functions

func GetDBShardIDFromDomainID added in v0.24.0

func GetDBShardIDFromDomainID(domainID string, numDBShards int) int

GetDBShardIDFromDomainID maps domainID to a DBShardID

func GetDBShardIDFromDomainIDAndTasklist added in v0.24.0

func GetDBShardIDFromDomainIDAndTasklist(domainID, tasklistName string, numDBShards int) int

GetDBShardIDFromDomainIDAndTasklist maps <domainID, tasklistName> to a DBShardID

func GetDBShardIDFromHistoryShardID added in v0.24.0

func GetDBShardIDFromHistoryShardID(historyShardID int, numDBShards int) int

GetDBShardIDFromHistoryShardID maps historyShardID to a DBShardID

func GetDBShardIDFromTreeID added in v0.24.0

func GetDBShardIDFromTreeID(treeID serialization.UUID, numDBShards int) int

GetDBShardIDFromTreeID maps treeID to a DBShardID

Types

type ActivityInfoMapsFilter

type ActivityInfoMapsFilter struct {
	ShardID     int64
	DomainID    serialization.UUID
	WorkflowID  string
	RunID       serialization.UUID
	ScheduleIDs []int64
}

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

type ActivityInfoMapsRow

type ActivityInfoMapsRow struct {
	ShardID                  int64
	DomainID                 serialization.UUID
	WorkflowID               string
	RunID                    serialization.UUID
	ScheduleID               int64
	Data                     []byte
	DataEncoding             string
	LastHeartbeatDetails     []byte
	LastHeartbeatUpdatedTime time.Time
}

ActivityInfoMapsRow represents a row in activity_info_maps table

type AdminDB

type AdminDB interface {
	PluginName() string
	Close() error
	// contains filtered or unexported methods
}

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

type BufferedEventsFilter

type BufferedEventsFilter struct {
	ShardID    int
	DomainID   serialization.UUID
	WorkflowID string
	RunID      serialization.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      int
	DomainID     serialization.UUID
	WorkflowID   string
	RunID        serialization.UUID
	Data         []byte
	DataEncoding string
}

BufferedEventsRow represents a row in buffered_events table

type ChildExecutionInfoMapsFilter

type ChildExecutionInfoMapsFilter struct {
	ShardID      int64
	DomainID     serialization.UUID
	WorkflowID   string
	RunID        serialization.UUID
	InitiatedIDs []int64
}

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

type ChildExecutionInfoMapsRow

type ChildExecutionInfoMapsRow struct {
	ShardID      int64
	DomainID     serialization.UUID
	WorkflowID   string
	RunID        serialization.UUID
	InitiatedID  int64
	Data         []byte
	DataEncoding string
}

ChildExecutionInfoMapsRow represents a row in child_execution_info_maps table

type ClusterConfigRow added in v1.2.4

type ClusterConfigRow struct {
	RowType      int
	Version      int64
	Timestamp    time.Time
	Data         []byte
	DataEncoding string
}

ClusterConfigRow represents a row in cluster_config table

type CrossClusterTasksFilter added in v0.22.0

type CrossClusterTasksFilter struct {
	TargetCluster string
	ShardID       int
	TaskID        int64
	MinTaskID     int64
	MaxTaskID     int64
	PageSize      int
}

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

type CrossClusterTasksRow added in v0.22.0

type CrossClusterTasksRow struct {
	TargetCluster string
	ShardID       int
	TaskID        int64
	Data          []byte
	DataEncoding  string
}

CrossClusterTasksRow represents a row in cross_cluster_tasks table

type CurrentExecutionsFilter

type CurrentExecutionsFilter struct {
	ShardID    int64
	DomainID   serialization.UUID
	WorkflowID string
	RunID      serialization.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          int64
	DomainID         serialization.UUID
	WorkflowID       string
	RunID            serialization.UUID
	CreateRequestID  string
	State            int
	CloseStatus      int
	LastWriteVersion int64
	StartVersion     int64
}

CurrentExecutionsRow represents a row in current_executions table

type DB

type DB interface {
	ErrorChecker

	GetTotalNumDBShards() int
	BeginTx(ctx context.Context, dbShardID int) (Tx, error)
	PluginName() string
	Close() error
	// contains filtered or unexported methods
}

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

type DomainFilter

type DomainFilter struct {
	ID            *serialization.UUID
	Name          *string
	GreaterThanID *serialization.UUID
	PageSize      *int
}

DomainFilter contains the column names within domain 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 DomainMetadataRow

type DomainMetadataRow struct {
	NotificationVersion int64
}

DomainMetadataRow represents a row in domain_metadata table

type DomainRow

type DomainRow struct {
	ID           serialization.UUID
	Name         string
	Data         []byte
	DataEncoding string
	IsGlobal     bool
}

DomainRow represents a row in domain table

type ErrorChecker added in v0.21.2

type ErrorChecker interface {
	IsDupEntryError(err error) bool
	IsNotFoundError(err error) bool
	IsTimeoutError(err error) bool
	IsThrottlingError(err error) bool
}

type EventsFilter

type EventsFilter struct {
	DomainID     serialization.UUID
	WorkflowID   string
	RunID        serialization.UUID
	FirstEventID *int64
	NextEventID  *int64
	PageSize     *int
}

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

type EventsRow

type EventsRow struct {
	DomainID     serialization.UUID
	WorkflowID   string
	RunID        serialization.UUID
	FirstEventID int64
	BatchVersion int64
	RangeID      int64
	TxID         int64
	Data         []byte
	DataEncoding string
}

EventsRow represents a row in events table

type ExecutionsFilter

type ExecutionsFilter struct {
	ShardID    int
	DomainID   serialization.UUID
	WorkflowID string
	RunID      serialization.UUID
	Size       int
}

ExecutionsFilter contains the column names within executions table that can be used to filter results through a WHERE clause To get single row, it requires ShardID, DomainID, WorkflowID, RunID To get a list of rows, it requires ShardID, Size. The WorkflowID and RunID are optional for listing rows. They work as the start boundary for pagination.

type ExecutionsRow

type ExecutionsRow struct {
	ShardID                  int
	DomainID                 serialization.UUID
	WorkflowID               string
	RunID                    serialization.UUID
	NextEventID              int64
	LastWriteVersion         int64
	Data                     []byte
	DataEncoding             string
	VersionHistories         []byte
	VersionHistoriesEncoding string
}

ExecutionsRow represents a row in executions table

type HistoryNodeFilter

type HistoryNodeFilter struct {
	ShardID  int
	TreeID   serialization.UUID
	BranchID serialization.UUID
	// Inclusive
	MinNodeID *int64
	// Exclusive
	MaxNodeID *int64
	PageSize  int
}

HistoryNodeFilter 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  int
	TreeID   serialization.UUID
	BranchID serialization.UUID
	NodeID   int64
	// use pointer so that it's easier to multiple by -1
	TxnID        *int64
	Data         []byte
	DataEncoding string
}

HistoryNodeRow represents a row in history_node table

type HistoryTreeFilter

type HistoryTreeFilter struct {
	ShardID  int
	TreeID   serialization.UUID
	BranchID *serialization.UUID
	PageSize *int
}

HistoryTreeFilter 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      int
	TreeID       serialization.UUID
	BranchID     serialization.UUID
	Data         []byte
	DataEncoding string
}

HistoryTreeRow represents a row in history_tree table

type OrphanTasksFilter added in v0.21.0

type OrphanTasksFilter struct {
	Limit *int
}

OrphanTasksFilter contains the parameters controlling orphan deletion

type Plugin

type Plugin interface {
	CreateDB(cfg *config.SQL) (DB, error)
	CreateAdminDB(cfg *config.SQL) (AdminDB, error)
}

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

type QueueMetadataRow

type QueueMetadataRow struct {
	QueueType persistence.QueueType
	Data      []byte
}

QueueMetadataRow represents a row in queue_metadata table

type QueueRow

type QueueRow struct {
	QueueType      persistence.QueueType
	MessageID      int64
	MessagePayload []byte
}

QueueRow represents a row in queue table

type ReplicationTaskDLQFilter added in v0.14.0

type ReplicationTaskDLQFilter struct {
	SourceClusterName string
	ShardID           int
}

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

type ReplicationTaskDLQRow

type ReplicationTaskDLQRow struct {
	SourceClusterName string
	ShardID           int
	TaskID            int64
	Data              []byte
	DataEncoding      string
}

ReplicationTaskDLQRow represents a row in replication_tasks_dlq table

type ReplicationTasksDLQFilter

type ReplicationTasksDLQFilter struct {
	ReplicationTasksFilter
	SourceClusterName string
}

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

type ReplicationTasksFilter

type ReplicationTasksFilter struct {
	ShardID            int
	TaskID             int64
	InclusiveEndTaskID int64
	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      int
	TaskID       int64
	Data         []byte
	DataEncoding string
}

ReplicationTasksRow represents a row in replication_tasks table

type RequestCancelInfoMapsFilter

type RequestCancelInfoMapsFilter struct {
	ShardID      int64
	DomainID     serialization.UUID
	WorkflowID   string
	RunID        serialization.UUID
	InitiatedIDs []int64
}

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

type RequestCancelInfoMapsRow

type RequestCancelInfoMapsRow struct {
	ShardID      int64
	DomainID     serialization.UUID
	WorkflowID   string
	RunID        serialization.UUID
	InitiatedID  int64
	Data         []byte
	DataEncoding string
}

RequestCancelInfoMapsRow represents a row in request_cancel_info_maps table

type ShardsFilter

type ShardsFilter struct {
	ShardID int64
}

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      int64
	RangeID      int64
	Data         []byte
	DataEncoding string
}

ShardsRow represents a row in shards table

type SignalInfoMapsFilter

type SignalInfoMapsFilter struct {
	ShardID      int64
	DomainID     serialization.UUID
	WorkflowID   string
	RunID        serialization.UUID
	InitiatedIDs []int64
}

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

type SignalInfoMapsRow

type SignalInfoMapsRow struct {
	ShardID      int64
	DomainID     serialization.UUID
	WorkflowID   string
	RunID        serialization.UUID
	InitiatedID  int64
	Data         []byte
	DataEncoding string
}

SignalInfoMapsRow represents a row in signal_info_maps table

type SignalsRequestedSetsFilter

type SignalsRequestedSetsFilter struct {
	ShardID    int64
	DomainID   serialization.UUID
	WorkflowID string
	RunID      serialization.UUID
	SignalIDs  []string
}

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

type SignalsRequestedSetsRow

type SignalsRequestedSetsRow struct {
	ShardID    int64
	DomainID   serialization.UUID
	WorkflowID string
	RunID      serialization.UUID
	SignalID   string
}

SignalsRequestedSetsRow represents a row in signals_requested_sets table

type TaskKeyRow added in v0.21.0

type TaskKeyRow struct {
	DomainID     serialization.UUID
	TaskListName string
	TaskType     int64
	TaskID       int64
}

TaskKeyRow represents a result row giving task keys

type TaskListsFilter

type TaskListsFilter struct {
	ShardID             int // this is DBShardID, not historyShardID (TODO: maybe rename it for clarification)
	DomainID            *serialization.UUID
	Name                *string
	TaskType            *int64
	DomainIDGreaterThan *serialization.UUID
	NameGreaterThan     *string
	TaskTypeGreaterThan *int64
	RangeID             *int64
	PageSize            *int
}

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

type TaskListsRow

type TaskListsRow struct {
	ShardID      int // this is DBShardID, not historyShardID (TODO: maybe rename it for clarification)
	DomainID     serialization.UUID
	Name         string
	TaskType     int64
	RangeID      int64
	Data         []byte
	DataEncoding string
}

TaskListsRow represents a row in task_lists table

type TaskListsRowWithTTL added in v0.17.0

type TaskListsRowWithTTL struct {
	TaskListsRow TaskListsRow
	TTL          time.Duration
}

TaskListsRowWithTTL represents a row in task_lists table with a ttl

type TasksFilter

type TasksFilter struct {
	ShardID              int // this is DBShardID, not historyShardID (TODO: maybe rename it for clarification)
	DomainID             serialization.UUID
	TaskListName         string
	TaskType             int64
	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 {
	ShardID      int // this is DBShardID, not historyShardID (TODO: maybe rename it for clarification)
	DomainID     serialization.UUID
	TaskType     int64
	TaskID       int64
	TaskListName string
	Data         []byte
	DataEncoding string
}

TasksRow represents a row in tasks table

type TasksRowWithTTL added in v0.17.0

type TasksRowWithTTL struct {
	TasksRow TasksRow
	// TTL is optional because InsertIntoTasksWithTTL operates over a slice of TasksRowWithTTL.
	// Some items in the slice may have a TTL while others do not. It is the responsibility
	// of the plugin implementation to handle items with TTL set and items with TTL not set.
	TTL *time.Duration
}

TasksRowWithTTL represents a row in tasks table with a ttl

type TimerInfoMapsFilter

type TimerInfoMapsFilter struct {
	ShardID    int64
	DomainID   serialization.UUID
	WorkflowID string
	RunID      serialization.UUID
	TimerIDs   []string
}

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

type TimerInfoMapsRow

type TimerInfoMapsRow struct {
	ShardID      int64
	DomainID     serialization.UUID
	WorkflowID   string
	RunID        serialization.UUID
	TimerID      string
	Data         []byte
	DataEncoding string
}

TimerInfoMapsRow represents a row in timer_info_maps table

type TimerTasksFilter

type TimerTasksFilter struct {
	ShardID                int
	TaskID                 int64
	VisibilityTimestamp    time.Time
	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             int
	VisibilityTimestamp time.Time
	TaskID              int64
	Data                []byte
	DataEncoding        string
}

TimerTasksRow represents a row in timer_tasks table

type TransferTasksFilter

type TransferTasksFilter struct {
	ShardID   int
	TaskID    int64
	MinTaskID int64
	MaxTaskID int64
	PageSize  int
}

TransferTasksFilter 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      int
	TaskID       int64
	Data         []byte
	DataEncoding string
}

TransferTasksRow represents a row in transfer_tasks table

type Tx

type Tx interface {
	ErrorChecker

	Commit() error
	Rollback() error
	// contains filtered or unexported methods
}

Tx defines the API for a SQL transaction

type VisibilityFilter

type VisibilityFilter struct {
	DomainID         string
	Closed           bool
	RunID            *string
	WorkflowID       *string
	WorkflowTypeName *string
	CloseStatus      *int32
	MinStartTime     *time.Time
	MaxStartTime     *time.Time
	PageSize         *int
}

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

type VisibilityRow

type VisibilityRow struct {
	DomainID         string
	RunID            string
	WorkflowTypeName string
	WorkflowID       string
	StartTime        time.Time
	ExecutionTime    time.Time
	CloseStatus      *int32
	CloseTime        *time.Time
	HistoryLength    *int64
	Memo             []byte
	Encoding         string
	IsCron           bool
	NumClusters      int16
	UpdateTime       time.Time
	ShardID          int16
}

VisibilityRow represents a row in executions_visibility table

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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