plugininfo

package
v0.0.0-...-298627d Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package plugininfo contains type definitions and some boilerplating Go plugins can use The idea is to have it in a separate repo as a library, used by both pluginboss and (Go) plugins Plugins in other languages need to implement it

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConverterGRPCPlugin

type ConverterGRPCPlugin 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 ConverterPlugin
}

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

func (*ConverterGRPCPlugin) GRPCClient

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

func (*ConverterGRPCPlugin) GRPCServer

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

type ConverterPlugin

type ConverterPlugin interface {
	Convert(in float64) (float64, error)
}

ConverterPlugin is the plugin's interface. Name is deliberatelly wrong (ConverterPlugin instead of Converter) to emphasize the fact it's an interface defining plugin API

type GRPCClient

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

GRPCClient is an implementation of ConverterPlugin that talks over RPC. Basically a client with RPC communication details abstracted away

func (*GRPCClient) Convert

func (m *GRPCClient) Convert(in float64) (out float64, err error)

type GRPCServer

type GRPCServer struct {
	Impl ConverterPlugin // plugin implementation
}

GRPCServer is the RPC server that GRPCClient talks to, a wrapper around plugin's server

func (*GRPCServer) Convert

func (m *GRPCServer) Convert(
	ctx context.Context,
	req *ConvertRequest) (cresp *ConvertResponse, err error)

type PluginData

type PluginData struct {
	Cmd       string
	Handshake plugin.HandshakeConfig
	Plugin    plugin.Plugin
}

type PluginInfo

type PluginInfo struct {
	PluginDataMap map[string]PluginData
}

Jump to

Keyboard shortcuts

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