Help us shape the future of Go! Take the 2026 Go Developer Survey

component

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package component provides the shared name→constructor registry backing Wardyn's pluggable seams (identity provider, secret store, recording store, confinement substrate), so each seam selects an implementation uniformly via a WARDYN_<SEAM> name while keeping a type-safe constructor signature. NOT the policy evaluator: egress.Evaluator has no registry or selector.

Implementations self-register at init() time (like database/sql drivers): a blank import makes one selectable. Registration alone doesn't "bless" an impl — it must also pass its seam's RunConformance suite.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

type Registry[C any] struct {
	// contains filtered or unexported fields
}

Registry is a name→constructor registry for one pluggable seam. C is the seam's constructor FUNC type (e.g. func(Deps) (Provider, error)), so each seam stays type-safe while sharing this implementation. Construct with NewRegistry.

func NewRegistry

func NewRegistry[C any](def string) *Registry[C]

NewRegistry returns an empty registry whose default selection is def.

func (*Registry[C]) Names

func (r *Registry[C]) Names() []string

Names returns the registered names sorted (for /healthz and error messages).

func (*Registry[C]) Register

func (r *Registry[C]) Register(name string, ctor C)

Register adds ctor under name. It PANICS on an empty or duplicate name: this is an init-time programmer error (cf. sql.Register), surfaced loudly rather than silently shadowing a built-in.

func (*Registry[C]) Resolve

func (r *Registry[C]) Resolve(name string) (ctor C, resolved string, err error)

Resolve maps name (empty → default) to its constructor and the resolved name, or a helpful error listing the registered names. Seam New() wrappers call this.

Jump to

Keyboard shortcuts

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