node

package
v2.0.0-...-59fec89 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2021 License: Apache-2.0, BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Disabled = iota
	Enabled
)

Variables

View Source
var (
	DisabledPlugins = make(map[string]bool)
	EnabledPlugins  = make(map[string]bool)
)
View Source
var (
	Events = struct {
		AddPlugin *events.Event
	}{
		AddPlugin: events.NewEvent(pluginParameterCaller),
	}
)

Functions

func AddPlugin

func AddPlugin(plugin *Plugin)

func GetPluginIdentifier

func GetPluginIdentifier(name string) string

func GetPlugins

func GetPlugins() map[string]*Plugin

func IsSkipped

func IsSkipped(plugin *Plugin) bool

IsSkipped returns whether the plugin is loaded or skipped.

func Shutdown

func Shutdown()

Types

type Callback

type Callback = func(plugin *Plugin)

type Node

type Node struct {
	Logger *logger.Logger
	// contains filtered or unexported fields
}

func New

func New(optionalOptions ...NodeOption) *Node

func Run

func Run(optionalOptions ...NodeOption) *Node

func Start

func Start(optionalOptions ...NodeOption) *Node

func (*Node) Run

func (node *Node) Run()

func (*Node) Start

func (node *Node) Start()

type NodeOption

type NodeOption func(*NodeOptions)

func Daemon

func Daemon(daemon daemon.Daemon) NodeOption

func Plugins

func Plugins(plugins ...*Plugin) NodeOption

type NodeOptions

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

type Plugin

type Plugin struct {
	Node   *Node
	Name   string
	Status int
	Events pluginEvents
	// contains filtered or unexported fields
}

func NewPlugin

func NewPlugin(name string, deps interface{}, status int, callbacks ...Callback) *Plugin

NewPlugin creates a new plugin with the given name, default status and callbacks. The last specified callback is the mandatory run callback, while all other callbacks are configure callbacks.

func (*Plugin) LogDebug

func (p *Plugin) LogDebug(args ...interface{})

LogDebug uses fmt.Sprint to construct and log a message.

func (*Plugin) LogDebugf

func (p *Plugin) LogDebugf(format string, args ...interface{})

LogDebugf uses fmt.Sprintf to log a templated message.

func (*Plugin) LogError

func (p *Plugin) LogError(args ...interface{})

LogError uses fmt.Sprint to construct and log a message.

func (*Plugin) LogErrorf

func (p *Plugin) LogErrorf(format string, args ...interface{})

LogErrorf uses fmt.Sprintf to log a templated message.

func (*Plugin) LogFatal

func (p *Plugin) LogFatal(args ...interface{})

LogFatal uses fmt.Sprint to construct and log a message, then calls os.Exit.

func (*Plugin) LogFatalf

func (p *Plugin) LogFatalf(format string, args ...interface{})

LogFatalf uses fmt.Sprintf to log a templated message, then calls os.Exit.

func (*Plugin) LogInfo

func (p *Plugin) LogInfo(args ...interface{})

LogInfo uses fmt.Sprint to construct and log a message.

func (*Plugin) LogInfof

func (p *Plugin) LogInfof(format string, args ...interface{})

LogInfof uses fmt.Sprintf to log a templated message.

func (*Plugin) LogWarn

func (p *Plugin) LogWarn(args ...interface{})

LogWarn uses fmt.Sprint to construct and log a message.

func (*Plugin) LogWarnf

func (p *Plugin) LogWarnf(format string, args ...interface{})

LogWarnf uses fmt.Sprintf to log a templated message.

func (*Plugin) Logger

func (p *Plugin) Logger() *logger.Logger

Logger instantiates and returns a logger with the name of the plugin.

func (*Plugin) Panic

func (p *Plugin) Panic(args ...interface{})

Panic uses fmt.Sprint to construct and log a message, then panics.

func (*Plugin) Panicf

func (p *Plugin) Panicf(template string, args ...interface{})

Panicf uses fmt.Sprintf to log a templated message, then panics.

Jump to

Keyboard shortcuts

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