Documentation
¶
Index ¶
- Variables
- func LoadDriverPlugins(cfg Config) func()
- func NewLogger(name string) hclog.Logger
- type Client
- type Config
- type GRPC
- type Plugin
- func (p *Plugin) Authorize(in driver.AuthorizeInput) driver.AuthorizeOutput
- func (p *Plugin) Close() (err error)
- func (p *Plugin) FieldResolve(in driver.FieldResolveInput) driver.FieldResolveOutput
- func (p *Plugin) InterfaceResolveType(in driver.InterfaceResolveTypeInput) driver.InterfaceResolveTypeOutput
- func (p *Plugin) ScalarParse(in driver.ScalarParseInput) driver.ScalarParseOutput
- func (p *Plugin) ScalarSerialize(in driver.ScalarSerializeInput) driver.ScalarSerializeOutput
- func (p *Plugin) SetSecrets(in driver.SetSecretsInput) driver.SetSecretsOutput
- func (p *Plugin) Stream(in driver.StreamInput) driver.StreamOutput
- func (p *Plugin) SubscriptionConnection(in driver.SubscriptionConnectionInput) driver.SubscriptionConnectionOutput
- func (p *Plugin) SubscriptionListen(in driver.SubscriptionListenInput) driver.SubscriptionListenOutput
- func (p *Plugin) UnionResolveType(in driver.UnionResolveTypeInput) driver.UnionResolveTypeOutput
Constants ¶
This section is empty.
Variables ¶
var ExecCommand = exec.Command
ExecCommand creates new plugin command
var ExecCommandContext = exec.CommandContext
ExecCommandContext used to check to create command for checking plugin config
var NewDriverClient = protoDriverService.NewDriverClient
NewDriverClient creates a grpc client for protocol using connection
var NewPluginClient = DefaultPluginClient
NewPluginClient creates new client for plugin
var RegisterDriverServer = protoDriverService.RegisterDriverServer
RegisterDriverServer registers an concrete implementation of a grpc server for a protocol.
Functions ¶
func LoadDriverPlugins ¶
func LoadDriverPlugins(cfg Config) func()
LoadDriverPlugins searches environment PATH for files matching stucco-<plugin-name> executables and adds them as handlers for specific runtimes. Plugin must atleast be runnable with only binary name and if argument config is provided, plugin is expected to list supported runtimes in JSON and exit.
Types ¶
type Client ¶
type Client interface { Client() (plugin.ClientProtocol, error) Kill() }
Client interface used to establish connection with plugin
func DefaultPluginClient ¶
func DefaultPluginClient(cfg *plugin.ClientConfig) Client
DefaultPluginClient creates a default plugin client
type Config ¶
type Config struct { // defines how many concurrent clients for request can be open at once Runners uint8 // Cmd is an executable path to plugin Cmd string }
Config is a plugin configuration
type GRPC ¶
type GRPC struct { plugin.Plugin Authorize grpc.AuthorizeHandler FieldResolveHandler grpc.FieldResolveHandler InterfaceResolveTypeHandler grpc.InterfaceResolveTypeHandler ScalarParseHandler grpc.ScalarParseHandler ScalarSerializeHandler grpc.ScalarSerializeHandler UnionResolveTypeHandler grpc.UnionResolveTypeHandler SetSecretsHandler grpc.SetSecretsHandler StreamHandler grpc.StreamHandler StdoutHandler grpc.StdoutHandler StderrHandler grpc.StderrHandler SubscriptionConnectionHandler grpc.SubscriptionConnectionHandler SubscriptionListenHandler grpc.SubscriptionListenHandler }
GRPC implement GRPCPlugin interface fro go-plugin
func (*GRPC) GRPCClient ¶
func (g *GRPC) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *googlegrpc.ClientConn) (interface{}, error)
GRPCClient returns a client implementation for go-plugin
func (*GRPC) GRPCServer ¶
func (g *GRPC) GRPCServer(broker *plugin.GRPCBroker, s *googlegrpc.Server) error
GRPCServer returns a server implementation for go-plugin
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin implements Driver interface by running an executable available on local fs. All user defined operations will be forwarded to plugin through GRPC protocol.
func (*Plugin) Authorize ¶
func (p *Plugin) Authorize(in driver.AuthorizeInput) driver.AuthorizeOutput
Authorize uses plugin to authorize request
func (*Plugin) FieldResolve ¶
func (p *Plugin) FieldResolve(in driver.FieldResolveInput) driver.FieldResolveOutput
FieldResolve uses plugin to resolve a field on type
func (*Plugin) InterfaceResolveType ¶
func (p *Plugin) InterfaceResolveType(in driver.InterfaceResolveTypeInput) driver.InterfaceResolveTypeOutput
InterfaceResolveType uses plugin to find interface type for user input
func (*Plugin) ScalarParse ¶
func (p *Plugin) ScalarParse(in driver.ScalarParseInput) driver.ScalarParseOutput
ScalarParse uses plugin to parse scalar
func (*Plugin) ScalarSerialize ¶
func (p *Plugin) ScalarSerialize(in driver.ScalarSerializeInput) driver.ScalarSerializeOutput
ScalarSerialize uses plugin to serialize scalar
func (*Plugin) SetSecrets ¶
func (p *Plugin) SetSecrets(in driver.SetSecretsInput) driver.SetSecretsOutput
SetSecrets sets user provided secrets for plugin using environment variables
func (*Plugin) Stream ¶
func (p *Plugin) Stream(in driver.StreamInput) driver.StreamOutput
Stream data through grpc plugin
func (*Plugin) SubscriptionConnection ¶
func (p *Plugin) SubscriptionConnection(in driver.SubscriptionConnectionInput) driver.SubscriptionConnectionOutput
SubscriptionConnection creates connection with plugin
func (*Plugin) SubscriptionListen ¶
func (p *Plugin) SubscriptionListen(in driver.SubscriptionListenInput) driver.SubscriptionListenOutput
SubscriptionListen creates listen stream with plugin
func (*Plugin) UnionResolveType ¶
func (p *Plugin) UnionResolveType(in driver.UnionResolveTypeInput) driver.UnionResolveTypeOutput
UnionResolveType uses plugin to find union type for user input