settings

package
v0.27.3 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: AGPL-3.0 Imports: 12 Imported by: 1 module, 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 settings owns durable host and plugin settings transactions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Binding

type Binding struct{ Service *Service }

Binding exposes only authorized settings operations to the desktop transport.

func (*Binding) Commit

func (b *Binding) Commit(scope Scope, values map[string]any) (CommitResult, error)

func (*Binding) GetSnapshot

func (b *Binding) GetSnapshot(scope Scope) (Snapshot, error)

func (*Binding) Validate

func (b *Binding) Validate(scope Scope, id string, value any) (pkgsettings.ValidationResult, error)

type CommitError

type CommitError struct {
	Validation bool
	// contains filtered or unexported fields
}

CommitError distinguishes invalid proposals from storage or transport failures. Error text is safe for public transports; trusted callers may unwrap the cause.

func (*CommitError) Error

func (e *CommitError) Error() string

func (*CommitError) Unwrap

func (e *CommitError) Unwrap() error

type CommitResult

type CommitResult struct {
	Snapshot  Snapshot `json:"snapshot"`
	Applied   bool     `json:"applied"`
	Uncertain bool     `json:"uncertain"`
	Message   string   `json:"message"`
}

type Diagnostic

type Diagnostic struct {
	CategoryID string
	SettingID  string
	Message    string
}

type Migration

type Migration func(map[string]any) (map[string]any, bool)

type Options

type Options struct {
	Store      *settingsstore.Store
	Categories []pkgsettings.Category
	Migrations map[string]Migration
	Logger     *zap.SugaredLogger
}

type Plugins

type Plugins interface {
	Snapshot(string) (pkgsettings.Category, error)
	ValidateSetting(string, string, any) (pkgsettings.ValidationResult, error)
	CommitSettings(context.Context, string, map[string]any, pkgsettings.PersistFunc) (pkgsettings.CommitResult, error)
}

type Scope

type Scope struct {
	Kind     string `json:"kind"`
	PluginID string `json:"pluginId,omitempty"`
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func Initialize

func Initialize(opts Options) (*Service, error)

func (*Service) AttachPlugins

func (s *Service) AttachPlugins(p Plugins)

func (*Service) CategoryValues

func (s *Service) CategoryValues(id string) map[string]any

func (*Service) Commit

func (s *Service) Commit(scope Scope, values map[string]any) (CommitResult, error)

func (*Service) Diagnostics

func (s *Service) Diagnostics() []Diagnostic

func (*Service) GetSnapshot

func (s *Service) GetSnapshot(scope Scope) (Snapshot, error)

func (*Service) Provider

func (s *Service) Provider() pkgsettings.Provider

func (*Service) RejectedSettingIDs

func (s *Service) RejectedSettingIDs() []string

func (*Service) SetApplyHandler

func (s *Service) SetApplyHandler(fn func(string, map[string]any) error)

func (*Service) SetChangeHandler

func (s *Service) SetChangeHandler(fn func(Scope))

func (*Service) Validate

func (s *Service) Validate(scope Scope, id string, value any) (pkgsettings.ValidationResult, error)

type Snapshot

type Snapshot struct {
	Scope      Scope             `json:"scope"`
	Categories pkgsettings.Store `json:"categories"`
}

Jump to

Keyboard shortcuts

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