registry

package
v0.64.21 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package registry is L2 of the SigComply CLI: in-process catalogs of the things that can be referenced by ID — frameworks, source plugins, rules, evidence types, and policies. Populated at process startup from the in-binary specs plus any project-local extensions under .sigcomply/, then immutable for the run.

See docs/architecture/02-layers.md for the full layer contract.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

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

Registry is a generic, populated-once-at-startup catalog keyed by ID. The CLI's loading sequence is: load in-binary specs → load project- local extensions → validate cross-references → freeze. Nothing mutates a Registry after that freeze; there is no hot-reload, no mid-run discovery, no runtime mutation.

keyFn extracts the ID used as the lookup key. Different item types expose their ID differently (a method on an interface, a field on a struct); keyFn abstracts that so a single Registry implementation serves all five concrete registries in this package.

func New

func New[T any](keyFn func(T) string) *Registry[T]

New constructs an empty Registry. The keyFn extracts the lookup key from each item registered.

func NewEvidenceTypeRegistry

func NewEvidenceTypeRegistry() *Registry[core.EvidenceType]

NewEvidenceTypeRegistry returns an empty registry of core.EvidenceType keyed by ID. Evidence type schemas are append-only: a breaking schema change requires a new ID (e.g. user_record.v2 registered alongside user_record.v1).

func NewFrameworkRegistry

func NewFrameworkRegistry() *Registry[core.Framework]

NewFrameworkRegistry returns an empty registry of core.Framework keyed by Framework.ID().

func NewPolicyRegistry

func NewPolicyRegistry() *Registry[core.Policy]

NewPolicyRegistry returns an empty registry of core.Policy keyed by Policy.ID. Framework-shipped policies and project-local custom policies share this registry; the loader at L0/L2 is responsible for merging both into the single namespace.

func NewRuleRegistry

func NewRuleRegistry() *Registry[core.Rule]

NewRuleRegistry returns an empty registry of core.Rule keyed by Rule.ID() — the dotted-with-version reference (rules.<name>.v<n>) that policy specs declare via their `rule:` field.

func NewSourceRegistry

func NewSourceRegistry() *Registry[core.SourcePlugin]

NewSourceRegistry returns an empty registry of core.SourcePlugin keyed by SourcePlugin.ID().

func (*Registry[T]) All

func (r *Registry[T]) All() []T

All returns every registered item. Order is unspecified — callers that need deterministic order must sort the result themselves.

func (*Registry[T]) Len

func (r *Registry[T]) Len() int

Len returns the number of registered items.

func (*Registry[T]) Lookup

func (r *Registry[T]) Lookup(id string) (T, bool)

Lookup returns the item registered under id, or (zero, false).

func (*Registry[T]) Register

func (r *Registry[T]) Register(item T) error

Register adds an item to the registry. Returns an error if the key is empty or already registered — both are configuration errors that the orchestrator should turn into exit code 3.

type Set

type Set struct {
	Frameworks    *Registry[core.Framework]
	Sources       *Registry[core.SourcePlugin]
	Rules         *Registry[core.Rule]
	EvidenceTypes *Registry[core.EvidenceType]
	Policies      *Registry[core.Policy]
}

Set is the bundle of all five registries the orchestrator passes through the stack. Constructed empty by NewSet, populated by the spec loaders (L0) and any project-local extension discovery, then treated as immutable.

func NewSet

func NewSet() *Set

NewSet returns a Set with empty registries for each kind.

Jump to

Keyboard shortcuts

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