failovermanager

package
v1.2.9-prerelease3 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// TaskListName tasklist
	TaskListName = "cadence-sys-failoverManager-tasklist"
	// FailoverWorkflowTypeName workflow type name
	FailoverWorkflowTypeName = "cadence-sys-failoverManager-workflow"
	// RebalanceWorkflowTypeName is rebalance workflow type name
	RebalanceWorkflowTypeName = "cadence-sys-rebalance-workflow"
	// WorkflowID will be reused to ensure only one workflow running
	FailoverWorkflowID  = "cadence-failover-manager"
	RebalanceWorkflowID = "cadence-rebalance-workflow"
	DrillWorkflowID     = FailoverWorkflowID + "-drill"

	// QueryType for failover workflow
	QueryType = "state"
	// PauseSignal signal name for pause
	PauseSignal = "pause"
	// ResumeSignal signal name for resume
	ResumeSignal = "resume"

	// WorkflowInitialized state
	WorkflowInitialized = "initialized"
	// WorkflowRunning state
	WorkflowRunning = "running"
	// WorkflowPaused state
	WorkflowPaused = "paused"
	// WorkflowCompleted state
	WorkflowCompleted = "complete"
	// WorkflowAborted state
	WorkflowAborted = "aborted"
)

Variables

This section is empty.

Functions

func GetDomainsActivity

func GetDomainsActivity(ctx context.Context, params *GetDomainsActivityParams) ([]string, error)

GetDomainsActivity activity def

Types

type BootstrapParams

type BootstrapParams struct {
	// Config contains the configuration for scanner
	Config Config
	// ServiceClient is an instance of cadence service client
	ServiceClient workflowserviceclient.Interface
	// MetricsClient is an instance of metrics object for emitting stats
	MetricsClient metrics.Client
	Logger        log.Logger
	// TallyScope is an instance of tally metrics scope
	TallyScope tally.Scope
	// ClientBean is an instance of client.Bean for a collection of clients
	ClientBean client.Bean
}

BootstrapParams contains the set of params needed to bootstrap failover manager

type Config

type Config struct {
	AdminOperationToken dynamicconfig.StringPropertyFn
	// ClusterMetadata contains the metadata for this cluster
	ClusterMetadata cluster.Metadata
}

Config defines the configuration for failover

type DomainRebalanceData added in v0.22.0

type DomainRebalanceData struct {
	DomainName       string
	PreferredCluster string
}

DomainRebalanceData contains the result from getRebalanceDomains activity

func GetDomainsForRebalanceActivity added in v0.22.0

func GetDomainsForRebalanceActivity(ctx context.Context) ([]*DomainRebalanceData, error)

GetDomainsForRebalanceActivity activity fetch domains for rebalance

type FailoverActivityParams

type FailoverActivityParams struct {
	Domains                          []string
	TargetCluster                    string
	GracefulFailoverTimeoutInSeconds *int32
}

FailoverActivityParams params for activity

type FailoverActivityResult

type FailoverActivityResult struct {
	SuccessDomains []string
	FailedDomains  []string
}

FailoverActivityResult result for failover activity

func FailoverActivity

func FailoverActivity(ctx context.Context, params *FailoverActivityParams) (*FailoverActivityResult, error)

FailoverActivity activity def

type FailoverManager

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

FailoverManager of cadence worker service

func New

func New(params *BootstrapParams) *FailoverManager

New returns a new instance of FailoverManager

func (*FailoverManager) Start

func (s *FailoverManager) Start() error

Start starts the worker

func (*FailoverManager) Stop

func (s *FailoverManager) Stop()

Stop stops the worker

type FailoverParams

type FailoverParams struct {
	// TargetCluster is the destination of failover
	TargetCluster string
	// SourceCluster is from which cluster the domains are active before failover
	SourceCluster string
	// BatchFailoverSize is number of domains to failover in one batch
	BatchFailoverSize int
	// BatchFailoverWaitTimeInSeconds is the waiting time between batch failover
	BatchFailoverWaitTimeInSeconds int
	// Domains candidates to be failover
	Domains []string
	// DrillWaitTime defines the wait time of a failover drill
	DrillWaitTime time.Duration
	// GracefulFailoverTimeoutInSeconds
	GracefulFailoverTimeoutInSeconds *int32
}

FailoverParams is the arg for failoverWorkflow

type FailoverResult

type FailoverResult struct {
	SuccessDomains      []string
	FailedDomains       []string
	SuccessResetDomains []string
	FailedResetDomains  []string
}

FailoverResult is workflow result

func FailoverWorkflow

func FailoverWorkflow(ctx workflow.Context, params *FailoverParams) (*FailoverResult, error)

FailoverWorkflow is the workflow that managed failover all domains with IsManagedByCadence=true

type GetDomainsActivityParams

type GetDomainsActivityParams struct {
	TargetCluster string
	SourceCluster string
	Domains       []string
}

GetDomainsActivityParams params for activity

type QueryResult

type QueryResult struct {
	TotalDomains        int
	Success             int
	Failed              int
	State               string
	TargetCluster       string
	SourceCluster       string
	SuccessDomains      []string // SuccessDomains are guaranteed succeed processed
	FailedDomains       []string // FailedDomains contains false positive
	SuccessResetDomains []string // SuccessResetDomains are domains successfully reset in drill mode
	FailedResetDomains  []string // FailedResetDomains contains false positive in drill mode
	Operator            string
}

QueryResult for failover progress

type RebalanceParams added in v0.22.0

type RebalanceParams struct {
	// BatchFailoverSize is number of domains to failover in one batch
	BatchFailoverSize int
	// BatchFailoverWaitTimeInSeconds is the waiting time between batch failover
	BatchFailoverWaitTimeInSeconds int
}

RebalanceParams contains parameters for rebalance workflow

type RebalanceResult added in v0.22.0

type RebalanceResult struct {
	SuccessDomains []string
	FailedDomains  []string
}

RebalanceResult contains the result from the rebalance workflow

func RebalanceWorkflow added in v0.22.0

func RebalanceWorkflow(ctx workflow.Context, params *RebalanceParams) (*RebalanceResult, error)

RebalanceWorkflow is to rebalance domains across clusters based on rebalance policy.

Jump to

Keyboard shortcuts

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