activecluster

package
v1.2.19-prerelease12 Latest Latest
Warning

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

Go to latest
Published: May 9, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package activecluster is a generated GoMock package.

Package activecluster is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeType

type ChangeType string
const (
	ChangeTypeEntityMap ChangeType = "ChangeTypeEntityMap"
)

type ClusterNotFoundForRegionError added in v1.3.1

type ClusterNotFoundForRegionError struct {
	ClusterName string
	Region      string
}

func (*ClusterNotFoundForRegionError) Error added in v1.3.1

type DomainIDToDomainFn

type DomainIDToDomainFn func(id string) (*cache.DomainCacheEntry, error)

type ExternalEntity added in v1.3.1

type ExternalEntity struct {
	Source          string
	Key             string
	Region          string
	FailoverVersion int64
}

type ExternalEntityProvider added in v1.3.1

type ExternalEntityProvider interface {
	SupportedSource() string
	ChangeEvents() <-chan ChangeType
	GetExternalEntity(ctx context.Context, entitySKey string) (*ExternalEntity, error)
}

type LookupResult

type LookupResult struct {
	Region          string
	ClusterName     string
	FailoverVersion int64
}

type Manager

type Manager interface {
	common.Daemon

	// FailoverVersionOfNewWorkflow returns failover version of given new workflow.
	//  1. If domain is local:
	//     	Returns domain entry's failover version.
	//  2. If domain is active-passive global:
	//     	Returns domain entry's failover version.
	//  3. If domain is active-active global:
	//     	3.1. if workflow is region sticky, returns failover version of current cluster.
	//     	3.2. if workflow has external entity, returns failover version of corresponding row in EntityActiveRegion lookup table.
	FailoverVersionOfNewWorkflow(ctx context.Context, req *types.HistoryStartWorkflowExecutionRequest) (int64, error)

	// LookupWorkflow returns active cluster, region and failover version of given 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, the domain is migrated from active-passive to active-active and workflow is created before migration.
	//     This case will fallback to active-passive logic and return domain's ActiveClusterName and FailoverVersion.
	//  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)

	// ClusterNameForFailoverVersion returns cluster name of given failover version.
	// For local domains, it returns current cluster name.
	// For active-passive global domains, it returns the cluster name based on cluster metadata that corresponds to the failover version.
	// For active-active global domains, it returns the cluster name based on cluster & region metadata that corresponds to the failover version.
	ClusterNameForFailoverVersion(failoverVersion int64, domainID string) (string, error)

	// RegisterChangeCallback registers a callback that will be called for change events such as entity map changes.
	RegisterChangeCallback(shardID int, callback func(ChangeType))

	// UnregisterChangeCallback unregisters a callback that will be called for change events.
	UnregisterChangeCallback(shardID int)
}

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,
	externalEntityProviders []ExternalEntityProvider,
	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 MockExternalEntityProvider added in v1.3.1

type MockExternalEntityProvider struct {
	// contains filtered or unexported fields
}

MockExternalEntityProvider is a mock of ExternalEntityProvider interface.

func NewMockExternalEntityProvider added in v1.3.1

func NewMockExternalEntityProvider(ctrl *gomock.Controller) *MockExternalEntityProvider

NewMockExternalEntityProvider creates a new mock instance.

func (*MockExternalEntityProvider) ChangeEvents added in v1.3.1

func (m *MockExternalEntityProvider) ChangeEvents() <-chan ChangeType

ChangeEvents mocks base method.

func (*MockExternalEntityProvider) EXPECT added in v1.3.1

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockExternalEntityProvider) GetExternalEntity added in v1.3.1

func (m *MockExternalEntityProvider) GetExternalEntity(ctx context.Context, entitySKey string) (*ExternalEntity, error)

GetExternalEntity mocks base method.

func (*MockExternalEntityProvider) SupportedSource added in v1.3.1

func (m *MockExternalEntityProvider) SupportedSource() string

SupportedSource mocks base method.

type MockExternalEntityProviderMockRecorder added in v1.3.1

type MockExternalEntityProviderMockRecorder struct {
	// contains filtered or unexported fields
}

MockExternalEntityProviderMockRecorder is the mock recorder for MockExternalEntityProvider.

func (*MockExternalEntityProviderMockRecorder) ChangeEvents added in v1.3.1

ChangeEvents indicates an expected call of ChangeEvents.

func (*MockExternalEntityProviderMockRecorder) GetExternalEntity added in v1.3.1

