controllerport

package
v0.0.0-...-9ec3720 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetControllerConfig

func GetControllerConfig(st *state.State) (controller.Config, error)

GetControllerConfig gets the controller config from the given state - it's a shim so we can test the manifold without a state suite.

func Manifold

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold returns a dependency.Manifold that will run an HTTP server worker. The manifold outputs an *apiserverhttp.Mux, for other workers to register handlers against.

func NewWorker

func NewWorker(config Config) (worker.Worker, error)

NewWorker returns a new API server worker, with the given configuration.

Types

type Config

type Config struct {
	AgentConfig             agent.Config
	Hub                     *pubsub.StructuredHub
	Logger                  Logger
	ControllerAPIPort       int
	UpdateControllerAPIPort func(int) error
}

Config is the configuration required for running an API server worker.

func (Config) Validate

func (config Config) Validate() error

Validate validates the API server configuration.

type Logger

type Logger interface {
	Debugf(string, ...interface{})
	Infof(string, ...interface{})
	Errorf(string, ...interface{})
}

Logger defines the methods needed for the worker to log messages.

type ManifoldConfig

type ManifoldConfig struct {
	AgentName string
	HubName   string
	StateName string

	Logger                  Logger
	UpdateControllerAPIPort func(int) error

	GetControllerConfig func(*state.State) (controller.Config, error)
	NewWorker           func(Config) (worker.Worker, error)
}

ManifoldConfig holds the information necessary to determine the controller api port and keep it up to date.

func (ManifoldConfig) Validate

func (config ManifoldConfig) Validate() error

Validate validates the manifold configuration.

type Worker

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

Worker is responsible for updating the agent config when the controller api port value changes, and then bouncing the worker to notify the other dependent workers, which should be the peer-grouper and http-server.

func (*Worker) Kill

func (w *Worker) Kill()

Kill implements Worker.Kill.

func (*Worker) Wait

func (w *Worker) Wait() error

Wait implements Worker.Wait.

Jump to

Keyboard shortcuts

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