shared

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2023 License: Apache-2.0, BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Handshake = plugin.HandshakeConfig{

	MagicCookieKey:   "BASIC_PLUGIN",
	MagicCookieValue: "hello",
}

Handshake is a common handshake that is shared by plugin and host.

View Source
var PluginMap = map[string]plugin.Plugin{
	"kv_grpc": &KVGRPCPlugin{},
}

PluginMap is the map of plugins we can dispense.

Functions

This section is empty.

Types

type GRPCClient

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

GRPCClient is an implementation of KV that talks over RPC.

func (*GRPCClient) Get

func (m *GRPCClient) Get(key string) ([]byte, error)

func (*GRPCClient) Put

func (m *GRPCClient) Put(key string, value []byte) error

type GRPCServer

type GRPCServer struct {
	proto.UnimplementedKVServer
	// This is the real implementation
	Impl KV
}

Here is the gRPC server that GRPCClient talks to.

func (*GRPCServer) Get

func (*GRPCServer) Put

func (m *GRPCServer) Put(
	ctx context.Context,
	req *proto.PutRequest) (*proto.Empty, error)

type KV

type KV interface {
	Put(key string, value []byte) error
	Get(key string) ([]byte, error)
}

type KVGRPCPlugin

type KVGRPCPlugin 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 KV
}

func (*KVGRPCPlugin) GRPCClient

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

func (*KVGRPCPlugin) GRPCServer

func (p *KVGRPCPlugin) 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