Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var PluginHandshake = hcplugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "GOTMPL_PLUGIN",
MagicCookieValue: "GOTMPL_PLUGIN",
}
PluginHandshake is the handshake config for plugins.
Functions ¶
func InitPlugins ¶
func InitPlugins(ctx context.Context, commands, grpcAddresses []string, options *InitPluginsOptions) (template.FuncMap, error)
InitPlugins initializes both command and grpc plugins and returns a single template.FuncMap that contains functions from all plugins with grpc plugins taking precedence over command plugins with the same name. When multiple plugins have the same name within the same type, the last one will be used. Command plugins will be killed when ctx is canceled.
func NewGrpcServer ¶
func NewGrpcServer(p Plugin) pluginv1.PluginServiceServer
Types ¶
type InitPluginsOptions ¶
type Plugin ¶
type Plugin interface { ListFunctions(ctx context.Context) ([]string, error) ExecuteFunction(ctx context.Context, name string, args []any) (any, error) }
Plugin is the interface that plugins must implement.
type PluginServer ¶
func (*PluginServer) GRPCClient ¶
func (p *PluginServer) GRPCClient(_ context.Context, _ *hcplugin.GRPCBroker, c *grpc.ClientConn) (any, error)
func (*PluginServer) GRPCServer ¶
func (p *PluginServer) GRPCServer(_ *hcplugin.GRPCBroker, s *grpc.Server) error
Click to show internal directories.
Click to hide internal directories.