Documentation ¶
Index ¶
- func ExLoadFactoryByConfig(ctx context.Context, b bus.Bus, conf config.Config) (controller.Factory, directive.Reference, error)
- type Controller
- func (c *Controller) Close() error
- func (c *Controller) Execute(ctx context.Context) error
- func (c *Controller) GetControllerID() string
- func (c *Controller) GetControllerInfo() *controller.Info
- func (c *Controller) HandleDirective(ctx context.Context, di directive.Instance) ([]directive.Resolver, error)
- type LoadConfigConstructorByID
- type LoadConfigConstructorByIDResolver
- type LoadConfigConstructorByIDValue
- type LoadControllerWithConfig
- type LoadControllerWithConfigValue
- type LoadFactoryByConfig
- type LoadFactoryByConfigResolver
- type LoadFactoryByConfigValue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExLoadFactoryByConfig ¶ added in v0.8.7
func ExLoadFactoryByConfig( ctx context.Context, b bus.Bus, conf config.Config, ) (controller.Factory, directive.Reference, error)
ExLoadFactoryByConfig executes the LoadFactoryByConfig directive. the directive should be released after the Factory is no longer needed.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller implements the controller resolver controller. This controller responds to LoadControllerWithConfig directives.
func NewController ¶
func NewController(le *logrus.Entry, bus bus.Bus, resolver controller.FactoryResolver) *Controller
NewController constructs a new controller with a resolver.
func (*Controller) Close ¶
func (c *Controller) Close() error
Close releases any resources used by the controller. Error indicates any issue encountered releasing.
func (*Controller) Execute ¶
func (c *Controller) Execute(ctx context.Context) error
Execute executes the given controller. Returning nil ends execution. Returning an error triggers a retry with backoff.
func (*Controller) GetControllerID ¶
func (c *Controller) GetControllerID() string
GetControllerID returns the controller ID.
func (*Controller) GetControllerInfo ¶
func (c *Controller) GetControllerInfo() *controller.Info
GetControllerInfo returns information about the controller.
func (*Controller) HandleDirective ¶
func (c *Controller) HandleDirective(ctx context.Context, di directive.Instance) ([]directive.Resolver, error)
HandleDirective asks if the handler can resolve the directive. If it can, it returns a resolver. If not, returns nil. Any unexpected errors are returned for logging. It is safe to add a reference to the directive during this call.
type LoadConfigConstructorByID ¶
type LoadConfigConstructorByID interface { // Directive indicates this is a directive. directive.Directive // LoadConfigConstructorByIDConfigID is the configuration ID to use. LoadConfigConstructorByIDConfigID() string }
LoadConfigConstructorByID loads a controller configuration object constructor given a configuration ID. This resolves the configuration ID to a configuration object, which may involve loading controller code. The directive should be held open until the constructor is no longer needed, and the underlying resources have been referenced as needed by controller directives.
Value type: config.Constructor
func NewLoadConfigConstructorByID ¶
func NewLoadConfigConstructorByID( configID string, ) LoadConfigConstructorByID
NewLoadConfigConstructorByID constructs a new LoadConfigConstructorByID directive.
type LoadConfigConstructorByIDResolver ¶
type LoadConfigConstructorByIDResolver struct {
// contains filtered or unexported fields
}
LoadConfigConstructorByIDResolver implements directive.Resolver for loading a controller configuration constructor with a config ID.
func (*LoadConfigConstructorByIDResolver) Resolve ¶
func (r *LoadConfigConstructorByIDResolver) Resolve( ctx context.Context, vh directive.ResolverHandler, ) error
Resolve resolves the values. Any fatal error resolving the value is returned.
type LoadConfigConstructorByIDValue ¶
type LoadConfigConstructorByIDValue = config.Constructor
LoadConfigConstructorByIDValue is the value type for LoadConfigConstructorByID.
type LoadControllerWithConfig ¶
type LoadControllerWithConfig interface { // Directive indicates this is a directive. directive.Directive // GetLoadControllerConfig returns the controller config to load. GetLoadControllerConfig() config.Config // GetExecControllerRetryBackoff returns the backoff to use for retries. // If empty / nil, uses the default. GetExecControllerRetryBackoff() func() backoff.BackOff }
LoadControllerWithConfig is a directive indicating a controller should be loaded and executed (in one action) given a configuration.
func NewLoadControllerWithConfig ¶
func NewLoadControllerWithConfig( config config.Config, ) LoadControllerWithConfig
NewLoadControllerWithConfig constructs a new LoadControllerWithConfig directive.
func NewLoadControllerWithConfigAndOpts ¶ added in v0.15.4
func NewLoadControllerWithConfigAndOpts( config config.Config, valueOpts directive.ValueOptions, execBackoff func() backoff.BackOff, ) LoadControllerWithConfig
NewLoadControllerWithConfigAndOpts constructs a new LoadControllerWithConfig directive.
type LoadControllerWithConfigValue ¶
type LoadControllerWithConfigValue = loader.ExecControllerValue
LoadControllerWithConfig is the value emitted to satisfy the LoadControllerWithConfig directive.
type LoadFactoryByConfig ¶
type LoadFactoryByConfig interface { // Directive indicates this is a directive. directive.Directive // LoadFactoryByConfig is the configuration to load a factory for. LoadFactoryByConfig() config.Config }
LoadFactoryByConfig loads a controller factory given a configuration object. This resolves the configuration object to a controller constructor, which may involve loading controller code. The directive should be held open until the factory is no longer needed, and the underlying resources have been referenced as needed by controller directives.
func NewLoadFactoryByConfig ¶
func NewLoadFactoryByConfig( loadConfig config.Config, ) LoadFactoryByConfig
NewLoadFactoryByConfig constructs a new LoadFactoryByConfig directive.
type LoadFactoryByConfigResolver ¶
type LoadFactoryByConfigResolver struct {
// contains filtered or unexported fields
}
LoadFactoryByConfigResolver implements directive.Resolver for loading a controller factory with a config object.
func (*LoadFactoryByConfigResolver) Resolve ¶
func (r *LoadFactoryByConfigResolver) Resolve( ctx context.Context, vh directive.ResolverHandler, ) error
Resolve resolves the values. Any fatal error resolving the value is returned.
type LoadFactoryByConfigValue ¶
type LoadFactoryByConfigValue = controller.Factory
LoadFactoryByConfigValue is the value type for LoadFactoryByConfig.