Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MaxBytesReader ¶
func MaxBytesReader(r io.ReadCloser, maxBytes int64, err error) io.ReadCloser
MaxBytesReader is similar to net/http.MaxBytesReader, but lets us choose how to handle an overflow by providing an error. net/http.MaxBytesReader uses net/http internals to render a naff error message. There are other discrepancies with how this detects overflows. Not sure if that will cause issues. If you want to use it as part of an HTTP server, it's probably best to change it so you can provide a callback func, which renders your error message, as returning an error into the middle of the net/http server will not be useful.
Types ¶
type Plugin ¶
type Plugin struct { xfer.PluginSpec // contains filtered or unexported fields }
Plugin is the implementation of a plugin. It is responsible for doing the plugin handshake, gathering reports, etc.
func NewPlugin ¶
func NewPlugin(ctx context.Context, socket string, client *http.Client, expectedAPIVersion string, handshakeMetadata map[string]string) (*Plugin, error)
NewPlugin loads and initializes a new plugin. If client is nil, http.DefaultClient will be used.
func (*Plugin) Control ¶
func (p *Plugin) Control(request xfer.Request) (res PluginResponse)
Control sends a control message to a plugin
func (*Plugin) Implements ¶
Implements checks if the plugin implements the given interface
type PluginResponse ¶
type PluginResponse struct { xfer.Response ShortcutReport *report.Report `json:"shortcutReport,omitempty"` }
PluginResponse is an extension of xfer.Response that allows plugins to send the shortcut reports
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry maintains a list of available plugins by name.
func NewRegistry ¶
func NewRegistry(rootPath, apiVersion string, handshakeMetadata map[string]string, handlerRegistry *controls.HandlerRegistry, publisher ReportPublisher) (*Registry, error)
NewRegistry creates a new registry which watches the given dir root for new plugins, and adds them.
func (*Registry) Close ¶
func (r *Registry) Close()
Close shuts down the registry. It can still be used after this, but will be out of date.
func (*Registry) Implementers ¶
Implementers walks the available plugins fulfilling the given interface
type ReportPublisher ¶
ReportPublisher is an interface for publishing reports immediately