plugins

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: BSD-3-Clause Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrInvalidPluginExec  = bg.Error("invalid plugin executable")
	ErrPluginExecNotFound = bg.Error("plugin executable not found")
	ErrInvalidPluginType  = bg.Error("invalid plugin type")
)
View Source
const (
	DATASOURCE_STR         = "datasource"
	CONTROLLER_STR         = "controller"
	ErrInvalidPluginString = bg.Error("invalid plugin string")
	ErrDuplicatePluginName = bg.Error("identical plugin names")
	ErrUnregsiteredPlugin  = bg.Error("given plugin not in plugin registry")
	ErrPluginNotReady      = bg.Error("plugin not ready")
	ErrPluginTimeout       = bg.Error("plugin timed out")
	PluginEOF              = "plugin EOF"
)
View Source
const (
	ErrPluginNotStarted = bg.Error("plugin not started")
)
View Source
const (
	MissingKey = "EXTRA_VALUE_AT_END"
)

Variables

This section is empty.

Functions

func ChangeCfgExec

func ChangeCfgExec(os string, cfgs []*lanirpc.PluginConfig) []*lanirpc.PluginConfig

func ValidatePluginConfig

func ValidatePluginConfig(cfg *lanirpc.PluginConfig, pluginDir string, isTesting bool) error

ValidatePluginConfig takes a PluginConfig and validates the parameters

Types

type LogWriter

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

func (*LogWriter) Write

func (w *LogWriter) Write(data []byte) (int, error)

type PluginInstance

type PluginInstance struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

type PluginLogger

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

func NewPluginLogger

func NewPluginLogger(name string, logger *zerolog.Logger) *PluginLogger

func (*PluginLogger) Debug

func (l *PluginLogger) Debug(msg string, args ...interface{})

func (*PluginLogger) Error

func (l *PluginLogger) Error(msg string, args ...interface{})

func (*PluginLogger) ImpliedArgs

func (l *PluginLogger) ImpliedArgs() []interface{}

ImpliedArgs returns the loggers implied args

func (*PluginLogger) Info

func (l *PluginLogger) Info(msg string, args ...interface{})

func (*PluginLogger) IsDebug

func (l *PluginLogger) IsDebug() bool

IsDebug checks if the current logger level is set to Debug TODO:SSSOCPaulCote - Make new config option for log level and integrate into pluggin logger as well

func (*PluginLogger) IsError

func (l *PluginLogger) IsError() bool

IsError checks if the current logger level is set to Error TODO:SSSOCPaulCote - Make new config option for log level and integrate into pluggin logger as well

func (*PluginLogger) IsInfo

func (l *PluginLogger) IsInfo() bool

IsInfo checks if the current logger level is set to Info TODO:SSSOCPaulCote - Make new config option for log level and integrate into pluggin logger as well

func (*PluginLogger) IsTrace

func (l *PluginLogger) IsTrace() bool

IsTrace checks if the current logger level is set to Trace TODO:SSSOCPaulCote - Make new config option for log level and integrate into pluggin logger as well

func (*PluginLogger) IsWarn

func (l *PluginLogger) IsWarn() bool

IsWarn checks if the current logger level is set to Warn TODO:SSSOCPaulCote - Make new config option for log level and integrate into pluggin logger as well

func (*PluginLogger) Log

func (l *PluginLogger) Log(level hclog.Level, msg string, args ...interface{})

func (*PluginLogger) Name

func (l *PluginLogger) Name() string

Name returns the name of the Logger

func (*PluginLogger) Named

func (l *PluginLogger) Named(name string) hclog.Logger

Creates a new sub-logger with added name

func (*PluginLogger) ResetNamed

func (l *PluginLogger) ResetNamed(name string) hclog.Logger

ResetNamed returns a new sub-logger with the given name

func (*PluginLogger) SetLevel

func (l *PluginLogger) SetLevel(level hclog.Level)

SetLevel doesn't do anything right now, just satisfies the interface

func (*PluginLogger) StandardLogger

func (l *PluginLogger) StandardLogger(opts *hclog.StandardLoggerOptions) *log.Logger

StandardLogger returns a go standard library logger

func (*PluginLogger) StandardWriter

func (l *PluginLogger) StandardWriter(opts *hclog.StandardLoggerOptions) io.Writer

StandardWriter returns an io package standard writer

func (*PluginLogger) Trace

func (l *PluginLogger) Trace(msg string, args ...interface{})

func (*PluginLogger) Warn

func (l *PluginLogger) Warn(msg string, args ...interface{})

func (*PluginLogger) With

func (l *PluginLogger) With(args ...interface{}) hclog.Logger

