flavors/

directory
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2017 License: Apache-2.0

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

Path Synopsis

Jump to

Keyboard shortcuts

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