activecluster

package
v1.2.19-prerelease08 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

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 DomainIDToDomainFn

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

type LookupResult

type LookupResult struct {
	Region          string
	ClusterName     string
	FailoverVersion int64
}

type Manager

type Manager interface {
	common.Daemon

	// LookupExternalEntity returns active cluster, cluster name and failover version of given external entity.
	// Only active-active global domains can have external entities.
	// For each entity type, there must be a corresponding watcher populating EntityActiveRegion table.
	// LookupExternalEntity will return the active cluster name and failover version by checking EntityActiveRegion table.
	LookupExternalEntity(ctx context.Context, entityType, entityKey string) (*LookupResult, error)

	// LookupExternalEntityOfNewWorkflow returns active cluster, cluster name and failover version of given new workflow.
	// Exactly same as LookupExternalEntity except it extracts entityType and entityKey from the start request.
	LookupExternalEntityOfNewWorkflow(ctx context.Context, req *types.HistoryStartWorkflowExecutionRequest) (*LookupResult, error)

	// LookupWorkflow returns active cluster, cluster name and failover version of given workflow.
	//  1. If domain is local:
	//     	Returns current cluster name and domain entry's failover version.
	//  2. If domain is active-passive global:
	//     	Returns domain entry's ActiveClusterName and domain entry's failover version.
	//  3. If domain is active-active global:
	//     	Returns corresponding active cluster name and failover version by checking workflow's activeness metadata and EntityActiveRegion lookup table.
	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.
	// For active-active global domains, it returns the cluster name based on cluster & region metadata and domain's activeactive config.
	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,
) Manager

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

func (m *MockManager) LookupExternalEntity(ctx context.Context, entityType, entityKey string) (*LookupResult, error)

LookupExternalEntity mocks base method.

func (*MockManager) LookupExternalEntityOfNewWorkflow

func (m *MockManager) LookupExternalEntityOfNewWorkflow(ctx context.Context, req *types.HistoryStartWorkflowExecutionRequest) (*LookupResult, error)

LookupExternalEntityOfNewWorkflow 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) LookupExternalEntity

func (mr *MockManagerMockRecorder) LookupExternalEntity(ctx, entityType, entityKey any) *gomock.Call

LookupExternalEntity indicates an expected call of LookupExternalEntity.

func (*MockManagerMockRecorder) LookupExternalEntityOfNewWorkflow

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

LookupExternalEntityOfNewWorkflow indicates an expected call of LookupExternalEntityOfNewWorkflow.

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.

Jump to

Keyboard shortcuts

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