ha

package
v0.0.0-...-1cdf2d7 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 15 Imported by: 11

Documentation

Overview

Package ha implements high availability (HA) peering between Seesaw nodes using VRRP v3.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IPConn

func IPConn(localAddr, remoteAddr net.IP) (*net.IPConn, error)

IPConn creates a net.IPConn using the given local and remote addresses using IP protocol 112 (VRRP).

func JoinMulticastIPv6

func JoinMulticastIPv6(c *net.IPConn, gaddr, laddr net.IP) error

JoinMulticastIPv6 joins the multicast group address given by gaddr. laddr specifies which network interface to use when joining the group.

func ListenMulticastIPv4

func ListenMulticastIPv4(gaddr, laddr net.IP) (*net.IPConn, error)

ListenMulticastIPv4 creates a net.IPConn to receive multicast messages for the given group address. laddr specifies which network interface to use when joining the group.

Types

type DummyEngine

type DummyEngine struct {
	Config *seesaw.HAConfig
}

DummyEngine implements the Engine interface for testing purposes.

func (*DummyEngine) HAConfig

func (e *DummyEngine) HAConfig() (*seesaw.HAConfig, error)

HAConfig returns the HAConfig for a DummyEngine.

func (*DummyEngine) HAState

func (e *DummyEngine) HAState(state spb.HaState) error

HAState does nothing.

func (*DummyEngine) HAUpdate

func (e *DummyEngine) HAUpdate(status seesaw.HAStatus) (bool, error)

HAUpdate does nothing.

type Engine

type Engine interface {
	HAConfig() (*seesaw.HAConfig, error)
	HAState(spb.HaState) error
	HAUpdate(seesaw.HAStatus) (bool, error)
}

Engine represents an interface to a Seesaw Engine.

type EngineClient

type EngineClient struct {
	Socket string
}

EngineClient implements the Engine interface. It connects to the Seesaw Engine UNIX domain socket specified by Socket.

func (*EngineClient) HAConfig

func (e *EngineClient) HAConfig() (*seesaw.HAConfig, error)

HAConfig requests the HAConfig from the Seesaw Engine.

func (*EngineClient) HAState

func (e *EngineClient) HAState(state spb.HaState) error

HAState informs the Seesaw Engine of the current HAState.

func (*EngineClient) HAUpdate

func (e *EngineClient) HAUpdate(status seesaw.HAStatus) (bool, error)

HAUpdate informs the Seesaw Engine of the current HAStatus. The Seesaw Engine may request a failover in response.

type HAConn

type HAConn interface {
	// contains filtered or unexported methods
}

HAConn represents an HA connection for sending and receiving advertisements between two Nodes.

func NewIPHAConn

func NewIPHAConn(laddr, raddr net.IP) (HAConn, error)

NewIPHAConn creates a new IPHAConn.

type IPHAConn

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

IPHAConn implements the HAConn interface.

type Node

type Node struct {
	NodeConfig
	// contains filtered or unexported fields
}

Node represents one member of a high availability cluster.

func NewNode

func NewNode(cfg NodeConfig, conn HAConn, engine Engine, socket string) *Node

NewNode creates a new Node with the given NodeConfig and HAConn.

func (*Node) Run

func (n *Node) Run() error

Run sends and receives advertisements, changes this Node's state in response to incoming advertisements, and periodically notifies the engine of the current state. Run does not return until Shutdown is called or an unrecoverable error occurs.

func (*Node) Shutdown

func (n *Node) Shutdown()

Shutdown puts this Node in SHUTDOWN state and causes Run() to return.

type NodeConfig

type NodeConfig struct {
	seesaw.HAConfig
	ConfigCheckInterval     time.Duration
	ConfigCheckMaxFailures  int
	ConfigCheckRetryDelay   time.Duration
	MasterAdvertInterval    time.Duration
	Preempt                 bool
	StatusReportInterval    time.Duration
	StatusReportMaxFailures int
	StatusReportRetryDelay  time.Duration
}

NodeConfig specifies the configuration for a Node.

Jump to

Keyboard shortcuts

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