clusterredirection

package
v1.2.13-prerelease06 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DCRedirectionPolicyDefault means no redirection
	DCRedirectionPolicyDefault = ""
	// DCRedirectionPolicyNoop means no redirection
	DCRedirectionPolicyNoop = "noop"
	// DCRedirectionPolicySelectedAPIsForwarding means forwarding the following non-worker APIs based domain
	// 1. StartWorkflowExecution
	// 2. SignalWithStartWorkflowExecution
	// 3. SignalWorkflowExecution
	// 4. RequestCancelWorkflowExecution
	// 5. TerminateWorkflowExecution
	// 6. QueryWorkflowStrongConsistency
	// 7. ResetWorkflow
	// please also reference selectedAPIsForwardingRedirectionPolicyAPIAllowlist and DCRedirectionPolicySelectedAPIsForwardingV2
	DCRedirectionPolicySelectedAPIsForwarding = "selected-apis-forwarding"
	// DCRedirectionPolicySelectedAPIsForwardingV2 forwards everything in DCRedirectionPolicySelectedAPIsForwarding,
	// as well as activity completions (sync and async) and heartbeats.
	// This is done because activity results are generally deemed "useful" and relatively costly to re-do (when it is
	// even possible to redo), but activity workers themselves may be datacenter-specific.
	//
	// This will likely replace DCRedirectionPolicySelectedAPIsForwarding soon.
	//
	// 1-7. from DCRedirectionPolicySelectedAPIsForwarding
	// 8. RecordActivityTaskHeartbeat
	// 9. RecordActivityTaskHeartbeatByID
	// 10. RespondActivityTaskCanceled
	// 11. RespondActivityTaskCanceledByID
	// 12. RespondActivityTaskCompleted
	// 13. RespondActivityTaskCompletedByID
	// 14. RespondActivityTaskFailed
	// 15. RespondActivityTaskFailedByID
	// please also reference selectedAPIsForwardingRedirectionPolicyAPIAllowlistV2
	DCRedirectionPolicySelectedAPIsForwardingV2 = "selected-apis-forwarding-v2"
	// DCRedirectionPolicyAllDomainAPIsForwarding means forwarding all the worker and non-worker APIs based domain,
	// and falling back to DCRedirectionPolicySelectedAPIsForwarding when the current active cluster is not the
	// cluster migration target.
	DCRedirectionPolicyAllDomainAPIsForwarding = "all-domain-apis-forwarding"
	// DCRedirectionPolicyAllDomainAPIsForwardingV2 means forwarding all the worker and non-worker APIs based domain,
	// and falling back to DCRedirectionPolicySelectedAPIsForwardingV2 when the current active cluster is not the
	// cluster migration target.
	DCRedirectionPolicyAllDomainAPIsForwardingV2 = "all-domain-apis-forwarding-v2"
)

Variables

This section is empty.

Functions

func NewAPIHandler

func NewAPIHandler(
	wfHandler api.Handler,
	resource resource.Resource,
	config *frontendcfg.Config,
	policy config.ClusterRedirectionPolicy,
) api.Handler

NewAPIHandler creates a frontend handler to handle cluster redirection for global domains not being active in current cluster

Types

type ClusterRedirectionPolicy

type ClusterRedirectionPolicy interface {
	WithDomainIDRedirect(ctx context.Context, domainID string, apiName string, call func(string) error) error
	WithDomainNameRedirect(ctx context.Context, domainName string, apiName string, call func(string) error) error
}

ClusterRedirectionPolicy is a DC redirection policy interface

func RedirectionPolicyGenerator

func RedirectionPolicyGenerator(clusterMetadata cluster.Metadata, config *frontendcfg.Config,
	domainCache cache.DomainCache, policy config.ClusterRedirectionPolicy) ClusterRedirectionPolicy

RedirectionPolicyGenerator generate corresponding redirection policy

type MockClusterRedirectionPolicy

type MockClusterRedirectionPolicy struct {
	mock.Mock
}

MockClusterRedirectionPolicy is an autogenerated mock type for the ClusterRedirectionPolicy type

func (*MockClusterRedirectionPolicy) WithDomainIDRedirect

func (_m *MockClusterRedirectionPolicy) WithDomainIDRedirect(ctx context.Context, domainID string, apiName string, call func(string) error) error

WithDomainIDRedirect provides a mock function with given fields: domainID, apiName, call

func (*MockClusterRedirectionPolicy) WithDomainNameRedirect

func (_m *MockClusterRedirectionPolicy) WithDomainNameRedirect(ctx context.Context, domainName string, apiName string, call func(string) error) error

WithDomainNameRedirect provides a mock function with given fields: domainName, apiName, call

Jump to

Keyboard shortcuts

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