func (mr *MockExternalEntityProviderMockRecorder) GetExternalEntity(ctx, entitySKey any) *gomock.Call

GetExternalEntity indicates an expected call of GetExternalEntity.

func (*MockExternalEntityProviderMockRecorder) SupportedSource added in v1.3.1

func (mr *MockExternalEntityProviderMockRecorder) SupportedSource() *gomock.Call

SupportedSource indicates an expected call of SupportedSource.

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) ClusterNameForFailoverVersion

func (m *MockManager) ClusterNameForFailoverVersion(failoverVersion int64, domainID string) (string, error)

ClusterNameForFailoverVersion 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) FailoverVersionOfNewWorkflow added in v1.3.1

func (m *MockManager) FailoverVersionOfNewWorkflow(ctx context.Context, req *types.HistoryStartWorkflowExecutionRequest) (int64, error)

FailoverVersionOfNewWorkflow mocks base method.

func (*MockManager) LookupWorkflow

func (m *MockManager) LookupWorkflow(ctx context.Context, domainID, wfID, rID string) (*LookupResult, error)

LookupWorkflow mocks base method.

func (*MockManager) RegisterChangeCallback

func (m *MockManager) RegisterChangeCallback(shardID int, callback func(ChangeType))

RegisterChangeCallback mocks base method.

func (*MockManager) Start

func (m *MockManager) Start()

Start mocks base method.

func (*MockManager) Stop

func (m *MockManager) Stop()

Stop mocks base method.

func (*MockManager) UnregisterChangeCallback

func (m *MockManager) UnregisterChangeCallback(shardID int)

UnregisterChangeCallback mocks base method.

type MockManagerMockRecorder

type MockManagerMockRecorder struct {
	// contains filtered or unexported fields
}

MockManagerMockRecorder is the mock recorder for MockManager.

func (*MockManagerMockRecorder) ClusterNameForFailoverVersion

func (mr *MockManagerMockRecorder) ClusterNameForFailoverVersion(failoverVersion, domainID any) *gomock.Call

ClusterNameForFailoverVersion indicates an expected call of ClusterNameForFailoverVersion.

func (*MockManagerMockRecorder) FailoverVersionOfNewWorkflow added in v1.3.1

func (mr *MockManagerMockRecorder) FailoverVersionOfNewWorkflow(ctx, req any) *gomock.Call

FailoverVersionOfNewWorkflow indicates an expected call of FailoverVersionOfNewWorkflow.

func (*MockManagerMockRecorder) LookupWorkflow

func (mr *MockManagerMockRecorder) LookupWorkflow(ctx, domainID, wfID, rID any) *gomock.Call

LookupWorkflow indicates an expected call of LookupWorkflow.

func (*MockManagerMockRecorder) RegisterChangeCallback

func (mr *MockManagerMockRecorder) RegisterChangeCallback(shardID, callback any) *gomock.Call

RegisterChangeCallback indicates an expected call of RegisterChangeCallback.

func (*MockManagerMockRecorder) Start

func (mr *MockManagerMockRecorder) Start() *gomock.Call

Start indicates an expected call of Start.

func (*MockManagerMockRecorder) Stop

func (mr *MockManagerMockRecorder) Stop() *gomock.Call

Stop indicates an expected call of Stop.

func (*MockManagerMockRecorder) UnregisterChangeCallback

func (mr *MockManagerMockRecorder) UnregisterChangeCallback(shardID any) *gomock.Call

UnregisterChangeCallback indicates an expected call of UnregisterChangeCallback.

type RegionNotFoundForDomainError added in v1.3.1

type RegionNotFoundForDomainError struct {
	Region   string
	DomainID string
}

func (*RegionNotFoundForDomainError) Error added in v1.3.1

type WorkflowActivenessMetadata added in v1.3.1

type WorkflowActivenessMetadata struct {
	Type WorkflowActivenessType

	// Region is the origin region of the workflow.
	// It's set for region sticky workflows.
	Region string

	// EntityKey is the key of the external entity associated with the workflow.
	// It's set for workflows with external entity associations.
	EntityKey string

	// EntitySource is the source of the external entity.
	// It's set for workflows with external entity associations.
	EntitySource string
}

type WorkflowActivenessType added in v1.3.1

type WorkflowActivenessType string
const (
	WorkflowActivenessTypeRegionSticky   WorkflowActivenessType = "RegionSticky"
	WorkflowActivenessTypeExternalEntity WorkflowActivenessType = "ExternalEntity"
)

Jump to

Keyboard shortcuts

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