controlleragentconfig

package
v0.0.0-...-b9bb202 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package controlleragentconfig provides a worker that listens on the "/reload" endpoint of the config change socket and restarts any workers that have requested to watch the config. It also supplies the *agent* ID to external requesters via the "/agent-id" endpoint. It is a worker that listens for SIGHUP signals and reloads the agent configuration when one is received.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Manifold

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold returns a dependency manifold that runs the trace worker.

func NewWorker

func NewWorker(cfg WorkerConfig) (*configWorker, error)

NewWorker creates a new config worker.

Types

type ConfigWatcher

type ConfigWatcher interface {
	// Changes returns a channel that will dispatch changes when the agent
	// controller config changes.
	// The channel will be closed when the subscription is terminated or
	// the underlying worker is killed.
	Changes() <-chan struct{}
	// Done returns a channel that will be closed when the subscription is
	// closed.
	Done() <-chan struct{}
	// Unsubscribe unsubscribes the watcher from the agent controller config
	// changes.
	Unsubscribe()
}

ConfigWatcher is an interface that can be used to watch for changes to the agent controller config.

type ManifoldConfig

type ManifoldConfig struct {
	AgentName string
	Logger    logger.Logger
	Clock     clock.Clock
	// SocketName is the socket file descriptor.
	SocketName string
	// NewSocketListener is the function that creates a new socket listener.
	NewSocketListener func(socketlistener.Config) (SocketListener, error)
}

ManifoldConfig defines the configuration for the agent controller config manifold.

func (ManifoldConfig) Validate

func (cfg ManifoldConfig) Validate() error

Validate validates the manifold configuration.

type SocketListener

type SocketListener interface {
	worker.Worker
}

SocketListener describes a worker that listens on a unix socket.

func NewSocketListener

func NewSocketListener(config socketlistener.Config) (SocketListener, error)

NewSocketListener returns a new socket listener with the desired config.

type WorkerConfig

type WorkerConfig struct {
	// ControllerID is the ID of this controller.
	ControllerID string
	// Logger writes log messages.
	Logger logger.Logger
	// Clock is needed for worker.NewRunner.
	Clock clock.Clock
	// SocketName is the socket file descriptor.
	SocketName string
	// NewSocketListener is the function that creates a new socket listener.
	NewSocketListener func(socketlistener.Config) (SocketListener, error)
}

WorkerConfig encapsulates the configuration options for the agent controller config worker.

func (*WorkerConfig) Validate

func (c *WorkerConfig) Validate() error

Validate ensures that the config values are valid.

Jump to

Keyboard shortcuts

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