state

package
v0.0.0-...-56cb166 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	UUID string `db:"uuid"`
	Name string `db:"name"`
}

type KeyValue

type KeyValue struct {
	Key   string `db:"key"`
	Value string `db:"value"`
}

type State

type State struct {
	*domain.StateBase
}

State represents a type for interacting with the underlying state.

func NewState

func NewState(factory database.TxnRunnerFactory) *State

NewState returns a new State for interacting with the underlying state.

func (*State) AllKeysQuery

func (*State) AllKeysQuery() string

AllKeysQuery returns a SQL statement that will return all known controller configuration keys.

func (*State) ControllerConfig

func (st *State) ControllerConfig(ctx context.Context) (map[string]string, error)

ControllerConfig returns the current configuration in the database.

func (*State) UpdateControllerConfig

func (st *State) UpdateControllerConfig(
	ctx context.Context,
	updateAttrs map[string]string, removeAttrs []string,
	validateModification func(map[string]string) error,
) error

UpdateControllerConfig allows changing some of the configuration for the controller. Changes passed in updateAttrs will be applied to the current config, and keys in removeAttrs will be unset (and so revert to their defaults). Only a subset of keys can be changed after bootstrapping. ValidateModification is a function that will be called with the current config, and should return an error if the modification is not allowed.

type StringSlice

type StringSlice []string

Jump to

Keyboard shortcuts

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