Documentation
¶
Index ¶
- type State
- func (st *State) AgentVersion(ctx context.Context) (string, error)
- func (st *State) AllKeysQuery() string
- func (st *State) ModelConfig(ctx context.Context) (map[string]string, error)
- func (st *State) ModelConfigHasAttributes(ctx context.Context, attrs []string) ([]string, error)
- func (st *State) SetModelConfig(ctx context.Context, config map[string]string) error
- func (st *State) SpaceExists(ctx context.Context, spaceName string) (bool, error)
- func (st *State) UpdateModelConfig(ctx context.Context, updateAttrs map[string]string, removeAttrs []string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type State ¶
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 ¶
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 ¶
AllKeysQuery returns a SQL statement that will return all known model config keys.
func (*State) ModelConfig ¶
ModelConfig returns the current model config key,value pairs for the model.
func (*State) ModelConfigHasAttributes ¶
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 ¶
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 ¶
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.