plugin

package
v0.11.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2021 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Handshake = plugin.HandshakeConfig{
	MagicCookieKey:   "CQ_PLUGIN_COOKIE",
	MagicCookieValue: "6753812e-79c2-4af5-ad01-e6083c374e1f",
}
View Source
var PluginMap = map[string]plugin.Plugin{
	"provider": &CQPlugin{},
}

PluginMap is the map of plugins we can dispense.

Functions

func GetProviderPath added in v0.10.0

func GetProviderPath(name string, version string) (string, error)

GetProviderPath returns expected path of provider on file system from name and version of plugin

Types

type CQPlugin

type CQPlugin struct {
	// GRPCPlugin must still implement the Plugin interface
	plugin.Plugin
	// Concrete implementation, written in Go. This is only used for plugins
	// that are written in Go.
	Impl CQProvider
}

This is the implementation of plugin.GRPCPlugin so we can serve/consume this.

func (*CQPlugin) GRPCClient

func (p *CQPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

func (*CQPlugin) GRPCServer

func (p *CQPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error

type CQProvider

type CQProvider interface {
	Init(driver string, dsn string, verbose bool) error
	Fetch(data []byte) error
	GenConfig() (string, error)
}

type GRPCClient

type GRPCClient struct {
	// contains filtered or unexported fields
}

func (*GRPCClient) Fetch

func (m *GRPCClient) Fetch(data []byte) error

func (*GRPCClient) GenConfig

func (m *GRPCClient) GenConfig() (string, error)

func (*GRPCClient) Init

func (m *GRPCClient) Init(driver string, dsn string, verbose bool) error

type GRPCServer

type GRPCServer struct {
	// This is the real implementation
	Impl CQProvider
	proto.UnimplementedProviderServer
}

Here is the gRPC server that GRPCClient talks to.

func (*GRPCServer) Fetch

func (*GRPCServer) GenConfig

func (*GRPCServer) Init

type Manager added in v0.10.0

type Manager struct {
	// contains filtered or unexported fields
}

Manager handles CQProviders that can be either embedded (self-run provider for example) or remote using go_plugin Important: manager is currently not thread safe

func GetManager added in v0.10.0

func GetManager() *Manager

func (*Manager) AddEmbeddedPlugin added in v0.10.0

func (p *Manager) AddEmbeddedPlugin(providerName string, cqp CQProvider)

func (*Manager) GetOrCreateProvider added in v0.10.0

func (p *Manager) GetOrCreateProvider(providerName, version string) (CQProvider, error)

func (*Manager) GetProvider added in v0.10.0

func (p *Manager) GetProvider(providerName, version string) (CQProvider, error)

func (*Manager) KillProvider added in v0.10.0

func (p *Manager) KillProvider(providerName string) error

func (*Manager) Shutdown added in v0.10.0

func (p *Manager) Shutdown()

Shutdown closes all clients and cleans the managed clients

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL