registry

package
v0.0.0-...-64130a5 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Plugin

type Plugin interface {

	// The name of the Plugin
	GetName() string

	// A ref to a struct which holds the options for the plugins
	// will be populated by cmd or other plugin runners
	GetOpts() interface{}

	// Will be called before the Plugin is used to ensure the Plugin is ready
	Init(logger *log.Logger) error
}

Plugin is to be registered with sshpiper to provide additional functions

type Registry

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

Registry is a place to hold all plugins

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new Registry

func (*Registry) Drivers

func (r *Registry) Drivers() []string

Drivers return all registered Plugins

func (*Registry) Get

func (r *Registry) Get(name string) interface{}

Get returns an Plugins by name, return nil if not found

func (*Registry) Register

func (r *Registry) Register(name string, driver interface{})

Register adds a Plugin with given name to Registry

Jump to

Keyboard shortcuts

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