server

package
v0.0.0-...-7b2e207 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2018 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const MaxBytesRead = 10000000

MaxBytesRead limits the number of bytes to read per request

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTP

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

HTTP defines a structure for an HTTP server that provides REST API services.

func NewHTTP

func NewHTTP(rpc *RPC) *HTTP

NewHTTP creates an new http server instance

func (*HTTP) Start

func (s *HTTP) Start(addr string, startedCh chan bool) error

Start starts the http server. Passes true to the startedCh channel when started

type InvokeError

type InvokeError struct {
	Code  string `json:"code"`
	Msg   string `json:"msg"`
	Error bool   `json:"error"`
}

InvokeError describes an invoke error

type InvokeRequest

type InvokeRequest struct {
	ID       string   `json:"id"`
	Function string   `json:"function"`
	Params   []string `json:"params"`
}

InvokeRequest describes the body of a structured invoke request

type RPC

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

RPC defines a grpc server for invoking a cocoon code

func NewRPC

func NewRPC(connector *connector.Connector) *RPC

NewRPC creates a new grpc API server

func (*RPC) GetConnector

func (rpc *RPC) GetConnector() *connector.Connector

GetConnector returns the connector

func (*RPC) Start

func (rpc *RPC) Start(addr string, startedCh chan bool)

Start starts the API service

func (*RPC) Stop

func (rpc *RPC) Stop()

Stop stops the server

func (*RPC) Transact

func (rpc *RPC) Transact(ctx context.Context, req *proto_connector.Request) (*proto_connector.Response, error)

Transact handles cocoon code or ledger bound transactions.

type Success

type Success struct {
	Body []byte `json:"body"`
}

Success describes a successful response from a cocoon code

Directories

Path Synopsis
Package proto_connector is a generated protocol buffer package.
Package proto_connector is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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