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 State

type State struct {
	*domain.StateBase
}

State is a reference to the underlying data accessor for ModelConfig data.

func NewState

func NewState(factory coredatabase.TxnRunnerFactory) *State

NewState creates a new ModelConfig state struct for querying the state.

func (*State) AgentVersion

func (st *State) AgentVersion(ctx context.Context) (string, error)

AgentVersion returns the current models agent version. If no agent version can be found an error satisfying errors.NotFound will be returned.

func (*State) AllKeysQuery

func (st *State) AllKeysQuery() string

AllKeysQuery returns a SQL statement that will return all known model config keys.

func (*State) ModelConfig

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

ModelConfig returns the current model config key,value pairs for the model.

func (*State) ModelConfigHasAttributes

func (st *State) ModelConfigHasAttributes(
	ctx context.Context,
	attrs []string,
) ([]string, error)

ModelConfigHasAttributes will take a set of model config attributes and return the subset of keys that are set and exist in the Model Config.

func (*State) SetModelConfig

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

SetModelConfig is responsible for overwriting the currently set model config with new values. SetModelConfig will remove all existing model config even when an empty map is supplied.

func (*State) SpaceExists

func (st *State) SpaceExists(ctx context.Context, spaceName string) (bool, error)

SpaceExists checks if the space identified by the given space name exists.

func (*State) UpdateModelConfig

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

UpdateModelConfig is responsible for updating the model's config key and values. This function will allow the addition and updating of attributes. Attributes can also be removed by keys if they exist for the current model.

Jump to

Keyboard shortcuts

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