component

package
v0.5.0 Latest Latest
Warning

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

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

Documentation

Overview

Package component provides the shared registry that backs Wardyn's pluggable component seams (identity provider, secret store, recording store, policy evaluator, …). One generic implementation of name→constructor registration, default resolution, and duplicate detection, so every seam selects an implementation uniformly via a WARDYN_<SEAM> name while keeping a type-safe, seam-specific constructor signature.

Implementations self-register at init() time (like database/sql drivers): a blank import of an impl package makes it selectable. The registered default name maps to the current built-in, so an unset selector reproduces today's behavior exactly.

A registered implementation is not "blessed" until it passes its seam's RunConformance suite (see the per-seam *test packages) — registration makes an impl selectable; conformance makes it trustworthy.

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]) Lookup

func (r *Registry[C]) Lookup(name string) (C, bool)

Lookup returns the constructor for name (an empty name resolves to the default) and whether it was found.

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