orchestrator

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChanneledTransport

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

func NewChanneledTransport

func NewChanneledTransport() *ChanneledTransport

func (*ChanneledTransport) Close

func (t *ChanneledTransport) Close() error

func (*ChanneledTransport) IsClosed

func (t *ChanneledTransport) IsClosed() bool

func (*ChanneledTransport) Off

func (t *ChanneledTransport) Off() (sigSent bool)

func (*ChanneledTransport) On

func (t *ChanneledTransport) On() (sigSent bool)

func (*ChanneledTransport) OnOff

func (t *ChanneledTransport) OnOff() <-chan struct{}

func (*ChanneledTransport) OnOn

func (t *ChanneledTransport) OnOn() <-chan struct{}

func (*ChanneledTransport) OnPing

func (t *ChanneledTransport) OnPing() <-chan struct{}

func (*ChanneledTransport) OnPong

func (t *ChanneledTransport) OnPong() <-chan struct{}

func (*ChanneledTransport) OnReload

func (t *ChanneledTransport) OnReload() <-chan Config

func (*ChanneledTransport) OnScaleTo

func (t *ChanneledTransport) OnScaleTo() <-chan int

func (*ChanneledTransport) OnStart

func (t *ChanneledTransport) OnStart() <-chan Config

func (*ChanneledTransport) OnStop

func (t *ChanneledTransport) OnStop() <-chan struct{}

func (*ChanneledTransport) Ping

func (t *ChanneledTransport) Ping() (sigSent bool)

func (*ChanneledTransport) Pong

func (t *ChanneledTransport) Pong() (sigSent bool)

func (*ChanneledTransport) Reload

func (t *ChanneledTransport) Reload(cfg Config) (sigSent bool)

func (*ChanneledTransport) ScaleTo

func (t *ChanneledTransport) ScaleTo(n int) (sigSent bool)

func (*ChanneledTransport) Start

func (t *ChanneledTransport) Start(cfg Config) (sigSent bool)

func (*ChanneledTransport) Stop

func (t *ChanneledTransport) Stop() (sigSent bool)

type Config

type Config interface {
	GetEnabled() bool
	GetReplicas() int
	SetReplicas(n int)
	GetLimitOrInterval() int64
}

type Governor

type Governor interface {
	Register(name string, s Service)
	On(name string) error
	Off(name string) error
	Start(name string, cfg Config) error
	Reload(name string, cfg Config) error
	ScaleTo(name string, n int) error
	Stop()
}

type Orchestrator

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

func New

func New() *Orchestrator

func (*Orchestrator) Off

func (o *Orchestrator) Off(name string) error

func (*Orchestrator) On

func (o *Orchestrator) On(name string) error

func (*Orchestrator) Register

func (o *Orchestrator) Register(name string, s Service)

func (*Orchestrator) Reload

func (o *Orchestrator) Reload(name string, cfg Config) error

func (*Orchestrator) ScaleTo

func (o *Orchestrator) ScaleTo(name string, n int) error

func (*Orchestrator) Start

func (o *Orchestrator) Start(name string, cfg Config) error

func (*Orchestrator) Stop

func (o *Orchestrator) Stop()

type Scalable

type Scalable interface {
	ScaleTo(n int) error
	Replicas() int
}

Scalable is optionally implemented by services that can change instance counts.

type Service

type Service interface {
	Name() string
	Replicas() int
	Serve(t Transport)
	Transport() Transport
}

Service is implemented by a worker group (evictor, refresher, logger, ...).

type ServiceState

type ServiceState struct {
	Name           string
	State          State
	DesiredEnabled bool
	DesiredInst    int
	Active         bool
	Instances      int
	Failures       int
	LastError      string
	LastCheck      time.Time
	Uptime         time.Duration
	CfgHash        string
}

ServiceState is a cheap snapshot for UIs and tests.

type State

type State int32

Public, externally visible states of a service group supervised by the governor.

const (
	OFF State = iota
	STARTING
	RUNNING
	RELOADING
	SCALING
	STOPPING
	DISABLED
	FAILED
)

func (State) String

func (s State) String() string

type Transport

type Transport interface {
	Start(cfg Config) (sigSent bool)
	Ping() (sigSent bool) // orchestrator -> ping -> worker
	Pong() (sigSent bool) // worker -> pong -> orchestrator
	On() (sigSent bool)
	Off() (sigSent bool)
	Reload(cfg Config) (sigSent bool)
	ScaleTo(n int) (sigSent bool)
	Stop() (sigSent bool)
	IsClosed() bool
	Close() error

	OnStart() <-chan Config
	OnPing() <-chan struct{}
	OnPong() <-chan struct{}
	OnOn() <-chan struct{}
	OnOff() <-chan struct{}
	OnReload() <-chan Config
	OnScaleTo() <-chan int
	OnStop() <-chan struct{}
}

Jump to

Keyboard shortcuts

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