Help us shape the future of Go! Take the 2026 Go Developer Survey

worker

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: May 21, 2021 License: MPL-2.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// The base Server object, containing things shared between Controllers and
	// Workers
	*base.Server
	// The underlying configuration, passed in here to avoid duplicating values
	// everwyehere
	RawConfig *config.Config
}

type HandlerProperties

type HandlerProperties struct {
	ListenerConfig *configutil.Listener
}

type LastStatusInformation

type LastStatusInformation struct {
	*pbs.StatusResponse
	StatusTime time.Time
}

type TestWorker

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

TestWorker wraps a base.Server and Worker to provide a fully-programmatic worker for tests. Error checking (for instance, for valid config) is not stringent at the moment.

func NewTestWorker

func NewTestWorker(t *testing.T, opts *TestWorkerOpts) *TestWorker

func (*TestWorker) AddClusterWorkerMember

func (tw *TestWorker) AddClusterWorkerMember(t *testing.T, opts *TestWorkerOpts) *TestWorker

func (*TestWorker) Cancel

func (tw *TestWorker) Cancel()

func (*TestWorker) Config

func (tw *TestWorker) Config() *Config

func (*TestWorker) Context

func (tw *TestWorker) Context() context.Context

func (*TestWorker) ControllerAddrs

func (tw *TestWorker) ControllerAddrs() []string

func (*TestWorker) Name

func (tw *TestWorker) Name() string

func (*TestWorker) ProxyAddrs

func (tw *TestWorker) ProxyAddrs() []string

func (*TestWorker) Shutdown

func (tw *TestWorker) Shutdown()

Shutdown runs any cleanup functions; be sure to run this after your test is done

func (*TestWorker) Worker

func (tw *TestWorker) Worker() *Worker

Worker returns the underlying controller

type TestWorkerOpts

type TestWorkerOpts struct {
	// Config; if not provided a dev one will be created
	Config *config.Config

	// Sets initial controller addresses
	InitialControllers []string

	// If true, the worker will not be started
	DisableAutoStart bool

	// The worker auth KMS to use, or one will be created
	WorkerAuthKms wrapping.Wrapper

	// The name to use for the worker, otherwise one will be randomly
	// generated, unless provided in a non-nil Config
	Name string

	// The logger to use, or one will be created
	Logger hclog.Logger
}

type Worker

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

func New

func New(conf *Config) (*Worker, error)

func (*Worker) LastStatusSuccess

func (w *Worker) LastStatusSuccess() *LastStatusInformation

LastStatusSuccess is used in tests (it's exported for tests in other packages) to verify the last time we sent status

func (*Worker) ParseAndStoreTags added in v0.1.8

func (w *Worker) ParseAndStoreTags(incoming map[string][]string)

func (*Worker) Resolver

func (w *Worker) Resolver() *manual.Resolver

func (*Worker) Shutdown

func (w *Worker) Shutdown(skipListeners bool) error

Shutdown shuts down the workers. skipListeners can be used to not stop listeners, useful for tests if we want to stop and start a worker. In order to create new listeners we'd have to migrate listener setup logic here -- doable, but work for later.

func (*Worker) Start

func (w *Worker) Start() error

Jump to

Keyboard shortcuts

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