productv1

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2016 License: Apache-2.0 Imports: 6 Imported by: 28

Documentation

Overview

Package productv1 is the API for the V1 product interface.

Index

Constants

This section is empty.

Variables

View Source
var HandshakeConfig = plugin.HandshakeConfig{
	ProtocolVersion:  1,
	MagicCookieKey:   "BASIC_PLUGIN",
	MagicCookieValue: "hello",
}

Functions

func Run

func Run(p ProductDeployer)

Run runs a ProductDeployer as an RPC server. It should be called from a plugin's func main.

Types

type Args

type Args struct {
	Args        []string
	CloudConfig []byte
	CredStore   cred.Store
}

Args contains the args for a GetProduct call.

type ProductDeployer

type ProductDeployer interface {
	GetProduct(args []string, cloudConfig []byte, cs cred.Store) ([]byte, error)
}

ProductDeployer is the interface implemented by V1 product plugins.

type ProductPlugin

type ProductPlugin struct {
	Plugin ProductDeployer
}

ProductPlugin wraps up the RPC server and client into a single type.

func NewProductPlugin

func NewProductPlugin(pd ProductDeployer) ProductPlugin

NewProductPlugin decorates a ProductDeployer with the RPC functionality requried to operate as a product plugin.

func (ProductPlugin) Client

func (p ProductPlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error)

Client returns an RPC client that implements the ProductDeployer interface.

func (ProductPlugin) Server

func (p ProductPlugin) Server(*plugin.MuxBroker) (interface{}, error)

Server returns an RPC server that implements the ProductDeployer interface.

type ProductRPC

type ProductRPC struct {
	// contains filtered or unexported fields
}

ProductRPC is an implementation of ProductDeployer that talks over RPC.

func (*ProductRPC) GetProduct

func (p *ProductRPC) GetProduct(args []string, cloudConfig []byte, cs cred.Store) ([]byte, error)

GetProduct calls a plugin's GetProduct method over RPC.

type ProductRPCServer

type ProductRPCServer struct {
	Impl ProductDeployer
}

ProductRPCServer is the RPC server that ProductRPC connects to. It conforms to the requirements of net/rpc.

func (*ProductRPCServer) GetProduct

func (p *ProductRPCServer) GetProduct(args Args, resp *Response) error

GetProduct forwards the RPC request to the plugin's GetProduct method and sends back the results.

type Response

type Response struct {
	Bytes  []byte
	ErrRes string
}

Response contains the results of a GetProduct call.

Jump to

Keyboard shortcuts

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