node

package
v0.0.0-...-25ef478 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: Apache-2.0, BSD-2-Clause Imports: 9 Imported by: 8 modules, 60 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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) LogErrorAndExit

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

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

func (*Plugin) LogErrorf

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

LogErrorf uses fmt.Sprintf to log a templated message.

func (*Plugin) LogErrorfAndExit

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

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

func (*Plugin) LogFatalAndExit

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

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

func (*Plugin) LogFatalfAndExit

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

LogFatalfAndExit 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