Documentation
¶
Overview ¶
Package plugins defines the compile-time plugin contract used by Procyon applications. Plugins can be project-owned Go packages or installed, versioned Go modules. Both are linked into the application binary rather than loaded dynamically at runtime.
Index ¶
- Variables
- func Provide[T any](r *CapabilityRegistry, owner, name string, value T) error
- func Resolve[T any](r *CapabilityRegistry, name string) (T, error)
- type CapabilityRegistrar
- type CapabilityRegistry
- type Clock
- type ConfigResolver
- type Dependencies
- type DependencyDeclarer
- type EventRegistrar
- type Factory
- type Migration
- type MigrationProvider
- type Plugin
- type Registration
- type Registry
- func (r *Registry) Capabilities() *CapabilityRegistry
- func (r *Registry) Instantiate(ctx context.Context, dependencies Dependencies, resolve ConfigResolver) error
- func (r *Registry) Migrate(ctx context.Context) error
- func (r *Registry) Plugins() []Plugin
- func (r *Registry) Policies() []authz.Policy
- func (r *Registry) RegisterCapabilities() error
- func (r *Registry) RegisterEvents(bus *events.Bus) error
- func (r *Registry) RegisterRoutes(routes Routes) error
- func (r *Registry) Shutdown(ctx context.Context) error
- func (r *Registry) Start(ctx context.Context) error
- type Routes
- type Starter
- type SystemClock
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type CapabilityRegistrar ¶ added in v0.5.0
type CapabilityRegistrar interface {
RegisterCapabilities(*CapabilityRegistry) error
}
CapabilityRegistrar participates in the capability registration phase.
type CapabilityRegistry ¶ added in v0.5.0
type CapabilityRegistry struct {
// contains filtered or unexported fields
}
CapabilityRegistry stores synchronous ports shared by compile-time plugins. Registration happens during application startup and Seal makes it immutable.
func NewCapabilityRegistry ¶ added in v0.5.0
func NewCapabilityRegistry() *CapabilityRegistry
func (*CapabilityRegistry) Seal ¶ added in v0.5.0
func (r *CapabilityRegistry) Seal()
type ConfigResolver ¶ added in v0.5.0
type ConfigResolver func(Registration) json.RawMessage
type Dependencies ¶
type Dependencies struct {
DB *gorm.DB
Logger *zap.Logger
Events *events.Bus
Metrics *telemetry.BusinessMetrics
Clock Clock
Capabilities *CapabilityRegistry
}
type DependencyDeclarer ¶ added in v0.5.0
type DependencyDeclarer interface {
Requires() []string
}
DependencyDeclarer lets a plugin require other plugins by registration name. Plugins without this interface have no declared dependencies.
type EventRegistrar ¶ added in v0.5.0
EventRegistrar installs event handlers before the shared event bus is sealed.
type Factory ¶
type Factory func(context.Context, Dependencies, json.RawMessage) (Plugin, error)
type MigrationProvider ¶ added in v0.5.0
type MigrationProvider interface {
Migrations() []Migration
}
MigrationProvider opts a plugin into Core-managed, versioned migrations. Plugins implementing only Migrate keep their existing migration strategy.
type Registration ¶
type Registration struct {
Name string
Factory Factory
DefaultConfig json.RawMessage
}
type Registry ¶ added in v0.5.0
type Registry struct {
// contains filtered or unexported fields
}
Registry composes all project-local and installed plugins through one deterministic lifecycle.
func NewRegistry ¶ added in v0.5.0
func NewRegistry(registrations []Registration) (*Registry, error)
func (*Registry) Capabilities ¶ added in v0.5.0
func (r *Registry) Capabilities() *CapabilityRegistry
func (*Registry) Instantiate ¶ added in v0.5.0
func (r *Registry) Instantiate(ctx context.Context, dependencies Dependencies, resolve ConfigResolver) error
func (*Registry) RegisterCapabilities ¶ added in v0.5.0
func (*Registry) RegisterEvents ¶ added in v0.5.0
func (*Registry) RegisterRoutes ¶ added in v0.5.0
type Routes ¶
type Routes struct {
Public *echo.Group
Authenticated *echo.Group
Admin *echo.Group
// Operations is the separate admin-server group protected by the configured
// admin-key middleware. It is nil when admin-key authentication is disabled.
Operations *echo.Group
Require func(domain, object, action string) echo.MiddlewareFunc
Servers []*echo.Echo
}
type Starter ¶ added in v0.5.0
Starter starts background work after routes and event handlers are registered.
type SystemClock ¶ added in v0.5.0
type SystemClock struct{}
func (SystemClock) Now ¶ added in v0.5.0
func (SystemClock) Now() time.Time