Help us shape the future of Go! Take the 2026 Go Developer Survey

plugin

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2019 License: MPL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const BackendPluginName = "backend"

BackendPluginName is the name of the plugin that can be dispensed from the plugin server.

Variables

View Source
var ErrClientInMetadataMode = errors.New("plugin client can not perform action while in metadata mode")
View Source
var ErrPluginShutdown = errors.New("plugin is shut down")
View Source
var ErrServerInMetadataMode = errors.New("plugin server can not perform action while in metadata mode")

Functions

func NewBackend

func NewBackend(ctx context.Context, pluginName string, pluginType consts.PluginType, sys pluginutil.LookRunnerUtil, conf *logical.BackendConfig, isMetadataMode bool) (logical.Backend, error)

NewBackend will return an instance of an RPC-based client implementation of the backend for external plugins, or a concrete implementation of the backend if it is a builtin backend. The backend is returned as a logical.Backend interface. The isMetadataMode param determines whether the plugin should run in metadata mode.

func NewPluginClient added in v1.0.0

func NewPluginClient(ctx context.Context, sys pluginutil.RunnerUtil, pluginRunner *pluginutil.PluginRunner, logger log.Logger, isMetadataMode bool) (logical.Backend, error)

func Serve

func Serve(opts *ServeOpts) error

Serve is a helper function used to serve a backend plugin. This should be ran on the plugin's main process.

Types

type BackendPluginClient

type BackendPluginClient struct {
	sync.Mutex

	logical.Backend
	// contains filtered or unexported fields
}

BackendPluginClient is a wrapper around backendPluginClient that also contains its plugin.Client instance. It's primarily used to cleanly kill the client on Cleanup()

func (*BackendPluginClient) Cleanup

func (b *BackendPluginClient) Cleanup(ctx context.Context)

Cleanup calls the RPC client's Cleanup() func and also calls the go-plugin's client Kill() func

type GRPCBackendPlugin added in v0.11.4

type GRPCBackendPlugin struct {
	Factory      logical.Factory
	MetadataMode bool
	Logger       log.Logger

	// Embeding this will disable the netRPC protocol
	plugin.NetRPCUnsupportedPlugin
}

GRPCBackendPlugin is the plugin.Plugin implementation that only supports GRPC transport

func (*GRPCBackendPlugin) GRPCClient added in v0.11.4

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

func (GRPCBackendPlugin) GRPCServer added in v0.11.4

func (b GRPCBackendPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error

type GRPCStorageClient added in v0.9.2

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

GRPCStorageClient is an implementation of logical.Storage that communicates over RPC.

func (*GRPCStorageClient) Delete added in v0.9.2

func (s *GRPCStorageClient) Delete(ctx context.Context, key string) error

func (*GRPCStorageClient) Get added in v0.9.2

func (*GRPCStorageClient) List added in v0.9.2

func (s *GRPCStorageClient) List(ctx context.Context, prefix string) ([]string, error)

func (*GRPCStorageClient) Put added in v0.9.2

type GRPCStorageServer added in v0.9.2

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

StorageServer is a net/rpc compatible structure for serving

func (*GRPCStorageServer) Delete added in v0.9.2

func (*GRPCStorageServer) Get added in v0.9.2

func (*GRPCStorageServer) List added in v0.9.2

func (*GRPCStorageServer) Put added in v0.9.2

type LoggerArgs

type LoggerArgs struct {
	Level int
	Msg   string
	Args  []interface{}
}

type LoggerReply

type LoggerReply struct {
	IsTrue bool
	Error  error
}

LoggerReply contains the RPC reply. Not all fields may be used for a particular RPC call.

type LoggerServer

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

func (*LoggerServer) Debug

func (l *LoggerServer) Debug(args *LoggerArgs, _ *struct{}) error

func (*LoggerServer) Error

func (l *LoggerServer) Error(args *LoggerArgs, reply *LoggerReply) error

func (*LoggerServer) Info

func (l *LoggerServer) Info(args *LoggerArgs, _ *struct{}) error

func (*LoggerServer) IsDebug

func (l *LoggerServer) IsDebug(args interface{}, reply *LoggerReply) error

func (*LoggerServer) IsInfo

func (l *LoggerServer) IsInfo(args interface{}, reply *LoggerReply) error

func (*LoggerServer) IsTrace

func (l *LoggerServer) IsTrace(args interface{}, reply *LoggerReply) error

func (*LoggerServer) IsWarn

func (l *LoggerServer) IsWarn(args interface{}, reply *LoggerReply) error

func (*LoggerServer) Log

func (l *LoggerServer) Log(args *LoggerArgs, _ *struct{}) error

func (*LoggerServer) SetLevel

func (l *LoggerServer) SetLevel(args int, _ *struct{}) error

func (*LoggerServer) Trace

func (l *LoggerServer) Trace(args *LoggerArgs, _ *struct{}) error

func (*LoggerServer) Warn

func (l *LoggerServer) Warn(args *LoggerArgs, reply *LoggerReply) error

type NOOPStorage added in v0.8.2

type NOOPStorage struct{}

NOOPStorage is used to deny access to the storage interface while running a backend plugin in metadata mode.

func (*NOOPStorage) Delete added in v0.8.2

func (s *NOOPStorage) Delete(_ context.Context, key string) error

func (*NOOPStorage) Get added in v0.8.2

func (*NOOPStorage) List added in v0.8.2

func (s *NOOPStorage) List(_ context.Context, prefix string) ([]string, error)

func (*NOOPStorage) Put added in v0.8.2

type ServeOpts

type ServeOpts struct {
	BackendFactoryFunc logical.Factory
	TLSProviderFunc    TLSProviderFunc
	Logger             log.Logger
}

type TLSProviderFunc added in v0.9.6

type TLSProviderFunc func() (*tls.Config, error)

Directories

Path Synopsis
mock-plugin command

Jump to

Keyboard shortcuts

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