directory
Version:
v1.0.4
Opens a new window with list of versions in this module.
Published: Sep 8, 2017
License: Apache-2.0
Opens a new window with license information.
README
¶
Flavors
A flavor is a reusable collection of plugins. It allows inspecting
capabilities available to an agent. By convention, a Flavor should
provide:
- a method called
Inject()
, which should wire the flavor's plugins
together and to their external dependencies (typically via dependency
injection.
- a method called
Plugins()
, which should return all plugins contained
in the Flavor, including plugins contained in reused Flavors.
Example:
type MyFlavor struct {
injected bool
Aplugin a.Plugin
Bplugin b.Plugin
Cplugin c.Plugin
}
func (f *MyFlavor) Inject() error {
if f.injected {
return nil
}
f.injected = true
f.Bplugin.A = &f.Aplugin
f.Cplugin.B = &f.Bplugin
return nil
}
func (f *MyFlavor) Plugins() []*core.NamedPlugin {
f.Inject()
return core.ListPluginsInFlavor(f)
}
Directories
¶
Click to show internal directories.
Click to hide internal directories.