scheduler

package
v3.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrEndpointAlreadyAssigned can be sent by Start if there is another endpoint with the same election key
	ErrEndpointAlreadyAssigned = stderrors.New("An endpoint with the same election key already exists on that host")

	// ErrEndpointNotFound can be sent if an operation has been called on an unregistered Endpoint
	ErrEndpointNotFound = stderrors.New("Endpoint not found")
)

Functions

This section is empty.

Types

type EndpointScheduler

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

EndpointScheduler is LinK implementation of the Scheduler Interface

func NewEndpointScheduler

func NewEndpointScheduler(config config.Config, etcd *etcdv3.Client, storage models.Storage, leaseManager locker.EtcdLeaseManager, registry plugin.Registry) *EndpointScheduler

NewEndpointScheduler creates and configures a Scheduler

func (*EndpointScheduler) ConfiguredEndpoints

func (s *EndpointScheduler) ConfiguredEndpoints(ctx context.Context) EndpointsWithStatus

ConfiguredEndpoints lists all endpoints currently tracked by the scheduler

func (*EndpointScheduler) EndpointCount added in v3.1.0

func (s *EndpointScheduler) EndpointCount() int

func (*EndpointScheduler) Failover

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

Failover triggers a failover on a specific endpoint

func (*EndpointScheduler) GetEndpoint

func (s *EndpointScheduler) GetEndpoint(ctx context.Context, id string) *EndpointWithStatus

GetEndpoint fetches basic information about a tracked endpoint

func (*EndpointScheduler) Start

func (s *EndpointScheduler) Start(ctx context.Context, endpoint models.Endpoint) (models.Endpoint, error)

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

func (*EndpointScheduler) Status

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

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

func (*EndpointScheduler) Stop

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

Stop the manager of the specified endpoint and remove it from the tracked endpoints

func (*EndpointScheduler) UpdateEndpoint

func (s *EndpointScheduler) UpdateEndpoint(ctx context.Context, endpoint models.Endpoint) error

UpdateEndpoint updates the endpoint in the scheduler storage, and the health checks in the endpoint manager.

type EndpointWithStatus

type EndpointWithStatus struct {
	models.Endpoint

	Status      string
	ElectionKey string
}

func (EndpointWithStatus) ToAPIType

func (e EndpointWithStatus) ToAPIType() api.Endpoint

type EndpointsWithStatus

type EndpointsWithStatus []EndpointWithStatus

func (EndpointsWithStatus) ToAPIType

func (e EndpointsWithStatus) ToAPIType() []api.Endpoint

type Scheduler

type Scheduler interface {
	Start(ctx context.Context, endpoint models.Endpoint) (models.Endpoint, error)
	Stop(ctx context.Context, id string) error
	Failover(ctx context.Context, id string) error
	Status(id string) string
	ConfiguredEndpoints(ctx context.Context) EndpointsWithStatus
	GetEndpoint(ctx context.Context, id string) *EndpointWithStatus
	EndpointCount() int
	UpdateEndpoint(ctx context.Context, endpoint models.Endpoint) error
}

Scheduler is the central point of LinK it will keep track all of endpoints registered on this node however the heavy lifting for a single endpoint 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