Documentation
¶
Overview ¶
The adapters for the Extism SDK types that wrap the SDK's concrete types are defined here. (CompiledPlugin and Plugin), allowing our code to work with our internal interfaces instead of directly depending on the Extism SDK. This make mocking possible for tests, and insulates local code from SDK changes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPluginInstanceConfig ¶
func NewPluginInstanceConfig() extismSDK.PluginInstanceConfig
getPluginInstanceConfig creates a new PluginInstanceConfig with recommended settings.
Types ¶
type CompiledPlugin ¶
type CompiledPlugin interface { Instance(ctx context.Context, config extismSDK.PluginInstanceConfig) (PluginInstance, error) Close(ctx context.Context) error }
CompiledPlugin is an interface for abstracting the extismSDK.CompiledPlugin
func NewCompiledPluginAdapter ¶
func NewCompiledPluginAdapter(plugin *extismSDK.CompiledPlugin) CompiledPlugin
NewCompiledPluginAdapter creates a new adapter for extismSDK.CompiledPlugin
type ExtismExecutable ¶
type ExtismExecutable struct {
GetExtismExecutable func() *extismSDK.CompiledPlugin
}
type PluginInstance ¶
type PluginInstance interface { Call(name string, data []byte) (uint32, []byte, error) CallWithContext(ctx context.Context, name string, data []byte) (uint32, []byte, error) FunctionExists(name string) bool Close(ctx context.Context) error }
PluginInstance is an interface for abstracting the extismSDK.Plugin
type SdkPluginInstanceConfig ¶
type SdkPluginInstanceConfig interface { CallWithContext(ctx context.Context, functionName string, input []byte) (uint32, []byte, error) Close(ctx context.Context) error }
SdkPluginInstanceConfig is an interface that wraps Extism extismSDK.PluginInstanceConfig This interface is used here to enable testing and to abstract the methods exposed by extism.