scheduler

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: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrIPAlreadyAssigned can be sent by AddIP if the IP has already been assigned to this scheduler
	ErrIPAlreadyAssigned = errors.New("IP already assigned")

	// ErrIPNotFound can be sent if an operation has been called on an unregistered IP
	ErrIPNotFound = errors.New("IP not found")
)

Functions

This section is empty.

Types

type IPScheduler

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

IPScheduler is LinK implementation of the Scheduler Interface

func NewIPScheduler

func NewIPScheduler(config config.Config, etcd *clientv3.Client, storage models.Storage, leaseManager locker.EtcdLeaseManager) *IPScheduler

NewIPScheduler creates and configures a Scheduler

func (*IPScheduler) ConfiguredIPs

func (s *IPScheduler) ConfiguredIPs(ctx context.Context) []api.IP

ConfiguredIPs lists all IPs currently tracked by the scheduler

func (*IPScheduler) Failover

func (s *IPScheduler) Failover(ctx context.Context, id string) error

Failover triggers a failover on a specific IP

func (*IPScheduler) GetIP

func (s *IPScheduler) GetIP(ctx context.Context, id string) *api.IP

GetIP fetches basic information about a tracked IP

func (*IPScheduler) Start

func (s *IPScheduler) Start(ctx context.Context, ipAddr models.IP) (models.IP, error)

Start schedules a new IP on the host. It launches a new manager for the IP and add it to the tracked IP on this host.

func (*IPScheduler) Status

func (s *IPScheduler) Status(id string) string

Status gives you access to the state machine status of a specific IP

func (*IPScheduler) Stop

func (s *IPScheduler) Stop(ctx context.Context, id string) error

Stop the manager of the specified IP and remove it from the tracked IP

func (*IPScheduler) UpdateIP

func (s *IPScheduler) UpdateIP(ctx context.Context, ip models.IP) error

UpdateIP updates the IP in the scheduler storage, and the healthchecks in the IP manager.

type Scheduler

type Scheduler interface {
	Start(context.Context, models.IP) (models.IP, error)
	Stop(ctx context.Context, id string) error
	Failover(ctx context.Context, id string) error
	Status(string) string
	ConfiguredIPs(ctx context.Context) []api.IP
	GetIP(ctx context.Context, id string) *api.IP
	UpdateIP(context.Context, models.IP) error
}

Scheduler is the central point of LinK it will keep track all of IPs registered on this node however the heavy lifting for a single IP is done in the Manager

Directories

Path Synopsis
Package schedulermock is a generated GoMock package.
Package schedulermock is a generated GoMock package.

Jump to

Keyboard shortcuts

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