Documentation
¶
Overview ¶
Package plugin implements provider binding via capability handles (PLUGIN-005): components bind to providers exclusively through PLUGIN-001 handles, so removing a provider degrades only its dependents.
Index ¶
- Variables
- func VerifyChecksum(unit ComponentUnit) error
- type Binder
- type Binding
- type BindingReport
- type BindingStrategy
- type ComponentUnit
- type Degradation
- type ErrUnsatisfiedRequirement
- type InvokeCall
- type InvokeResult
- type ProviderFactory
- type RuntimeProvider
- type StaticFactory
- type StubProvider
Constants ¶
This section is empty.
Variables ¶
var ( ErrRuntimeUnsupported = errors.New("plugin: runtime not supported") ErrArtifactChecksumMismatch = errors.New("plugin: artifact checksum mismatch") ErrCapabilityNotGranted = errors.New("plugin: capability not granted") )
Typed seam errors. Callers match via errors.Is/As, never string matching.
Functions ¶
func VerifyChecksum ¶
func VerifyChecksum(unit ComponentUnit) error
VerifyChecksum checks unit.Artifact against unit.Checksum (SHA-256 hex).
Types ¶
type Binder ¶
type Binder interface {
Bind(ctx contract.OperationContext, manifests []component.Manifest, factories []ProviderFactory) (BindingReport, error)
}
Binder resolves component requirements against provider factories.
func NewBinder ¶
func NewBinder(strategy BindingStrategy) Binder
NewBinder returns a binder with the given strategy.
type Binding ¶
type Binding struct {
Component string
Capability contract.CapabilityName
Handle contract.CapabilityHandle
}
Binding is one satisfied requirement: a component's requirement resolved to a concrete handle.
type BindingReport ¶
type BindingReport struct {
Bound []Binding
Degraded []Degradation
}
BindingReport is the outcome of a bind pass.
type BindingStrategy ¶
type BindingStrategy int
BindingStrategy selects strict vs degraded behavior.
const ( StrategyDegraded BindingStrategy = iota // missing capability degrades, others stay live StrategyStrict // any unmet requirement aborts )
type ComponentUnit ¶
ComponentUnit is the artifact + manifest a runtime compiles.
type Degradation ¶
type Degradation struct {
Component string
Capability contract.CapabilityName
Reason string // "provider-absent" | "provider-unhealthy"
}
Degradation is one unmet requirement.
type ErrUnsatisfiedRequirement ¶
type ErrUnsatisfiedRequirement struct {
Component string
Capability contract.CapabilityName
}
ErrUnsatisfiedRequirement is a typed strict-binding failure.
func (*ErrUnsatisfiedRequirement) Error ¶
func (e *ErrUnsatisfiedRequirement) Error() string
type InvokeCall ¶
InvokeCall is one serialized invocation request.
type InvokeResult ¶
type InvokeResult struct {
Value []byte
Evidence effect.CleanupEvidence
}
InvokeResult is a serialized result plus cleanup evidence.
type ProviderFactory ¶
type ProviderFactory interface {
Capability() contract.CapabilityName
Open(ctx contract.OperationContext) (contract.CapabilityHandle, error)
}
ProviderFactory exposes one provider as a capability handle.
func NewStaticFactory ¶
func NewStaticFactory(cap contract.CapabilityName, err error) ProviderFactory
NewStaticFactory returns a factory for cap whose Open returns a no-op handle (or err when supplied).
type RuntimeProvider ¶
type RuntimeProvider interface {
ID() string
Compile(unit ComponentUnit) error
Execute(ctx contract.OperationContext, call InvokeCall, handles []contract.CapabilityHandle) (InvokeResult, error)
Shutdown(ctx contract.OperationContext) error
}
RuntimeProvider is the seam any execution backend implements.
type StaticFactory ¶
type StaticFactory struct {
// contains filtered or unexported fields
}
StaticFactory is a ProviderFactory backed by a fixed capability and optional open error (for tests).
func (*StaticFactory) Capability ¶
func (f *StaticFactory) Capability() contract.CapabilityName
func (*StaticFactory) Open ¶
func (f *StaticFactory) Open(ctx contract.OperationContext) (contract.CapabilityHandle, error)
type StubProvider ¶
type StubProvider struct {
// contains filtered or unexported fields
}
StubProvider is an in-process fake of a WASM-like runtime (PLUGIN-008). It enforces the seam's serialization-only rule: Execute returns JSON-encoded bytes and never passes host pointers or closures across the boundary. It proves the RuntimeProvider contract is implementable by a non-Goja backend.
func NewStubProvider ¶
func NewStubProvider(id string, required contract.CapabilityName) *StubProvider
NewStubProvider returns a stub runtime with the given ID. required is the capability Execute insists on (deny-by-default at the seam).
func (*StubProvider) Compile ¶
func (s *StubProvider) Compile(unit ComponentUnit) error
func (*StubProvider) Execute ¶
func (s *StubProvider) Execute(ctx contract.OperationContext, call InvokeCall, handles []contract.CapabilityHandle) (InvokeResult, error)
func (*StubProvider) ID ¶
func (s *StubProvider) ID() string
func (*StubProvider) Shutdown ¶
func (s *StubProvider) Shutdown(ctx contract.OperationContext) error