plugins

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2016 License: Apache-2.0 Imports: 19 Imported by: 0

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

NewPlugin loads and initializes a new plugin. If client is nil, http.DefaultClient will be used.

func (*Plugin) Close

func (p *Plugin) Close()

Close closes the client

func (*Plugin) Report

func (p *Plugin) Report() (result report.Report, err error)

Report gets the latest report from the plugin

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) (*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) ForEach

func (r *Registry) ForEach(f func(p *Plugin))

ForEach walks through all the plugins running f for each one.

func (*Registry) Implementers

func (r *Registry) Implementers(iface string, f func(p *Plugin))

Implementers walks the available plugins fulfilling the given interface

func (*Registry) Name

func (r *Registry) Name() string

Name implements the Reporter interface

func (*Registry) Report

func (r *Registry) Report() (report.Report, error)

Report implements the Reporter interface

Jump to

Keyboard shortcuts

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