dispatcher

package
v0.0.0-...-eb548cc Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2015 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Caller

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

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 JSON

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

func NewJSON

func NewJSON(
	actionFactory bocaction.Factory,
	caller Caller,
	logger boshlog.Logger,
) JSON

func (JSON) Dispatch

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

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 bocaction.Action, args []interface{}) (value interface{}, err error)

type Request

type Request struct {
	Method    string        `json:"method"`
	Arguments []interface{} `json:"arguments"`
}

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"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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