shared

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: Apache-2.0 Imports: 4 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

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

PluginMap is the map of plugins we can dispense.

Functions

This section is empty.

Types

type KV

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

KV is the interface that we're exposing as a plugin.

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
}

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

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

type KVPlugin

type KVPlugin struct {
	// Concrete implementation, written in Go. This is only used for plugins
	// that are written in Go.
	Impl KV
}

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

func (*KVPlugin) Client

func (*KVPlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error)

func (*KVPlugin) Server

func (p *KVPlugin) Server(*plugin.MuxBroker) (interface{}, error)

Jump to

Keyboard shortcuts

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