plugin

package
v0.0.0-...-139fbb7 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const SetupFuncName = "Setup"

Variables

View Source
var (
	ErrPluginNotFound      = errors.New("plugin not found")
	ErrPluginSetupFuncCast = errors.New("could not cast setup function")
)

Functions

This section is empty.

Types

type GRPCServiceRegisterer

type GRPCServiceRegisterer interface {
	Register(*grpc.Server) error
}

type Option

type Option func(*Plugin)

func WithFlagSet

func WithFlagSet(flags *pflag.FlagSet) Option

type Plugin

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

func New

func New(id, version string, runnable Runnable, opts ...Option) *Plugin

func (Plugin) FlagSet

func (p Plugin) FlagSet() *pflag.FlagSet

func (Plugin) ID

func (p Plugin) ID() string

func (Plugin) Runnable

func (p Plugin) Runnable() Runnable

func (Plugin) Version

func (p Plugin) Version() string

type Runnable

type Runnable func(*zap.Logger, *viper.Viper) (GRPCServiceRegisterer, error)

type Storage

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

func NewStorage

func NewStorage(l *zap.Logger, v *viper.Viper) *Storage

func (*Storage) Add

func (s *Storage) Add(p *Plugin)

func (*Storage) All

func (s *Storage) All() map[string]*Plugin

func (*Storage) Get

func (s *Storage) Get(id string) (*Plugin, error)

func (*Storage) LoadShared

func (s *Storage) LoadShared(path string) error

func (*Storage) MergeFlagSets

func (s *Storage) MergeFlagSets(f *pflag.FlagSet)

func (*Storage) RegisterGRPCServices

func (s *Storage) RegisterGRPCServices(svr *grpc.Server) error

Jump to

Keyboard shortcuts

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