controlsocket

package
v0.0.0-...-ac56535 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Package controlsocket defines the controlsocket worker, which exposes a Unix socket that the juju-controller charm can use to affect Juju state.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Manifold

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold returns a Manifold that encapsulates the controlsocket worker.

func NewWorker

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

NewWorker returns a controlsocket worker with the given config.

Types

type Config

type Config struct {
	State      State
	Logger     Logger
	SocketName string
}

Config represents configuration for the controlsocket worker.

func (Config) Validate

func (config Config) Validate() error

Validate returns an error if config cannot drive the Worker.

type Logger

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

Logger represents the methods used by the worker to log information.

type ManifoldConfig

type ManifoldConfig struct {
	StateName  string
	Logger     Logger
	NewWorker  func(Config) (worker.Worker, error)
	SocketName string
}

ManifoldConfig describes the dependencies required by the controlsocket worker.

func (ManifoldConfig) Validate

func (cfg ManifoldConfig) Validate() error

Validate is called by start to check for bad configuration.

type State

type State interface {
	User(tag names.UserTag) (user, error)
	AddUser(name string, displayName string, password string, creator string) (user, error)
	RemoveUser(tag names.UserTag) error
	Model() (model, error)
}

State defines the state methods that the controlsocket worker needs.

type Worker

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

Worker is a controlsocket worker.

func (*Worker) Kill

func (w *Worker) Kill()

func (*Worker) Wait

func (w *Worker) Wait() error

Jump to

Keyboard shortcuts

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