sdk

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2021 License: MPL-2.0 Imports: 8 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 KillProviderPluginClient added in v0.9.0

func KillProviderPluginClient(path string)

func NewLogger

func NewLogger(verbose bool, options ...zap.Option) (*zap.Logger, error)

func ServePlugin

func ServePlugin(provider CQProvider)

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)
}

func GetProviderPluginClient

func GetProviderPluginClient(path string) (CQProvider, 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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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