node

package
v0.0.0-...-5dd4785 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2020 License: Apache-2.0, BSD-2-Clause Imports: 6 Imported by: 60

Documentation

Index

Constants

View Source
const (
	CFG_DISABLE_PLUGINS = "node.disablePlugins"
	CFG_ENABLE_PLUGINS  = "node.enablePlugins"
)
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, status int, callbacks ...Callback) *Plugin

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.

Jump to

Keyboard shortcuts

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