failover

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TaskQueued = iota + 1
	TaskStarted
	TaskSuccess
	TaskFailed
)
View Source
const (
	AutoType = iota + 1
	ManualType
)

Variables

View Source
var (
	// PingInterval stands ping period, at least more than double ProbeInterval
	PingInterval = 6

	MaxPingCount = 2

	// MinAliveSize is min number of cluster nodes to enter the safe mode
	MinAliveSize = 10

	// MaxFailureRatio is gate value, more than clusters failed enter the safe mode
	MaxFailureRatio = 0.4

	GCInterval = 1
)

Functions

This section is empty.

Types

type Cluster

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

func NewCluster

func NewCluster(ns, cluster string, stor *storage.Storage) *Cluster

NewCluster return a Cluster instance and start schedule goroutine

func (*Cluster) AddTask

func (c *Cluster) AddTask(task *storage.FailoverTask) error

func (*Cluster) Close

func (c *Cluster) Close() error

Close will release the resource when closing

func (*Cluster) GetTasks

func (c *Cluster) GetTasks() ([]*storage.FailoverTask, error)

func (*Cluster) IsEmpty

func (c *Cluster) IsEmpty() bool

IsEmpty return an indicator whether the tasks queue has tasks, callend gcClusters

func (*Cluster) RemoveNodeTask

func (c *Cluster) RemoveNodeTask(addr string)

type Failover added in v0.2.0

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

func New

func New(storage *storage.Storage) *Failover

func (*Failover) AddNode added in v0.2.0

func (f *Failover) AddNode(ns, cluster string, shardIdx int, node metadata.NodeInfo, typ int) error

func (*Failover) AddNodeTask added in v0.2.0

func (f *Failover) AddNodeTask(task *storage.FailoverTask) error

func (*Failover) GetTasks added in v0.2.0

func (f *Failover) GetTasks(ctx context.Context, ns, cluster string, queryType string) ([]*storage.FailoverTask, error)

func (*Failover) Load added in v0.2.0

func (f *Failover) Load() error

func (*Failover) Shutdown added in v0.2.0

func (f *Failover) Shutdown()

Jump to

Keyboard shortcuts

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