Documentation
¶
Index ¶
- Variables
- func DefaultControllerResolver(plugins func() discovery.Plugins) func(string) (controller.Controller, error)
- func DefaultFlavorResolver(plugins func() discovery.Plugins) func(string) (flavor.Plugin, error)
- func DefaultGroupResolver(plugins func() discovery.Plugins) func(string) (group.Plugin, error)
- func DefaultInstanceResolver(plugins func() discovery.Plugins) func(string) (instance.Plugin, error)
- func DefaultL4Resolver(plugins func() discovery.Plugins) func(string) (loadbalancer.L4, error)
- func DefaultMetadataResolver(plugins func() discovery.Plugins) func(string) (*MetadataCall, error)
- func IsExpired(err error) bool
- func IsReadonly(err error) bool
- func MetadataFunc(scope Scope) func(string, ...interface{}) (interface{}, error)
- type MetadataCall
- type Scope
- type Work
Constants ¶
This section is empty.
Variables ¶
var Nil = DefaultScope(func() discovery.Plugins { d, err := local.NewPluginDiscovery() if err != nil { panic(err) } return d })
Nil is no scope
Functions ¶
func DefaultControllerResolver ¶
func DefaultControllerResolver(plugins func() discovery.Plugins) func(string) (controller.Controller, error)
DefaultControllerResolver returns a resolver
func DefaultFlavorResolver ¶
DefaultFlavorResolver returns a resolver
func DefaultGroupResolver ¶
DefaultGroupResolver returns a resolver
func DefaultInstanceResolver ¶
func DefaultInstanceResolver(plugins func() discovery.Plugins) func(string) (instance.Plugin, error)
DefaultInstanceResolver returns a resolver
func DefaultL4Resolver ¶
DefaultL4Resolver returns a resolver
func DefaultMetadataResolver ¶
func DefaultMetadataResolver(plugins func() discovery.Plugins) func(string) (*MetadataCall, error)
DefaultMetadataResolver returns a resolver
func IsReadonly ¶
IsReadonly returns true if the error is from wait expired / timeout
func MetadataFunc ¶
MetadataFunc returns a template function to support metadata retrieval in templates. The function allows an additional parameter to set the value, provided the metadata plugin is not readonly (supports the metadata.Updatable spi). In the case of an update, the returned value is always an empty string, with error (can be nil). The behavior is the same as var function.
Types ¶
type MetadataCall ¶
MetadataCall is a struct that has all the information needed to evaluate a template metadata function
type Scope ¶
type Scope interface {
// Plugins returns the plugin lookup
Plugins() discovery.Plugins
// Stack returns the stack that entails this scope
Stack() (stack.Interface, error)
// Group is for looking up an group plugin
Group(n string) (group.Plugin, error)
// Controller returns the controller by name
Controller(n string) (controller.Controller, error)
// Instance is for looking up an instance plugin
Instance(n string) (instance.Plugin, error)
// Flavor is for lookup up a flavor plugin
Flavor(n string) (flavor.Plugin, error)
// L4 is for lookup up an L4 plugin
L4(n string) (loadbalancer.L4, error)
// Metadata is for resolving metadata / path related queries
Metadata(p string) (*MetadataCall, error)
// TemplateEngine creates a template engine for use.
TemplateEngine(url string, opts template.Options) (*template.Template, error)
}
Scope provides an environment in which the necessary plugins are available for doing a unit of work. The scope can be local or remote, namespaced, depending on implementation. The first implementation is to simply run a set of steps locally on a set of required plugins. Because the scope provides the plugin lookup, it can control what plugins are available. This is good for programmatically control access of what a piece of code can interact with the system. Scope is named scope instead of 'context' because it's much heavier weight and involves lots of calls across process boundaries, yet it provides lookup and scoping of services based on some business logical and locality of code.
func DefaultScope ¶
DefaultScope returns the default scope