rpc

package
v0.0.0-...-526823b Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionFactory

type ActionFactory interface {
	Create(method string, apiVersion int, context apiv1.CallContext) (interface{}, error)
}

type CLI

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

func NewCLI

func NewCLI(in io.Reader, out io.Writer, dispatcher Dispatcher, logger boshlog.Logger) CLI

func (CLI) ServeOnce

func (t CLI) ServeOnce() error

type Caller

type Caller interface {
	Call(interface{}, []interface{}) (interface{}, error)
}

type CloudError

type CloudError interface {
	Error() string
	Type() string
}

type Dispatcher

type Dispatcher interface {
	// Dispatch interprets request bytes, executes request,
	// captures response and return response bytes.
	// It panics if built-in errors fail to serialize.
	Dispatch([]byte) []byte
}

type Factory

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

func NewFactory

func NewFactory(logger boshlog.Logger) Factory

func (Factory) NewCLI

func (f Factory) NewCLI(cpiFactory apiv1.CPIFactory) CLI

func (Factory) NewCLIWithInOut

func (f Factory) NewCLIWithInOut(in io.Reader, out io.Writer, cpiFactory apiv1.CPIFactory) CLI

type JSONCaller

type JSONCaller struct{}

JSONCaller unmarshals call arguments with json package and calls action.Run

func NewJSONCaller

func NewJSONCaller() JSONCaller

func (JSONCaller) Call

func (r JSONCaller) Call(action interface{}, args []interface{}) (value interface{}, err error)

type JSONDispatcher

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

func NewJSONDispatcher

func NewJSONDispatcher(actionFactory ActionFactory, caller Caller, logger boshlog.Logger) JSONDispatcher

func (JSONDispatcher) Dispatch

func (c JSONDispatcher) Dispatch(reqBytes []byte) []byte

type Request

type Request struct {
	Method     string               `json:"method"`
	Arguments  []interface{}        `json:"arguments"`
	Context    apiv1.CloudPropsImpl `json:"context"`
	APIVersion int                  `json:"api_version"`
}

type Response

type Response struct {
	Result interface{}    `json:"result"`
	Error  *ResponseError `json:"error"`
	Log    string         `json:"log"`
}

type ResponseError

type ResponseError struct {
	Type     string `json:"type"`
	Message  string `json:"message"`
	CanRetry bool   `json:"ok_to_retry"`
}

type RetryableError

type RetryableError interface {
	Error() string
	CanRetry() bool
}

Directories

Path Synopsis
This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter
This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter

Jump to

Keyboard shortcuts

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