Documentation ¶
Index ¶
- Variables
- type NormalPartition
- func (p *NormalPartition) IsRoot() bool
- func (p *NormalPartition) Key() PartitionKey
- func (p *NormalPartition) Kind() enumspb.TaskQueueKind
- func (p *NormalPartition) NamespaceId() namespace.ID
- func (p *NormalPartition) ParentPartition(degree int) (*NormalPartition, error)
- func (p *NormalPartition) PartitionId() int
- func (p *NormalPartition) RoutingKey() string
- func (p *NormalPartition) RpcName() string
- func (p *NormalPartition) TaskQueue() *TaskQueue
- func (p *NormalPartition) TaskType() enumspb.TaskQueueType
- type Partition
- type PartitionKey
- type StickyPartition
- func (s *StickyPartition) IsRoot() bool
- func (s *StickyPartition) Key() PartitionKey
- func (s *StickyPartition) Kind() enumspb.TaskQueueKind
- func (s *StickyPartition) NamespaceId() namespace.ID
- func (s *StickyPartition) RootPartition() Partition
- func (s *StickyPartition) RoutingKey() string
- func (s *StickyPartition) RpcName() string
- func (s *StickyPartition) StickyName() string
- func (s *StickyPartition) TaskQueue() *TaskQueue
- func (s *StickyPartition) TaskType() enumspb.TaskQueueType
- type TaskQueue
- func (n *TaskQueue) Family() *TaskQueueFamily
- func (n *TaskQueue) Name() string
- func (n *TaskQueue) NamespaceId() namespace.ID
- func (n *TaskQueue) NormalPartition(partitionId int) *NormalPartition
- func (n *TaskQueue) RootPartition() *NormalPartition
- func (n *TaskQueue) StickyPartition(stickyName string) *StickyPartition
- func (n *TaskQueue) TaskType() enumspb.TaskQueueType
- type TaskQueueFamily
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type NormalPartition ¶
type NormalPartition struct {
// contains filtered or unexported fields
}
NormalPartition is used to distribute load of a TaskQueue in multiple Matching instances. A normal partition is identified by `partitionId`. The partition with ID 0 is called a root partition.
func MustNormalPartitionFromRpcName ¶ added in v1.25.0
func MustNormalPartitionFromRpcName(rpcName string, namespaceId string, taskType enumspb.TaskQueueType) *NormalPartition
func NormalPartitionFromRpcName ¶
func NormalPartitionFromRpcName(rpcName string, namespaceId string, taskType enumspb.TaskQueueType) (*NormalPartition, error)
func (*NormalPartition) IsRoot ¶
func (p *NormalPartition) IsRoot() bool
func (*NormalPartition) Key ¶
func (p *NormalPartition) Key() PartitionKey
func (*NormalPartition) Kind ¶
func (p *NormalPartition) Kind() enumspb.TaskQueueKind
func (*NormalPartition) NamespaceId ¶
func (p *NormalPartition) NamespaceId() namespace.ID
func (*NormalPartition) ParentPartition ¶
func (p *NormalPartition) ParentPartition(degree int) (*NormalPartition, error)
ParentPartition returns a NormalPartition for the parent partition, using the given branching degree.
func (*NormalPartition) PartitionId ¶
func (p *NormalPartition) PartitionId() int
func (*NormalPartition) RoutingKey ¶
func (p *NormalPartition) RoutingKey() string
func (*NormalPartition) RpcName ¶
func (p *NormalPartition) RpcName() string
func (*NormalPartition) TaskQueue ¶
func (p *NormalPartition) TaskQueue() *TaskQueue
func (*NormalPartition) TaskType ¶
func (p *NormalPartition) TaskType() enumspb.TaskQueueType
type Partition ¶
type Partition interface { NamespaceId() namespace.ID TaskQueue() *TaskQueue TaskType() enumspb.TaskQueueType // IsRoot always returns false for Sticky partitions IsRoot() bool Kind() enumspb.TaskQueueKind // RpcName returns the mangled name of the task queue partition, to be used in RPCs. // // RPC names look like this: // // sticky partition: <sticky name> // root normal partition: <task queue name> // non-root normal partition: /_sys/<task queue name>/<partition id> // // This scheme lets users use anything they like for a base name, except for strings // starting with "/_sys/", without ambiguity. // // For backward compatibility, unversioned low-level task queues with partition 0 do not // use mangled names, they use the bare base name. RpcName() string Key() PartitionKey // RoutingKey returns the string that should be used to find the owner of a task queue partition. RoutingKey() string }
Partition is a sticky or normal partition of a TaskQueue. Each Partition has a distinct task queue partition manager in memory in Matching service. Normal partition with `partitionId=0` is called the "root". Sticky queues are not considered root.
func PartitionFromPartitionProto ¶
func PartitionFromPartitionProto(proto *taskqueuespb.TaskQueuePartition, namespaceId string) Partition
func PartitionFromProto ¶
func PartitionFromProto(proto *taskqueuepb.TaskQueue, namespaceId string, taskType enumspb.TaskQueueType) (Partition, error)
type PartitionKey ¶
type PartitionKey struct {
// contains filtered or unexported fields
}
PartitionKey uniquely identifies a task queue partition, to be used in maps. Note that task queue kind (sticky vs normal) and normal name for sticky task queues are not part of the task queue partition identity.
type StickyPartition ¶
type StickyPartition struct {
// contains filtered or unexported fields
}
StickyPartition is made by SDK for a single workflow worker to keep workflow tasks of the same execution in the same worker for caching benefits. Each sticky partition is identified by a unique `stickyName` generated by SDK. A StickyPartition can only have workflow task type.
func (*StickyPartition) IsRoot ¶
func (s *StickyPartition) IsRoot() bool
func (*StickyPartition) Key ¶
func (s *StickyPartition) Key() PartitionKey
func (*StickyPartition) Kind ¶
func (s *StickyPartition) Kind() enumspb.TaskQueueKind
func (*StickyPartition) NamespaceId ¶
func (s *StickyPartition) NamespaceId() namespace.ID
func (*StickyPartition) RootPartition ¶
func (s *StickyPartition) RootPartition() Partition
func (*StickyPartition) RoutingKey ¶
func (s *StickyPartition) RoutingKey() string
func (*StickyPartition) RpcName ¶
func (s *StickyPartition) RpcName() string
func (*StickyPartition) StickyName ¶
func (s *StickyPartition) StickyName() string
func (*StickyPartition) TaskQueue ¶
func (s *StickyPartition) TaskQueue() *TaskQueue
func (*StickyPartition) TaskType ¶
func (s *StickyPartition) TaskType() enumspb.TaskQueueType
type TaskQueue ¶
type TaskQueue struct {
// contains filtered or unexported fields
}
TaskQueue represents a logical task queue for a type of tasks (e.g. Activity or Workflow). Under the hood, a TaskQueue can be broken down to multiple sticky or normal partitions.
func (*TaskQueue) Family ¶
func (n *TaskQueue) Family() *TaskQueueFamily
func (*TaskQueue) NamespaceId ¶
func (*TaskQueue) NormalPartition ¶
func (n *TaskQueue) NormalPartition(partitionId int) *NormalPartition
func (*TaskQueue) RootPartition ¶
func (n *TaskQueue) RootPartition() *NormalPartition
func (*TaskQueue) StickyPartition ¶
func (n *TaskQueue) StickyPartition(stickyName string) *StickyPartition
func (*TaskQueue) TaskType ¶
func (n *TaskQueue) TaskType() enumspb.TaskQueueType
type TaskQueueFamily ¶
type TaskQueueFamily struct {
// contains filtered or unexported fields
}
TaskQueueFamily represents the high-level "task queue" that user creates by explicitly providing a task queue name when starting a worker or a workflow. A task queue family consists of separate TaskQueues for different types of task (e.g. Workflow, Activity).
func NewTaskQueueFamily ¶
func NewTaskQueueFamily(namespaceId string, name string) (*TaskQueueFamily, error)
NewTaskQueueFamily takes a user-provided task queue name (aka family name) and returns a TaskQueueFamily. Returns an error if name looks like a mangled name.
func UnsafeTaskQueueFamily ¶
func UnsafeTaskQueueFamily(namespaceId string, name string) *TaskQueueFamily
UnsafeTaskQueueFamily should be avoided as much as possible. Use NewTaskQueueFamily instead as it validates the tq name.
func (*TaskQueueFamily) Name ¶
func (n *TaskQueueFamily) Name() string
func (*TaskQueueFamily) NamespaceId ¶
func (n *TaskQueueFamily) NamespaceId() namespace.ID
func (*TaskQueueFamily) TaskQueue ¶
func (n *TaskQueueFamily) TaskQueue(taskType enumspb.TaskQueueType) *TaskQueue