With returns a new sublogger using new key/value pairs in the log output

type PluginManager

type PluginManager struct {
	lanirpc.UnimplementedPluginAPIServer

	sync.WaitGroup
	// contains filtered or unexported fields
}

func NewPluginManager

func NewPluginManager(pluginDir string, pluginCfgs []*lanirpc.PluginConfig, zl zerolog.Logger, noMacaroons bool) *PluginManager

NewPluginManager takes a list of plugins, parses those plugin strings and instantiates a PluginManager

func (*PluginManager) AddMacaroonService

func (p *PluginManager) AddMacaroonService(service *macaroons.Service)

Adds the macaroon service provided to GrpcInterceptor struct attributes

func (*PluginManager) AddPermission

func (p *PluginManager) AddPermission(method string, ops []bakery.Op) error

AddPermission adds a new macaroon rule for the given method

func (*PluginManager) AddPermissions

func (p *PluginManager) AddPermissions(perms map[string][]bakery.Op) error

AddPermissions adds the inputted permission to the permissionMap attribute of the GrpcInterceptor struct

func (*PluginManager) AddPlugin

func (p *PluginManager) AddPlugin(ctx context.Context, req *lanirpc.PluginConfig) (*lanirpc.Plugin, error)

AddPlugin is the PluginAPI command to add a new plugin from a formatted plugin string

func (*PluginManager) Command

Command is the PluginAPI command for sending an arbitrary amount of data to a controller service

func (*PluginManager) GetPlugin

func (p *PluginManager) GetPlugin(ctx context.Context, req *lanirpc.PluginRequest) (*lanirpc.Plugin, error)

GetPlugin will retrieve the plugin information for a given plugin if it exists

func (*PluginManager) ListPlugins

func (p *PluginManager) ListPlugins(ctx context.Context, _ *proto.Empty) (*lanirpc.PluginsList, error)

ListPlugins is the PluginAPI command for listing all plugins in the plugin registry along with pertinent information about each one

func (*PluginManager) Ping

func (p *PluginManager) Ping(ctx context.Context) error

Ping implements the health package RegisteredHealthService interface TODO:SSSOCPaulCote - This should do more, it should actually probe the service to make sure everything is operating nominally

func (*PluginManager) RegisterWithGrpcServer

func (p *PluginManager) RegisterWithGrpcServer(grpcServer *grpc.Server) error

RegisterWithGrpcServer registers the PluginManager with the root gRPC server.

func (*PluginManager) RegisterWithRestProxy

func (p *PluginManager) RegisterWithRestProxy(ctx context.Context, mux *proxy.ServeMux, restDialOpts []grpc.DialOption, restProxyDest string) error

RegisterWithRestProxy registers the RPC Server with the REST proxy

func (*PluginManager) Start

func (p *PluginManager) Start(ctx context.Context) error

Start creates the connection to all registered plugins and establishes the connection to the API service

func (*PluginManager) StartPlugin

func (p *PluginManager) StartPlugin(ctx context.Context, req *lanirpc.PluginRequest) (*proto.Empty, error)

StartPlugin is the PluginAPI command to start an existiing plugin

func (*PluginManager) StartRecord

func (p *PluginManager) StartRecord(ctx context.Context, req *lanirpc.PluginRequest) (*proto.Empty, error)

StartRecord is the PluginAPI command which exposes the StartRecord method of all registered datasource plugins

func (*PluginManager) Stop

func (p *PluginManager) Stop() error

Stop kills all plugin sub-processes safely

func (*PluginManager) StopPlugin

func (p *PluginManager) StopPlugin(ctx context.Context, req *lanirpc.PluginRequest) (*proto.Empty, error)

StopPlugin is the PluginAPI command to stop a given plugin gracefully

func (*PluginManager) StopRecord

func (p *PluginManager) StopRecord(ctx context.Context, req *lanirpc.PluginRequest) (*proto.Empty, error)

StopRecord is the PluginAPI command which exposes the StopRecord method of all registered datasource plugins

func (*PluginManager) Subscribe

Subscribe is the PluginAPI command which exposes the data stream of any datasource plugin

func (*PluginManager) SubscribePluginState

SubscribePluginState implements the gRPC method of the same name. It subscribes a client to the given plugins state updates

type PluginRecordState

type PluginRecordState int32
const (
	NOTRECORDING PluginRecordState = iota
	RECORDING
)

type StateListener

type StateListener struct {
	IsConnected bool
	Signal      chan lanirpc.PluginState
}

Directories

Path Synopsis
plugins

Jump to

Keyboard shortcuts

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