dispatcher

package
v0.0.0-...-8e9553d Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2018 License: Apache-2.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Caller

type Caller interface {
	Call(bgcaction.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 bgcaction.Factory,
	caller Caller,
	logger bgcapi.MultiLogger,
) 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 bgcaction.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"`
}

func (ResponseError) Error

func (r ResponseError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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