Documentation
¶
Overview ¶
Package registry provides TerraCi's plugin catalog and per-run plugin sets. Plugin packages register factories via init(); commands instantiate a fresh Registry from those factories for each app run. The Registry implements the plugin.Resolver contract and is what plugins receive through AppContext.
Index ¶
- func ByCapabilityFrom[T plugin.Plugin](resolver plugin.Resolver) []T
- func RegisterFactory(factory Factory)
- func Reset()
- type Catalog
- type Factory
- type Registry
- func (r *Registry) All() []plugin.Plugin
- func (r *Registry) CollectContributions(ctx *plugin.AppContext) []*pipeline.Contribution
- func (r *Registry) GetPlugin(name string) (plugin.Plugin, bool)
- func (r *Registry) PreflightsForStartup() []plugin.Preflightable
- func (r *Registry) ResolveBlobStoreProvider(name string) (plugin.BlobStoreProvider, error)
- func (r *Registry) ResolveCIProvider() (*plugin.ResolvedCIProvider, error)
- func (r *Registry) ResolveChangeDetector() (plugin.ChangeDetectionProvider, error)
- func (r *Registry) ResolveKVCacheProvider(name string) (plugin.KVCacheProvider, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByCapabilityFrom ¶ added in v0.10.0
ByCapabilityFrom returns all plugins from resolver that implement the given capability interface.
func RegisterFactory ¶ added in v0.10.0
func RegisterFactory(factory Factory)
RegisterFactory adds a plugin factory to the global catalog. Called from init() in plugin packages. Panics on duplicate names (fail-fast at startup).
Types ¶
type Catalog ¶ added in v0.10.0
type Catalog struct {
// contains filtered or unexported fields
}
Catalog stores plugin factories and creates isolated per-command plugin sets.
func NewCatalog ¶ added in v0.10.0
func NewCatalog() *Catalog
NewCatalog creates an empty plugin factory catalog.
func (*Catalog) NewRegistry ¶ added in v0.10.0
NewRegistry instantiates a fresh plugin set from this catalog.
func (*Catalog) RegisterFactory ¶ added in v0.10.0
RegisterFactory adds a plugin factory to this catalog.
type Registry ¶ added in v0.10.0
type Registry struct {
// contains filtered or unexported fields
}
Registry is an isolated plugin instance set for one app run. It implements plugin.Resolver — both as the lookup surface for capability discovery and as the policy resolver for canonical capabilities (CI provider, change detector, cache backends, pipeline contributions, preflights).
func New ¶ added in v0.10.0
func New() *Registry
New instantiates a fresh plugin set from the registered global factories.
func NewFromFactories ¶ added in v0.10.0
NewFromFactories creates an isolated registry from explicit factories without touching the process-wide plugin catalog.
func (*Registry) CollectContributions ¶ added in v0.10.0
func (r *Registry) CollectContributions(ctx *plugin.AppContext) []*pipeline.Contribution
CollectContributions gathers pipeline contributions from all enabled PipelineContributor plugins in this registry.
func (*Registry) PreflightsForStartup ¶ added in v0.10.0
func (r *Registry) PreflightsForStartup() []plugin.Preflightable
PreflightsForStartup returns enabled plugins that participate in framework preflight for the current configuration state.
func (*Registry) ResolveBlobStoreProvider ¶ added in v0.10.0
func (r *Registry) ResolveBlobStoreProvider(name string) (plugin.BlobStoreProvider, error)
ResolveBlobStoreProvider returns a named blob store backend provider. When name is empty, falls back to the single enabled blob store provider.
func (*Registry) ResolveCIProvider ¶ added in v0.10.0
func (r *Registry) ResolveCIProvider() (*plugin.ResolvedCIProvider, error)
ResolveCIProvider detects the active CI provider in this registry. Priority: TERRACI_PROVIDER env → CI environment detection → single active provider → error.
func (*Registry) ResolveChangeDetector ¶ added in v0.10.0
func (r *Registry) ResolveChangeDetector() (plugin.ChangeDetectionProvider, error)
ResolveChangeDetector returns the single active ChangeDetectionProvider.
func (*Registry) ResolveKVCacheProvider ¶ added in v0.10.0
func (r *Registry) ResolveKVCacheProvider(name string) (plugin.KVCacheProvider, error)
ResolveKVCacheProvider returns a named KV cache backend provider. When name is empty, falls back to the single enabled KV cache provider — otherwise returns an error pointing at the available backends.