Documentation
¶
Overview ¶
Package plugin provides go-plugin infrastructure for loading and serving executor plugins out-of-process via gRPC with server-side streaming.
Plugin authors implement executor.ExecutorPlugin and serve it via:
func main() {
goplugin.Serve(&goplugin.ServeConfig{
HandshakeConfig: sdkplugin.HandshakeConfig,
GRPCServer: goplugin.DefaultGRPCServer,
Plugins: map[string]goplugin.Plugin{
"executor": &sdkplugin.GRPCExecutorPlugin{Impl: &MyPlugin{}},
},
})
}
Index ¶
Constants ¶
View Source
const ( MagicCookieKey = "FLOWCTL_EXECUTOR_PLUGIN" MagicCookieValue = "1a2e63941726d309b6f4d5da6410185c" )
Variables ¶
View Source
var HandshakeConfig = goplugin.HandshakeConfig{ ProtocolVersion: 1, MagicCookieKey: MagicCookieKey, MagicCookieValue: MagicCookieValue, }
HandshakeConfig is the go-plugin handshake configuration.
View Source
var PluginMap = map[string]goplugin.Plugin{ "executor": &GRPCExecutorPlugin{}, }
PluginMap maps the plugin name to the go-plugin Plugin implementation.
Functions ¶
func LoadPlugin ¶
LoadPlugin starts an external plugin binary and returns the go-plugin client and the ExecutorPlugin interface to interact with it.
Types ¶
type GRPCExecutorPlugin ¶
type GRPCExecutorPlugin struct {
goplugin.NetRPCUnsupportedPlugin
Impl executor.ExecutorPlugin
}
GRPCExecutorPlugin is the go-plugin Plugin implementation using gRPC. Set Impl on the server side (plugin binary); leave nil on the client side.
func (*GRPCExecutorPlugin) GRPCClient ¶
func (p *GRPCExecutorPlugin) GRPCClient(ctx context.Context, broker *goplugin.GRPCBroker, conn *grpc.ClientConn) (interface{}, error)
func (*GRPCExecutorPlugin) GRPCServer ¶
func (p *GRPCExecutorPlugin) GRPCServer(broker *goplugin.GRPCBroker, s *grpc.Server) error
Click to show internal directories.
Click to hide internal directories.