extensions

package
v0.41.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: BSD-3-Clause-Clear Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidExtensionNamespace = errors.New("invalid extension namespace")
	ErrDuplicateExtension        = errors.New("duplicate extension registration")
	ErrExtensionNotRegistered    = errors.New("extension not registered for scope")
	ErrExtensionTypeMismatch     = errors.New("extension type does not match registration")
	ErrExtensionDecode           = errors.New("cannot decode extension")
	ErrExtensionEncode           = errors.New("cannot encode extension")
)

Functions

func ReadGlobal

func ReadGlobal[T any](config *Config, namespace string) (T, bool, error)

ReadGlobal reports absence separately from a stored JSON null or decoding error.

func ReadProfile

func ReadProfile[T any](config *Config, profileName, namespace string) (T, bool, error)

ReadProfile reads one named profile without selecting or changing the default.

func WriteGlobal

func WriteGlobal[T any](config *Config, namespace string, value T) error

WriteGlobal fully replaces one global namespace with value, without retaining omitted payload fields. The extender owns compatibility, unknown-field retention, validation, and versioning for its replacement payload.

func WriteProfile

func WriteProfile[T any](config *Config, profileName, namespace string, value T) error

WriteProfile fully replaces one namespace in an existing named profile, without retaining omitted payload fields. The extender owns compatibility, unknown-field retention, validation, and versioning for its replacement payload.

Types

type Config

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

Config binds registrations to an existing profiler/driver invocation. It does not automatically expose payloads through CLI output or diagnostics.

func NewConfig

func NewConfig(profiler *osprofiles.Profiler, opts ...Option) (*Config, error)

NewConfig accepts an existing profiler from profiles.CreateProfiler or profiles.NewProfiler. A global registration does not require any profile to exist.

type Option

type Option func(*Config) error

Option registers one consumer shape for a namespace and scope. Registrations belong to one Config, never to a package-wide registry.

func WithGlobal

func WithGlobal[T any](namespace string) Option

WithGlobal declares the JSON shape owned by namespace in global settings. The extender owns compatibility, unknown-field retention, validation, and versioning for its payload; typed writes replace this namespace without retaining omitted fields.

func WithProfile

func WithProfile[T any](namespace string) Option

WithProfile declares the JSON shape owned by namespace in each profile. The extender owns compatibility, unknown-field retention, validation, and versioning for its payload; typed writes replace this namespace without retaining omitted fields.

Jump to

Keyboard shortcuts

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