Documentation
¶
Overview ¶
Package plugin provides the core Plugin interface and WASM export lifecycle.
Index ¶
- Variables
- func CallHost[Req any, Resp any](hostFunc func(uint64) uint64, req Req) (Resp, error)
- func MustRegisterService(plugin *PluginDefinition, svc interface{})
- func PackBytes(data []byte) uint64
- func Register(p Plugin)
- func RegisterService(plugin *PluginDefinition, svc interface{}) error
- func UnpackBytes(packed uint64) []byte
- type HandlerFunc
- type Op
- type Plugin
- type PluginDef
- type PluginDefinition
- type Request
- type Service
- type StubPlugin
Constants ¶
This section is empty.
Variables ¶
var Version = "0.1.0"
Version is the SDK version, set at build time.
Functions ¶
func MustRegisterService ¶ added in v0.3.0
func MustRegisterService(plugin *PluginDefinition, svc interface{})
MustRegisterService registers a service or panics. Use this in init() functions.
func RegisterService ¶ added in v0.3.0
func RegisterService(plugin *PluginDefinition, svc interface{}) error
RegisterService registers all operations from a service struct.
func UnpackBytes ¶
UnpackBytes unpacks a uint64 into a byte slice.
Types ¶
type HandlerFunc ¶ added in v0.3.0
HandlerFunc is the signature for operation handlers.
type Op ¶ added in v0.3.0
type Op struct{}
Op is a field type for declaring operations. Tag format: `desc:"Operation description"`
type Plugin ¶
type Plugin interface {
Manifest(ctx context.Context) (*entities.Manifest, error)
Check(ctx context.Context, config []byte) (*entities.Result, error)
}
Plugin is the interface every Reglet plugin must implement.
type PluginDef ¶ added in v0.3.0
type PluginDef struct {
Name string
Version string
Description string
Config interface{} // Struct for schema generation
Capabilities []entities.Capability
}
PluginDef defines plugin identity and configuration.
type PluginDefinition ¶ added in v0.3.0
type PluginDefinition struct {
// contains filtered or unexported fields
}
PluginDefinition holds the parsed plugin definition and registered services.
func DefinePlugin ¶ added in v0.3.0
func DefinePlugin(def PluginDef) *PluginDefinition
DefinePlugin creates a new plugin definition. Call this once at package level in your plugin.
func (*PluginDefinition) GetHandler ¶ added in v0.3.0
func (p *PluginDefinition) GetHandler(serviceName, opName string) (HandlerFunc, bool)
GetHandler returns a handler for the given service/operation.
func (*PluginDefinition) Manifest ¶ added in v0.3.0
func (p *PluginDefinition) Manifest() *entities.Manifest
Manifest returns the complete plugin manifest.
func (*PluginDefinition) RegisterHandler ¶ added in v0.3.0
func (p *PluginDefinition) RegisterHandler(serviceName, serviceDesc, opName, opDesc string, handler HandlerFunc)
RegisterHandler registers a handler for a service/operation. Called internally by RegisterService.
type Request ¶ added in v0.3.0
type Request struct {
Client interface{} // Plugin-specific client (e.g., *AWSClient)
Config interface{} // Parsed config struct
Raw []byte // Raw config JSON
}
Request contains the context for a handler invocation.
type Service ¶ added in v0.3.0
type Service struct{}
Service is embedded in service structs to provide metadata. Tag format: `name:"service_name" desc:"Service description"`
type StubPlugin ¶ added in v0.3.0
type StubPlugin struct{}
StubPlugin is a no-op implementation of the Plugin interface for testing or non-WASM environments.