Documentation
¶
Index ¶
- Constants
- Variables
- type Controller
- func (c *Controller) BuildRemotePluginClient(pluginID, instanceKey string, waitAck bool) srpc.Client
- func (c *Controller) Close() error
- func (c *Controller) Execute(ctx context.Context) error
- func (c *Controller) GetControllerInfo() *controller.Info
- func (c *Controller) GetPluginHostClient() bldr_plugin.SRPCPluginHostClient
- func (c *Controller) GetPluginMeta() *bldr_plugin.PluginMeta
- func (c *Controller) HandleDirective(ctx context.Context, di directive.Instance) ([]directive.Resolver, error)
- func (c *Controller) WaitPluginClient(ctx context.Context, released func(), pluginID string) (srpc.Client, func(), error)
- func (c *Controller) WaitPluginHostClient(ctx context.Context, released func()) (srpc.Client, func(), error)
Constants ¶
const ControllerID = "bldr/plugin/entrypoint/controller"
ControllerID is the controller ID.
Variables ¶
var Version = semver.MustParse("0.0.1")
Version is the version of this controller.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller implements the plugin entrypoint controller. Handles directives from the plugin bus forwarding RPCs to the host. Ex: LoadPlugin, LookupRpcClient<plugin/foo/ or plugin-host/>
func NewController ¶
func NewController(b bus.Bus, le *logrus.Entry, meta *bldr_plugin.PluginMeta, srv bldr_plugin.SRPCPluginHostClient) *Controller
NewController constructs the plugin entrypoint controller.
func (*Controller) BuildRemotePluginClient ¶
func (c *Controller) BuildRemotePluginClient(pluginID, instanceKey string, waitAck bool) srpc.Client
BuildRemotePluginClient builds a client for the remote plugin.
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 controller goroutine. Returning nil ends execution. Returning an error triggers a retry with backoff.
func (*Controller) GetControllerInfo ¶
func (c *Controller) GetControllerInfo() *controller.Info
GetControllerInfo returns information about the controller.
func (*Controller) GetPluginHostClient ¶
func (c *Controller) GetPluginHostClient() bldr_plugin.SRPCPluginHostClient
GetPluginHostClient returns the plugin host client.
func (*Controller) GetPluginMeta ¶
func (c *Controller) GetPluginMeta() *bldr_plugin.PluginMeta
GetPluginMeta returns a copy of the plugin meta object.
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 resolver(s). If not, returns nil. It is safe to add a reference to the directive during this call. The context passed is canceled when the directive instance expires.
func (*Controller) WaitPluginClient ¶
func (c *Controller) WaitPluginClient(ctx context.Context, released func(), pluginID string) (srpc.Client, func(), error)
WaitPluginClient waits for an RPC client for a plugin.
if pluginID is invalid, returns an error.
Released is a function to call if the client becomes invalid. Returns nil, nil, err if any error. Returns nil, nil, nil to skip resolving the client. Otherwise returns client, releaseFunc, nil
func (*Controller) WaitPluginHostClient ¶
func (c *Controller) WaitPluginHostClient(ctx context.Context, released func()) (srpc.Client, func(), error)
WaitPluginHostClient waits for an RPC client for the plugin host.
Released is a function to call if the client becomes invalid. Returns nil, nil, err if any error. Returns nil, nil, nil to skip resolving the client. Otherwise returns client, releaseFunc, nil