Documentation ¶
Index ¶
- type Callback
- type CorePlugin
- type CorePluginForEachFunc
- type InitConfig
- type InitConfigParsFunc
- type InitFunc
- type InitPlugin
- type Node
- func (n *Node) Daemon() daemon.Daemon
- func (n *Node) ForEachCorePlugin(f CorePluginForEachFunc)
- func (n *Node) ForEachPlugin(f PluginForEachFunc)
- func (n *Node) IsSkipped(plugin *Plugin) bool
- func (n *Node) LogDebug(args ...interface{})
- func (n *Node) LogDebugf(template string, args ...interface{})
- func (n *Node) LogError(args ...interface{})
- func (n *Node) LogErrorf(template string, args ...interface{})
- func (n *Node) LogFatal(args ...interface{})
- func (n *Node) LogFatalf(template string, args ...interface{})
- func (n *Node) LogInfo(args ...interface{})
- func (n *Node) LogInfof(template string, args ...interface{})
- func (n *Node) LogPanic(args ...interface{})
- func (n *Node) LogPanicf(template string, args ...interface{})
- func (n *Node) LogWarn(args ...interface{})
- func (n *Node) LogWarnf(template string, args ...interface{})
- func (n *Node) Run()
- func (n *Node) Shutdown()
- func (n *Node) Start()
- type NodeOption
- type NodeOptions
- type Pluggable
- func (p *Pluggable) Daemon() daemon.Daemon
- func (p *Pluggable) Identifier() string
- func (p *Pluggable) LogDebug(args ...interface{})
- func (p *Pluggable) LogDebugf(template string, args ...interface{})
- func (p *Pluggable) LogError(args ...interface{})
- func (p *Pluggable) LogErrorf(template string, args ...interface{})
- func (p *Pluggable) LogFatal(args ...interface{})
- func (p *Pluggable) LogFatalf(template string, args ...interface{})
- func (p *Pluggable) LogInfo(args ...interface{})
- func (p *Pluggable) LogInfof(template string, args ...interface{})
- func (p *Pluggable) LogPanic(args ...interface{})
- func (p *Pluggable) LogPanicf(template string, args ...interface{})
- func (p *Pluggable) LogWarn(args ...interface{})
- func (p *Pluggable) LogWarnf(template string, args ...interface{})
- func (p *Pluggable) Logger() *logger.Logger
- type Plugin
- type PluginForEachFunc
- type PluginParams
- type PluginStatus
- type PreProvideFunc
- type ProvideFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CorePlugin ¶
type CorePlugin struct {
Pluggable
}
CorePlugin is a plugin essential for node operation. It can not be disabled.
type CorePluginForEachFunc ¶
type CorePluginForEachFunc func(corePlugin *CorePlugin) bool
CorePluginForEachFunc is used in ForEachCorePlugin. Returning false indicates to stop looping.
type InitConfig ¶
type InitConfig struct { EnabledPlugins []string DisabledPlugins []string // contains filtered or unexported fields }
InitConfig describes the result of a node initialization.
func (*InitConfig) ForceDisablePluggable ¶ added in v1.0.5
func (ic *InitConfig) ForceDisablePluggable(identifier string)
ForceDisablePluggable is used to force disable pluggables before the provide stage.
type InitConfigParsFunc ¶ added in v1.0.5
InitConfigParsFunc gets called with a dig.Container.
type InitPlugin ¶
type InitPlugin struct { Pluggable // Init gets called in the initialization stage of the node. Init InitFunc // The configs this InitPlugin brings to the node. Configs map[string]*configuration.Configuration }
InitPlugin is the module initializing configuration of the node. A Node can only have one of such modules.
type Node ¶
type Node struct {
// 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) ForEachCorePlugin ¶
func (n *Node) ForEachCorePlugin(f CorePluginForEachFunc)
ForEachCorePlugin calls the given CorePluginForEachFunc on each loaded core plugins.
func (*Node) ForEachPlugin ¶
func (n *Node) ForEachPlugin(f PluginForEachFunc)
ForEachPlugin calls the given PluginForEachFunc on each loaded plugin.
func (*Node) LogDebug ¶ added in v1.0.5
func (n *Node) LogDebug(args ...interface{})
LogDebug uses fmt.Sprint to construct and log a message.
func (*Node) LogError ¶ added in v1.0.5
func (n *Node) LogError(args ...interface{})
LogError uses fmt.Sprint to construct and log a message.
func (*Node) LogFatal ¶ added in v1.0.5
func (n *Node) LogFatal(args ...interface{})
LogFatal uses fmt.Sprint to construct and log a message, then calls os.Exit.
func (*Node) LogFatalf ¶ added in v1.0.5
LogFatalf uses fmt.Sprintf to log a templated message, then calls os.Exit.
func (*Node) LogInfo ¶ added in v1.0.5
func (n *Node) LogInfo(args ...interface{})
LogInfo uses fmt.Sprint to construct and log a message.
func (*Node) LogPanic ¶ added in v1.1.0
func (n *Node) LogPanic(args ...interface{})
LogPanic uses fmt.Sprint to construct and log a message, then panics.
func (*Node) LogPanicf ¶ added in v1.1.0
LogPanicf uses fmt.Sprintf to log a templated message, then panics.
func (*Node) LogWarn ¶ added in v1.0.5
func (n *Node) LogWarn(args ...interface{})
LogWarn uses fmt.Sprint to construct and log a message.
type NodeOption ¶
type NodeOption func(opts *NodeOptions)
NodeOption is a function setting a NodeOptions option.
func WithCorePlugins ¶
func WithCorePlugins(corePlugins ...*CorePlugin) NodeOption
WithCorePlugins sets the core plugins.
func WithInitPlugin ¶
func WithInitPlugin(initPlugin *InitPlugin) NodeOption
WithInitPlugin sets the init plugin.
type NodeOptions ¶
type NodeOptions struct {
// contains filtered or unexported fields
}
NodeOptions defines options for a Node.
type Pluggable ¶
type Pluggable struct { // A reference to the Node instance. Node *Node // The name of the plugin. Name string // The config parameters for this plugin. Params *PluginParams // The function to call to initialize the plugin dependencies. DepsFunc interface{} // InitConfigPars gets called in the init stage of node initialization. // This can be used to provide config parameters even if the pluggable is disabled. InitConfigPars InitConfigParsFunc // PreProvide gets called before the provide stage of node initialization. // This can be used to force disable other pluggables before they get initialized. PreProvide PreProvideFunc // Provide gets called in the provide stage of node initialization (enabled pluggables only). Provide ProvideFunc // Configure gets called in the configure stage of node initialization (enabled pluggables only). Configure Callback // Run gets called in the run stage of node initialization (enabled pluggables only). Run Callback // contains filtered or unexported fields }
Pluggable is something which extends the Node's capabilities.
func (*Pluggable) Identifier ¶ added in v1.0.5
func (*Pluggable) LogDebug ¶ added in v1.0.5
func (p *Pluggable) LogDebug(args ...interface{})
LogDebug uses fmt.Sprint to construct and log a message.
func (*Pluggable) LogDebugf ¶ added in v1.0.5
LogDebugf uses fmt.Sprintf to log a templated message.
func (*Pluggable) LogError ¶ added in v1.0.5
func (p *Pluggable) LogError(args ...interface{})
LogError uses fmt.Sprint to construct and log a message.
func (*Pluggable) LogErrorf ¶ added in v1.0.5
LogErrorf uses fmt.Sprintf to log a templated message.
func (*Pluggable) LogFatal ¶ added in v1.0.5
func (p *Pluggable) LogFatal(args ...interface{})
LogFatal uses fmt.Sprint to construct and log a message, then calls os.Exit.
func (*Pluggable) LogFatalf ¶ added in v1.0.5
LogFatalf uses fmt.Sprintf to log a templated message, then calls os.Exit.
func (*Pluggable) LogInfo ¶ added in v1.0.5
func (p *Pluggable) LogInfo(args ...interface{})
LogInfo uses fmt.Sprint to construct and log a message.
func (*Pluggable) LogPanic ¶ added in v1.1.0
func (p *Pluggable) LogPanic(args ...interface{})
LogPanic uses fmt.Sprint to construct and log a message, then panics.
func (*Pluggable) LogPanicf ¶ added in v1.1.0
LogPanicf uses fmt.Sprintf to log a templated message, then panics.
func (*Pluggable) LogWarn ¶ added in v1.0.5
func (p *Pluggable) LogWarn(args ...interface{})
LogWarn uses fmt.Sprint to construct and log a message.
type Plugin ¶
type Plugin struct { Pluggable // The status of the plugin. Status PluginStatus }
type PluginForEachFunc ¶
PluginForEachFunc is used in ForEachPlugin. Returning false indicates to stop looping.
type PluginParams ¶
type PluginParams struct { // The parameters of the plugin under for the defined configuration. Params map[string]*flag.FlagSet // The configuration values to mask. Masked []string }
PluginParams defines the parameters configuration of a plugin.
type PluginStatus ¶ added in v1.0.5
type PluginStatus int
const ( StatusDisabled PluginStatus = iota StatusEnabled )
type PreProvideFunc ¶ added in v1.0.5
type PreProvideFunc func(c *dig.Container, configs map[string]*configuration.Configuration, initConf *InitConfig)
PreProvideFunc gets called with a dig.Container, the configs the InitPlugin brings to the node and the InitConfig.
type ProvideFunc ¶
ProvideFunc gets called with a dig.Container.