sdk

package
v0.0.0-...-5adbbcf Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HandshakeConfig = plugin.HandshakeConfig{
	ProtocolVersion:  1,
	MagicCookieKey:   "BASIC_PLUGIN",
	MagicCookieValue: "hello",
}

handshakeConfigs are used to just do a basic handshake between a plugin and host. If the handshake fails, a user friendly error is shown. This prevents users from executing bad plugins or executing a plugin directory. It is a UX feature, not a security feature.

Functions

This section is empty.

Types

type GRPCClient

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

GRPCClient is an implementation of Greeter that talks over RPC.

func (*GRPCClient) DoMath

func (m *GRPCClient) DoMath(x, y int64) int64

type GRPCServer

type GRPCServer struct {
	mather.UnimplementedMatherServer
	// This is the real implementation
	Impl Mather
}

Here is the gRPC server that GRPCClient talks to.

func (*GRPCServer) DoMath

func (m *GRPCServer) DoMath(
	ctx context.Context,
	req *mather.MathRequest,
) (*mather.MathResponse, error)

type Input

type Input struct {
	X int64
	Y int64
}

type Mather

type Mather interface {
	DoMath(x, y int64) int64
}

type MatherGRPCPlugin

type MatherGRPCPlugin 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 Mather
}

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

func (*MatherGRPCPlugin) GRPCClient

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

func (*MatherGRPCPlugin) GRPCServer

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

Jump to

Keyboard shortcuts

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