plugin

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {

	// Name is the key used to refer to this plugin in all JSON configs
	Name string

	// Protocol is the transport protocol -- unix, tcp, etc.
	Protocol string

	// Address is the how to connect - socket file, host:port, etc.
	Address string
}

Endpoint is the address of the plugin service

type Info added in v0.2.0

type Info struct {

	// Vendor captures vendor-specific information about this plugin
	Vendor *spi.VendorInfo

	// Implements is a list of plugin interface and versions this plugin supports
	Implements []spi.InterfaceSpec

	// Interfaces (optional) is a slice of interface descriptions by the type and version
	Interfaces []InterfaceDescription `json:",omitempty"`
}

Info is metadata for the plugin

type Informer added in v0.2.0

type Informer interface {

	// GetInfo returns metadata about the plugin
	GetInfo() (Info, error)

	// GetFunctions returns metadata about the plugin's template functions, if the plugin supports templating.
	GetFunctions() (map[string][]template.Function, error)
}

Informer is the interface that gives information about the plugin such as version and interface methods

type InterfaceDescription added in v0.2.0

type InterfaceDescription struct {
	spi.InterfaceSpec
	Methods []MethodDescription
}

InterfaceDescription is a holder for RPC interface version and method descriptions

type MethodDescription added in v0.2.0

type MethodDescription struct {
	// Request is the RPC request example
	Request Request

	// Response is the RPC response example
	Response Response
}

MethodDescription contains information about the RPC method such as the request and response example structs. The request value can be used as an example input, possibly with example plugin-custom properties if the underlying plugin implements the InputExample interface. The response value gives an example of the example response.

type Name added in v0.2.0

type Name string

Name is a reference to the plugin. Places where it appears include JSON files as type of field `Plugin`.

func (Name) GetLookupAndType added in v0.2.0

func (r Name) GetLookupAndType() (string, string)

GetLookupAndType returns the plugin name for lookup and sub-type supported by the plugin. The name follows a microformat of $plugin[/$subtype] where $plugin is used for the discovery / lookup by name. The $subtype is used for the Type parameter in the RPC requests. Example: instance-file/json means lookup socket file 'instance-file' and the type is 'json'.

func (Name) MarshalJSON added in v0.2.0

func (r Name) MarshalJSON() ([]byte, error)

MarshalJSON implements the JSON marshaler interface

func (Name) String added in v0.2.0

func (r Name) String() string

String returns the string representation

func (*Name) UnmarshalJSON added in v0.2.0

func (r *Name) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the JSON unmarshaler interface

type Request added in v0.2.0

type Request struct {

	// Version is the version of the JSON RPC protocol
	Version string `json:"jsonrpc"`

	// Method is the rpc method to use in the payload field 'method'
	Method string `json:"method"`

	// Params contains example inputs.  This can be a zero value struct or one with defaults
	Params interface{} `json:"params"`

	// ID is the request is
	ID string `json:"id"`
}

Request models the RPC request payload

type Response added in v0.2.0

type Response struct {

	// Result is the result of the call
	Result interface{} `json:"result"`

	// ID is id matching the request ID
	ID string `json:"id"`
}

Response is the RPC response struct

type Spec added in v0.3.0

type Spec struct {

	// Plugin is the name of the plugin
	Plugin Name

	// Properties is the configuration of the plugin
	Properties *types.Any
}

Spec models a canonical pattern of fields that exist in a struct/ map / union that indicates the block is a plugin.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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