ip

package
v2.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ACTIVATED = "ACTIVATED"
	STANDBY   = "STANDBY"
	FAILING   = "FAILING"
	BOOTING   = "BOOTING"
)
View Source
const (
	FaultEvent              = "fault"
	ElectedEvent            = "elected"
	DemotedEvent            = "demoted"
	HealthCheckFailEvent    = "health_check_fail"
	HealthCheckSuccessEvent = "health_check_success"
)

Variables

View Source
var (
	// ErrIsNotMaster is an error sent by Failover when the node is not currently master
	ErrIsNotMaster = errors.New("this node is not master of this IP")

	// ErrNoOtherHosts is an error sent by Failover when there is no other node to fail over.
	ErrNoOtherHosts = errors.New("no other nodes are listening for this IP")

	// ErrReallocationTimedOut is an error returned by waitForReallocation if the reallocation did not happen in less than KeepAliveInterval
	ErrReallocationTimedOut = errors.New("reallocation timed out")
)

Functions

func NewManager

func NewManager(ctx context.Context, cfg config.Config, ip models.IP, client *clientv3.Client, storage models.Storage, leaseManager locker.EtcdLeaseManager) (*manager, error)

func NewStateMachine

func NewStateMachine(ctx context.Context, opts NewStateMachineOpts) *fsm.FSM

Types

type Manager

type Manager interface {
	Start(context.Context)
	Stop(context.Context) error
	Failover(context.Context) error
	Status() string
	IP() models.IP
	SetHealthchecks(context.Context, config.Config, []models.Healthcheck)
}

type NewStateMachineOpts

type NewStateMachineOpts struct {
	ActivatedCallback func(ctx context.Context, e *fsm.Event)
	StandbyCallback   func(ctx context.Context, e *fsm.Event)
	FailingCallback   func(ctx context.Context, e *fsm.Event)
}

Jump to

Keyboard shortcuts

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