Documentation ¶
Overview ¶
Package metal provides the entry point for implementing the plugin system in a process.
Index ¶
- Variables
- func Dispense(clients Clients, name string) (plugin.Interface, error)
- func DispenseAll(clients Clients) (map[string]plugin.Interface, error)
- func KillPlugins(clients Clients)
- func LoadDevModePlugin(cfg *config.Config, pcfg *config.PluginConfig, logger hclog.Logger, ...) (*goPlugin.Client, error)
- func LoadLocalPlugin(iface plugin.Interface, logger hclog.Logger, stdOut io.Writer, ...) (*goPlugin.Client, error)
- func NewGoPluginClient(cmd []string, logger hclog.Logger, stdOut io.Writer, stdErr io.Writer) *goPlugin.Client
- func RunPlugin(impl plugin.Interface)
- type Clients
- type InterfaceGRPCPlugin
- type SyncBuffer
Constants ¶
This section is empty.
Variables ¶
var Handshake = goPlugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "ZEDPM_PLUGIN_MAGIC_COOKIE",
MagicCookieValue: "Q0aHomIRxbv3sa9jlP28A3juUduYTyUnAh4MQnr3",
}
Handshake is the shared Hashicorp plugin handshake object.
Functions ¶
func Dispense ¶
Dispense returns a plugin.Interface for executing parts of a single plugin interface.
func DispenseAll ¶
DispenseAll returns a mapping from plugin name (found in the configuration) to the matching plugin.Interface which is able to execute tasks and operations and so on.
func KillPlugins ¶
func KillPlugins(clients Clients)
KillPlugins will kill all plugins that have been started by LoadPlugins.
func LoadDevModePlugin ¶
func LoadDevModePlugin( cfg *config.Config, pcfg *config.PluginConfig, logger hclog.Logger, stdOut io.Writer, stdErr io.Writer, ) (*goPlugin.Client, error)
LoadDevModePlugin initializes a plugin that is compiled and run in a single step via the "go run" command.
func LoadLocalPlugin ¶
func LoadLocalPlugin( iface plugin.Interface, logger hclog.Logger, stdOut io.Writer, stdErr io.Writer, ) (*goPlugin.Client, error)
LoadLocalPlugin will run the plugin server as a goroutine on the local process and connect the master process to it, essentially talking to itself.
Types ¶
type Clients ¶
Clients represents a list of Hashicorp plugins we are running to implement the plugin interface of zedpm.
type InterfaceGRPCPlugin ¶
type InterfaceGRPCPlugin struct { goPlugin.Plugin Impl plugin.Interface // contains filtered or unexported fields }
InterfaceGRPCPlugin defines the plugin interface that zedpm uses to fill in the Hashicorp plugin interface.
func NewPlugin ¶
func NewPlugin(logger hclog.Logger, impl plugin.Interface) *InterfaceGRPCPlugin
NewPlugin creates a new plugin object for the given plugin interface.
func (*InterfaceGRPCPlugin) GRPCClient ¶
func (p *InterfaceGRPCPlugin) GRPCClient( _ context.Context, _ *goPlugin.GRPCBroker, c *grpc.ClientConn, ) (any, error)
GRPCClient returns a new GRPC plugin client for executing a plugin.
func (*InterfaceGRPCPlugin) GRPCServer ¶
func (p *InterfaceGRPCPlugin) GRPCServer( _ *goPlugin.GRPCBroker, s *grpc.Server, ) error
GRPCServer returns a new GRPC plugin server for implementing a plugin.
type SyncBuffer ¶
SyncBuffer is a simple synchronized buffer.
func NewSyncBuffer ¶
func NewSyncBuffer(w io.Writer) *SyncBuffer
NewSyncBuffer creates a new syncrhonized buffer wrapping the given io.Writer.