configset

package
v0.44.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 7 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplyConfigSet

type ApplyConfigSet interface {
	// Directive indicates ApplyConfigSet is a directive.
	directive.Directive

	// GetApplyConfigSet returns the configset to apply.
	GetApplyConfigSet() ConfigSet
}

ApplyConfigSet is a directive to apply a controllerbus config set. Value type: ApplyConfigSetValue

func NewApplyConfigSet

func NewApplyConfigSet(configSet ConfigSet) ApplyConfigSet

NewApplyConfigSet constructs a new ApplyConfigSet directive.

type ApplyConfigSetValue

type ApplyConfigSetValue = State

ApplyConfigSetValue is the result type for ApplyConfigSet. The value is removed and replaced when any values change.

type ConfigSet

type ConfigSet map[string]ControllerConfig

ConfigSet is a key/value set of controller configs.

func MergeConfigSets added in v0.15.0

func MergeConfigSets(sets ...ConfigSet) ConfigSet

MergeConfigSets merges multiple config sets to one ConfigSet.

func (ConfigSet) Equal

func (c ConfigSet) Equal(os ConfigSet) bool

Equal checks if the configset is equal to the other.

type Controller

type Controller interface {
	// Controller indicates this is a controllerbus controller.
	controller.Controller

	// PushControllerConfig pushes a controller configuration for a given key, if
	// the version is newer. Returns a reference to the configset, or an error.
	//
	// Ctx is used for the context of the function call only.
	PushControllerConfig(
		ctx context.Context,
		key string,
		conf ControllerConfig,
	) (Reference, error)
}

Controller is a configset controller.

type ControllerConfig

type ControllerConfig interface {
	// GetRev returns the revision.
	GetRev() uint64
	// GetConfig returns the config object.
	GetConfig() config.Config
}

ControllerConfig is a wrapped controller configuration.

func NewControllerConfig

func NewControllerConfig(rev uint64, conf config.Config) ControllerConfig

NewControllerConfig constructs a controller config object.

type LookupConfigSet added in v0.8.7

type LookupConfigSet interface {
	// Directive indicates LookupConfigSet is a directive.
	directive.Directive

	// GetLookupConfigSetControllerKeys returns the controller ids to lookup.
	// These are the keys in the configset map.
	GetLookupConfigSetControllerKeys() []string
}

LookupConfigSet looks up the status of ConfigSet controllers. Value type: LookupConfigSetValue

func NewLookupConfigSet added in v0.8.7

func NewLookupConfigSet(controllerKeys []string) LookupConfigSet

NewLookupConfigSet constructs a new LookupConfigSet directive.

type LookupConfigSetValue added in v0.8.7

type LookupConfigSetValue = State

LookupConfigSetValue is the result type for LookupConfigSet. The value is removed and replaced when any values change.

type Reference

type Reference interface {
	// GetConfigKey returns the configset key for this controller.
	GetConfigKey() string
	// GetState returns the current state object.
	GetState() State
	// AddStateCallback adds a callback that is called when the state changes.
	// Should not block.
	// Will be called with the initial state.
	AddStateCallback(func(State))
	// Release releases the reference.
	Release()
}

Reference is a reference to a pushed controller config. The reference is used to monitor the state of the controller and release the reference when no longer needed, so that the configured controllers can be properly terminated when no longer needed.

type State

type State interface {
	// GetId returns the controller id.
	GetId() string
	// GetControllerConfig returns the current controller config in use.
	GetControllerConfig() ControllerConfig
	// GetController returns the controller instance if running.
	// Returns nil otherwise.
	GetController() controller.Controller
	// GetError returns any error processing the controller config.
	GetError() error
}

State contains controller state.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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