burrow: github.com/hyperledger/burrow/rpc/lib/types Index | Files

package types

import "github.com/hyperledger/burrow/rpc/lib/types"

Index

Package Files

error_codes.go types.go

func SocketType Uses

func SocketType(listenAddr string) string

---------------------------------------- SOCKETS

Determine if its a unix or tcp socket. If tcp, must specify the port; `0.0.0.0` will return incorrectly as "unix" since there's no port TODO: deprecate

type EventSubscriber Uses

type EventSubscriber interface {
    Subscribe(ctx context.Context, subscriber string, query tmpubsub.Query, out chan<- interface{}) error
    Unsubscribe(ctx context.Context, subscriber string, query tmpubsub.Query) error
    UnsubscribeAll(ctx context.Context, subscriber string) error
}

EventSubscriber mirros tendermint/tendermint/types.EventBusSubscriber

type RPCError Uses

type RPCError struct {
    Code    RPCErrorCode `json:"code"`
    Message string       `json:"message"`
    Data    string       `json:"data,omitempty"`
}

func (RPCError) Error Uses

func (err RPCError) Error() string

func (*RPCError) HTTPStatusCode Uses

func (err *RPCError) HTTPStatusCode() int

type RPCErrorCode Uses

type RPCErrorCode int

From JSONRPC 2.0 spec

const (
    RPCErrorCodeParseError     RPCErrorCode = -32700
    RPCErrorCodeInvalidRequest RPCErrorCode = -32600
    RPCErrorCodeMethodNotFound RPCErrorCode = -32601
    RPCErrorCodeInvalidParams  RPCErrorCode = -32602
    RPCErrorCodeInternalError  RPCErrorCode = -32603
    RPCErrorCodeServerError    RPCErrorCode = -32000
)

func (RPCErrorCode) Error Uses

func (code RPCErrorCode) Error() string

func (RPCErrorCode) HTTPStatusCode Uses

func (code RPCErrorCode) HTTPStatusCode() int

func (RPCErrorCode) String Uses

func (code RPCErrorCode) String() string

type RPCRequest Uses

type RPCRequest struct {
    JSONRPC string          `json:"jsonrpc"`
    ID      string          `json:"id"`
    Method  string          `json:"method"`
    Params  json.RawMessage `json:"params"` // must be map[string]interface{} or []interface{}
}

func ArrayToRequest Uses

func ArrayToRequest(id string, method string, params []interface{}) (RPCRequest, error)

func MapToRequest Uses

func MapToRequest(id string, method string, params map[string]interface{}) (RPCRequest, error)

func NewRPCRequest Uses

func NewRPCRequest(id string, method string, params json.RawMessage) RPCRequest

func (RPCRequest) String Uses

func (req RPCRequest) String() string

type RPCResponse Uses

type RPCResponse struct {
    JSONRPC string          `json:"jsonrpc"`
    ID      string          `json:"id"`
    Result  json.RawMessage `json:"result,omitempty"`
    Error   *RPCError       `json:"error,omitempty"`
}

func NewRPCErrorResponse Uses

func NewRPCErrorResponse(id string, code RPCErrorCode, data string) RPCResponse

func NewRPCSuccessResponse Uses

func NewRPCSuccessResponse(id string, res interface{}) RPCResponse

func RPCInternalError Uses

func RPCInternalError(id string, err error) RPCResponse

func RPCInvalidParamsError Uses

func RPCInvalidParamsError(id string, err error) RPCResponse

func RPCInvalidRequestError Uses

func RPCInvalidRequestError(id string, err error) RPCResponse

func RPCMethodNotFoundError Uses

func RPCMethodNotFoundError(id string) RPCResponse

func RPCParseError Uses

func RPCParseError(id string, err error) RPCResponse

func RPCServerError Uses

func RPCServerError(id string, err error) RPCResponse

func (RPCResponse) String Uses

func (resp RPCResponse) String() string

type WSRPCConnection Uses

type WSRPCConnection interface {
    GetRemoteAddr() string
    WriteRPCResponse(resp RPCResponse)
    TryWriteRPCResponse(resp RPCResponse) bool
    GetEventSubscriber() EventSubscriber
}

*wsConnection implements this interface.

type WSRPCContext Uses

type WSRPCContext struct {
    Request RPCRequest
    WSRPCConnection
}

websocket-only RPCFuncs take this as the first parameter.

Package types imports 8 packages (graph) and is imported by 8 packages. Updated 2018-08-14. Refresh now. Tools for package owners.