Documentation
¶
Overview ¶
Package activecluster is a generated GoMock package.
Package activecluster is a generated GoMock package.
Index ¶
- Constants
- type ClusterAttributeNotFoundError
- type DomainIDToDomainFn
- type ExecutionManagerProvider
- type LookupResult
- type Manager
- type ManagerOption
- type MockExecutionManagerProvider
- type MockExecutionManagerProviderMockRecorder
- type MockManager
- func (m *MockManager) CurrentRegion() string
- func (m *MockManager) EXPECT() *MockManagerMockRecorder
- func (m *MockManager) GetActiveClusterInfoByClusterAttribute(ctx context.Context, domainID string, clusterAttribute *types.ClusterAttribute) (*types.ActiveClusterInfo, error)
- func (m *MockManager) GetActiveClusterInfoByWorkflow(ctx context.Context, domainID, wfID, rID string) (*types.ActiveClusterInfo, error)
- func (m *MockManager) LookupNewWorkflow(ctx context.Context, domainID string, ...) (*LookupResult, error)
- func (m *MockManager) LookupWorkflow(ctx context.Context, domainID, wfID, rID string) (*LookupResult, error)
- type MockManagerMockRecorder
- func (mr *MockManagerMockRecorder) CurrentRegion() *gomock.Call
- func (mr *MockManagerMockRecorder) GetActiveClusterInfoByClusterAttribute(ctx, domainID, clusterAttribute any) *gomock.Call
- func (mr *MockManagerMockRecorder) GetActiveClusterInfoByWorkflow(ctx, domainID, wfID, rID any) *gomock.Call
- func (mr *MockManagerMockRecorder) LookupNewWorkflow(ctx, domainID, policy any) *gomock.Call
- func (mr *MockManagerMockRecorder) LookupWorkflow(ctx, domainID, wfID, rID any) *gomock.Call
- type RegionNotFoundForDomainError
Constants ¶
const ( LookupNewWorkflowOpName = "LookupNewWorkflow" LookupWorkflowOpName = "LookupWorkflow" GetActiveClusterInfoByClusterAttributeOpName = "GetActiveClusterInfoByClusterAttribute" GetActiveClusterInfoByWorkflowOpName = "GetActiveClusterInfoByWorkflow" DomainIDToDomainFnErrorReason = "domain_id_to_name_fn_error" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClusterAttributeNotFoundError ¶
type ClusterAttributeNotFoundError struct {
DomainID string
ClusterAttribute *types.ClusterAttribute
}
func (*ClusterAttributeNotFoundError) Error ¶
func (e *ClusterAttributeNotFoundError) Error() string
type DomainIDToDomainFn ¶
type DomainIDToDomainFn func(id string) (*cache.DomainCacheEntry, error)
type ExecutionManagerProvider ¶ added in v1.3.2
type ExecutionManagerProvider interface {
GetExecutionManager(shardID int) (persistence.ExecutionManager, error)
}
type LookupResult ¶
type Manager ¶
type Manager interface {
// LookupNewWorkflow returns active cluster, region and failover version of given new workflow.
// 1. If domain is local:
// Returns info from domain entry.
// 2. If domain is active-passive global:
// Returns info from domain entry.
// 3. If domain is active-active global:
// 3.1. if workflow is region sticky, returns current cluster and its failover version.
// 3.2. if workflow has external entity, returns region, cluster name and failover version of corresponding row in EntityActiveRegion lookup table.
LookupNewWorkflow(ctx context.Context, domainID string, policy *types.ActiveClusterSelectionPolicy) (*LookupResult, error)
// LookupWorkflow returns active cluster, region and failover version of given existing workflow.
// Returns the info from domain entry for local and active-passive domains
//
// Active-active domain logic:
// 1. Get ActivenessMetadata record of the workflow
// 1.a. If it's found, continue with step 2
// 1.b. If it's not found and the domain is migrated from active-passive to active-active return domain's ActiveClusterName and FailoverVersion.
// 1.c. If it's not found and the domain is not migrated from active-passive to active-active, the workflow must have been retired. Return cluster name and failover version of current region.
// 2. Given ActivenessMetadata, return region and failover version
// 2.a. If workflow is region sticky (origin=regionA), find active cluster in that region in domain's active cluster config and return its name and failover version.
// 2.b. If workflow has external entity, locate the entity from EntityActiveRegion table and return that region and it's failover version.
LookupWorkflow(ctx context.Context, domainID, wfID, rID string) (*LookupResult, error)
// CurrentRegion returns the current region.
CurrentRegion() string
// GetActiveClusterInfoByClusterAttribute returns the active cluster info by cluster attribute
// If clusterAttribute is nil, returns the domain-level active cluster info
// If clusterAttribute is not nil and exists in the domain metadata, returns the active cluster info of the cluster attribute
// If clusterAttribute is not nil and does not exist in the domain metadata, returns an error
GetActiveClusterInfoByClusterAttribute(ctx context.Context, domainID string, clusterAttribute *types.ClusterAttribute) (*types.ActiveClusterInfo, error)
// GetActiveClusterInfoByWorkflow returns the active cluster info by workflow
// It will first look up the cluster selection policy for the workflow and then get the active cluster info by cluster attribute from the policy
GetActiveClusterInfoByWorkflow(ctx context.Context, domainID, wfID, rID string) (*types.ActiveClusterInfo, error)
}
Manager is the interface for active cluster manager. It is used to lookup region, active cluster, cluster name and failover version etc. This was introduced to support active-active domains. It encapsulates the logic to lookup the active cluster for all kinds of domains. Most other components should use this interface instead of cluster metadata directly. It is also used to notify components when there's an external entity change. History engine subscribes to these updates similar to domain change notifications.
func NewManager ¶
func NewManager( domainIDToDomainFn DomainIDToDomainFn, clusterMetadata cluster.Metadata, metricsCl metrics.Client, logger log.Logger, executionManagerProvider ExecutionManagerProvider, numShards int, opts ...ManagerOption, ) (Manager, error)
type ManagerOption ¶ added in v1.3.1
type ManagerOption func(*managerImpl)
func WithTimeSource ¶ added in v1.3.1
func WithTimeSource(timeSource clock.TimeSource) ManagerOption
type MockExecutionManagerProvider ¶ added in v1.3.2
type MockExecutionManagerProvider struct {
// contains filtered or unexported fields
}
MockExecutionManagerProvider is a mock of ExecutionManagerProvider interface.
func NewMockExecutionManagerProvider ¶ added in v1.3.2
func NewMockExecutionManagerProvider(ctrl *gomock.Controller) *MockExecutionManagerProvider
NewMockExecutionManagerProvider creates a new mock instance.
func (*MockExecutionManagerProvider) EXPECT ¶ added in v1.3.2
func (m *MockExecutionManagerProvider) EXPECT() *MockExecutionManagerProviderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockExecutionManagerProvider) GetExecutionManager ¶ added in v1.3.2
func (m *MockExecutionManagerProvider) GetExecutionManager(shardID int) (persistence.ExecutionManager, error)
GetExecutionManager mocks base method.
type MockExecutionManagerProviderMockRecorder ¶ added in v1.3.2
type MockExecutionManagerProviderMockRecorder struct {
// contains filtered or unexported fields
}
MockExecutionManagerProviderMockRecorder is the mock recorder for MockExecutionManagerProvider.
func (*MockExecutionManagerProviderMockRecorder) GetExecutionManager ¶ added in v1.3.2
func (mr *MockExecutionManagerProviderMockRecorder) GetExecutionManager(shardID any) *gomock.Call
GetExecutionManager indicates an expected call of GetExecutionManager.
type MockManager ¶
type MockManager struct {
// contains filtered or unexported fields
}
MockManager is a mock of Manager interface.
func NewMockManager ¶
func NewMockManager(ctrl *gomock.Controller) *MockManager
NewMockManager creates a new mock instance.
func (*MockManager) CurrentRegion ¶ added in v1.3.2
func (m *MockManager) CurrentRegion() string
CurrentRegion mocks base method.
func (*MockManager) EXPECT ¶
func (m *MockManager) EXPECT() *MockManagerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockManager) GetActiveClusterInfoByClusterAttribute ¶
func (m *MockManager) GetActiveClusterInfoByClusterAttribute(ctx context.Context, domainID string, clusterAttribute *types.ClusterAttribute) (*types.ActiveClusterInfo, error)
GetActiveClusterInfoByClusterAttribute mocks base method.
func (*MockManager) GetActiveClusterInfoByWorkflow ¶
func (m *MockManager) GetActiveClusterInfoByWorkflow(ctx context.Context, domainID, wfID, rID string) (*types.ActiveClusterInfo, error)
GetActiveClusterInfoByWorkflow mocks base method.
func (*MockManager) LookupNewWorkflow ¶ added in v1.3.3
func (m *MockManager) LookupNewWorkflow(ctx context.Context, domainID string, policy *types.ActiveClusterSelectionPolicy) (*LookupResult, error)
LookupNewWorkflow mocks base method.
func (*MockManager) LookupWorkflow ¶
func (m *MockManager) LookupWorkflow(ctx context.Context, domainID, wfID, rID string) (*LookupResult, error)
LookupWorkflow mocks base method.
type MockManagerMockRecorder ¶
type MockManagerMockRecorder struct {
// contains filtered or unexported fields
}
MockManagerMockRecorder is the mock recorder for MockManager.
func (*MockManagerMockRecorder) CurrentRegion ¶ added in v1.3.2
func (mr *MockManagerMockRecorder) CurrentRegion() *gomock.Call
CurrentRegion indicates an expected call of CurrentRegion.
func (*MockManagerMockRecorder) GetActiveClusterInfoByClusterAttribute ¶
func (mr *MockManagerMockRecorder) GetActiveClusterInfoByClusterAttribute(ctx, domainID, clusterAttribute any) *gomock.Call
GetActiveClusterInfoByClusterAttribute indicates an expected call of GetActiveClusterInfoByClusterAttribute.
func (*MockManagerMockRecorder) GetActiveClusterInfoByWorkflow ¶
func (mr *MockManagerMockRecorder) GetActiveClusterInfoByWorkflow(ctx, domainID, wfID, rID any) *gomock.Call
GetActiveClusterInfoByWorkflow indicates an expected call of GetActiveClusterInfoByWorkflow.
func (*MockManagerMockRecorder) LookupNewWorkflow ¶ added in v1.3.3
func (mr *MockManagerMockRecorder) LookupNewWorkflow(ctx, domainID, policy any) *gomock.Call
LookupNewWorkflow indicates an expected call of LookupNewWorkflow.
func (*MockManagerMockRecorder) LookupWorkflow ¶
func (mr *MockManagerMockRecorder) LookupWorkflow(ctx, domainID, wfID, rID any) *gomock.Call
LookupWorkflow indicates an expected call of LookupWorkflow.
type RegionNotFoundForDomainError ¶ added in v1.3.1
func (*RegionNotFoundForDomainError) Error ¶ added in v1.3.1
func (e *RegionNotFoundForDomainError) Error() string