Documentation
¶
Overview ¶
Package settings owns durable host and plugin settings transactions.
Index ¶
- type Binding
- type CommitError
- type CommitResult
- type Diagnostic
- type Migration
- type Options
- type Plugins
- type Scope
- type Service
- func (s *Service) AttachPlugins(p Plugins)
- func (s *Service) CategoryValues(id string) map[string]any
- func (s *Service) Commit(scope Scope, values map[string]any) (CommitResult, error)
- func (s *Service) Diagnostics() []Diagnostic
- func (s *Service) GetSnapshot(scope Scope) (Snapshot, error)
- func (s *Service) Provider() pkgsettings.Provider
- func (s *Service) RejectedSettingIDs() []string
- func (s *Service) SetApplyHandler(fn func(string, map[string]any) error)
- func (s *Service) SetChangeHandler(fn func(Scope))
- func (s *Service) Validate(scope Scope, id string, value any) (pkgsettings.ValidationResult, error)
- type Snapshot
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) 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 Diagnostic ¶
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 Service ¶
type Service struct {
// contains filtered or unexported fields
}
func Initialize ¶
func (*Service) AttachPlugins ¶
func (*Service) Diagnostics ¶
func (s *Service) Diagnostics() []Diagnostic
func (*Service) Provider ¶
func (s *Service) Provider() pkgsettings.Provider
func (*Service) RejectedSettingIDs ¶
func (*Service) SetApplyHandler ¶
func (*Service) SetChangeHandler ¶
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"`
}