Documentation
¶
Overview ¶
Package config owns validated, generation-checked, atomic daemon configuration.
Index ¶
- Constants
- Variables
- type App
- type Device
- type Document
- type Plugin
- type Store
- func (s *Store) Load() (Document, error)
- func (s *Store) LoadDevice() (Device, error)
- func (s *Store) ReplaceWithOutcome(expected uint64, next Document) (localstate.CommitOutcome, error)
- func (s *Store) Update(expectedGeneration uint64, mutate func(*Document) error) (Document, localstate.CommitOutcome, error)
Constants ¶
const ( CurrentVersion = 1 MaxPlugins = 64 MaxApps = 256 )
Variables ¶
var ErrConflict = errors.New("configuration generation conflict")
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
ID string `json:"id"`
PluginID string `json:"plugin_id"`
Generation uint64 `json:"generation,omitzero"`
Enabled bool `json:"enabled"`
LaunchAction string `json:"launch_action,omitempty"`
Config json.RawMessage `json:"config"`
Secrets map[string]string `json:"secrets,omitempty"`
Policies map[string]presentation.PolicyConfig `json:"policies"`
}
App is one configured instance of a plugin package.
type Document ¶
type Document struct {
Version int `json:"version"`
Generation uint64 `json:"generation"`
Device Device `json:"device,omitempty"`
Plugins map[string]Plugin `json:"plugins"`
Apps map[string]App `json:"apps"`
}
Document is the complete non-secret desired state owned by the daemon.
type Plugin ¶
type Plugin struct {
ID string `json:"id"`
Version string `json:"version"`
Executable string `json:"executable"`
SHA256 string `json:"sha256,omitempty"`
ProtocolVersion string `json:"protocol_version"`
ExecutionModes []protocol.ExecutionMode `json:"execution_modes"`
Channels []protocol.Channel `json:"channels"`
Operations []protocol.OperationDescriptor `json:"operations,omitempty"`
ConfigSchema *configschema.Declaration `json:"config_schema,omitempty"`
PackageRoot string `json:"package_root,omitempty"`
Assets []assets.Declaration `json:"assets,omitempty"`
}
Plugin identifies one installed and verified executable.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store serializes durable replacements for one configuration path.
func (*Store) LoadDevice ¶
LoadDevice decodes and validates only the configuration envelope and device settings. It intentionally does not require unrelated runtime records to be valid for direct, read-only device diagnostics.
func (*Store) ReplaceWithOutcome ¶
func (s *Store) ReplaceWithOutcome(expected uint64, next Document) (localstate.CommitOutcome, error)
ReplaceWithOutcome persists next only when the current generation equals expected and reports whether the atomic rename committed.
func (*Store) Update ¶
func (s *Store) Update(expectedGeneration uint64, mutate func(*Document) error) (Document, localstate.CommitOutcome, error)
Update serializes load, clone, mutation, generation increment, validation, and atomic commit under one store lock. mutate must not re-enter this Store.