config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: GPL-3.0 Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package config owns validated, generation-checked, atomic daemon configuration.

Index

Constants

View Source
const (
	CurrentVersion = 1

	MaxPlugins = 64
	MaxApps    = 256
)

Variables

View Source
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 Device

type Device struct {
	BaseURL           string `json:"base_url,omitempty"`
	AccessTokenSecret string `json:"access_token_secret,omitempty"`
}

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.

func (Document) Validate

func (d Document) Validate() error

Validate checks cross-reference, path, policy, and secret-reference invariants.

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 NewStore

func NewStore(path string) *Store

func (*Store) Load

func (s *Store) Load() (Document, error)

Load decodes one bounded document and rejects unknown or trailing input.

func (*Store) LoadDevice

func (s *Store) LoadDevice() (Device, error)

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.

Jump to

Keyboard shortcuts

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