rpc

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2018 License: Apache-2.0 Imports: 32 Imported by: 22

Documentation

Overview

Package rpc is a generated protocol buffer package.

It is generated from these files:

rpc.proto

It has these top-level messages:

ResultStatus

Index

Constants

View Source
const (
	INVALID_REQUEST  = -32600
	METHOD_NOT_FOUND = -32601
	INVALID_PARAMS   = -32602
	INTERNAL_ERROR   = -32603
	PARSE_ERROR      = -32700
)

JSON-RPC 2.0 error codes.

View Source
const MaxBlockLookback = 1000

Magic! Should probably be configurable, but not shouldn't be so huge we end up DoSing ourselves.

Variables

View Source
var (
	ErrInvalidLengthRpc = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowRpc   = fmt.Errorf("proto: integer overflow")
)

Functions

func NewGRPCServer added in v0.19.0

func NewGRPCServer(logger *logging.Logger) *grpc.Server

Types

type AccountHumanReadable added in v0.18.0

type AccountHumanReadable struct {
	Address     crypto.Address
	PublicKey   crypto.PublicKey
	Sequence    uint64
	Balance     uint64
	Code        []string
	Permissions []string
	Roles       []string
}

type Block added in v0.19.0

type Block struct {
	*tmTypes.Block
}

Needed for go-amino handling of interface types

func (Block) MarshalJSON added in v0.19.0

func (b Block) MarshalJSON() ([]byte, error)

func (*Block) UnmarshalJSON added in v0.19.0

func (b *Block) UnmarshalJSON(data []byte) (err error)

type BlockMeta added in v0.19.0

type BlockMeta struct {
	*tmTypes.BlockMeta
}

func (BlockMeta) MarshalJSON added in v0.19.0

func (bm BlockMeta) MarshalJSON() ([]byte, error)

func (*BlockMeta) UnmarshalJSON added in v0.19.0

func (bm *BlockMeta) UnmarshalJSON(data []byte) (err error)

type Codec

type Codec interface {
	EncodeBytes(interface{}) ([]byte, error)
	Encode(interface{}, io.Writer) error
	DecodeBytes(interface{}, []byte) error
	Decode(interface{}, io.Reader) error
}

Used for rpc request and response data.

type GRPCConfig added in v0.19.0

type GRPCConfig struct {
	Enabled       bool
	ListenAddress string
}

type MetricsConfig added in v0.19.0

type MetricsConfig struct {
	Enabled         bool
	ListenAddress   string
	MetricsPath     string
	BlockSampleSize uint64
}

func DefaultMetricsConfig added in v0.19.0

func DefaultMetricsConfig() *MetricsConfig

type Peer added in v0.18.0

type Peer struct {
	NodeInfo   *tendermint.NodeInfo
	IsOutbound bool
}

type ProfilerConfig added in v0.18.0

type ProfilerConfig struct {
	Enabled       bool
	ListenAddress string
}

type RPCConfig added in v0.18.0

type RPCConfig struct {
	TM       *ServerConfig  `json:",omitempty" toml:",omitempty"`
	Profiler *ServerConfig  `json:",omitempty" toml:",omitempty"`
	GRPC     *ServerConfig  `json:",omitempty" toml:",omitempty"`
	Metrics  *MetricsConfig `json:",omitempty" toml:",omitempty"`
}

func DefaultRPCConfig added in v0.18.0

func DefaultRPCConfig() *RPCConfig

type RPCError

type RPCError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

RPCError MUST be included in the Response object if an error occured

func (RPCError) Error added in v0.18.0

func (err RPCError) Error() string

type RPCErrorResponse

type RPCErrorResponse struct {
	Error   *RPCError `json:"error"`
	Id      string    `json:"id"`
	JSONRPC string    `json:"jsonrpc"`
}

RPCErrorResponse MUST NOT contain the result member if an error occured

func (*RPCErrorResponse) AssertIsRPCResponse

func (rpcErrorResponse *RPCErrorResponse) AssertIsRPCResponse() bool

AssertIsRPCResponse implements a marker method for RPCErrorResponse to implement the interface RPCResponse

type RPCRequest

type RPCRequest struct {
	JSONRPC string          `json:"jsonrpc"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params"`
	Id      string          `json:"id"`
}

Request and Response objects. Id is a string. Error data not used. Refer to JSON-RPC specification http://www.jsonrpc.org/specification

func NewRPCRequest added in v0.16.2

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

Create a new RPC request. This is the generic struct that is passed to RPC methods

type RPCResponse

type RPCResponse interface {
	AssertIsRPCResponse() bool
}

RPCResponse MUST follow the JSON-RPC specification for Response object reference: http://www.jsonrpc.org/specification#response_object

func NewRPCErrorResponse

func NewRPCErrorResponse(id string, code int, message string) RPCResponse

NewRPCErrorResponse creates a new error-response object from the error code and message

func NewRPCResponse

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

NewRPCResponse creates a new response object from a result

type RPCResultResponse

type RPCResultResponse struct {
	Result  interface{} `json:"result"`
	Id      string      `json:"id"`
	JSONRPC string      `json:"jsonrpc"`
}

RPCResultResponse MUST NOT contain the error member if no error occurred

func (*RPCResultResponse) AssertIsRPCResponse

func (rpcResultResponse *RPCResultResponse) AssertIsRPCResponse() bool

AssertIsRPCResponse implements a marker method for RPCResultResponse to implement the interface RPCResponse

type ResultChainId added in v0.18.0

type ResultChainId struct {
	ChainName   string
	ChainId     string
	GenesisHash binary.HexBytes
}

type ResultDumpConsensusState added in v0.18.0

type ResultDumpConsensusState struct {
	RoundState      consensusTypes.RoundStateSimple
	PeerRoundStates []*consensusTypes.PeerRoundState
}

type ResultDumpStorage added in v0.18.0

type ResultDumpStorage struct {
	StorageItems []StorageItem
}

type ResultGeneratePrivateAccount added in v0.18.0

type ResultGeneratePrivateAccount struct {
	PrivateAccount *acm.ConcretePrivateAccount
}

type ResultGenesis added in v0.18.0

type ResultGenesis struct {
	Genesis genesis.GenesisDoc
}

type ResultGetAccount added in v0.18.0

type ResultGetAccount struct {
	Account *acm.ConcreteAccount
}

type ResultGetAccountHumanReadable added in v0.18.0

type ResultGetAccountHumanReadable struct {
	Account *AccountHumanReadable
}

type ResultGetBlock added in v0.18.0

type ResultGetBlock struct {
	BlockMeta *BlockMeta
	Block     *Block
}

type ResultGetName added in v0.18.0

type ResultGetName struct {
	Entry *names.Entry
}

type ResultGetStorage added in v0.18.0

type ResultGetStorage struct {
	Key   binary.HexBytes
	Value binary.HexBytes
}

type ResultListAccounts added in v0.18.0

type ResultListAccounts struct {
	BlockHeight uint64
	Accounts    []*acm.ConcreteAccount
}

type ResultListBlocks added in v0.18.0

type ResultListBlocks struct {
	LastHeight uint64
	BlockMetas []*tmTypes.BlockMeta
}

type ResultListNames added in v0.18.0

type ResultListNames struct {
	BlockHeight uint64
	Names       []*names.Entry
}

type ResultListUnconfirmedTxs added in v0.18.0

type ResultListUnconfirmedTxs struct {
	NumTxs int
	Txs    []*txs.Envelope
}

type ResultListValidators added in v0.18.0

type ResultListValidators struct {
	BlockHeight         uint64
	BondedValidators    []*validator.Validator
	UnbondingValidators []*validator.Validator
}

type ResultNetInfo added in v0.18.0

type ResultNetInfo struct {
	ThisNode  *tendermint.NodeInfo
	Listening bool
	Listeners []string
	Peers     []*Peer
}

type ResultPeers added in v0.18.0

type ResultPeers struct {
	Peers []*Peer
}

type ResultSignTx added in v0.18.0

type ResultSignTx struct {
	Tx *txs.Envelope
}

type ResultStatus added in v0.18.0

type ResultStatus struct {
	ChainID           string                                        `protobuf:"bytes,1,opt,name=ChainID,proto3" json:"ChainID,omitempty"`
	GenesisHash       github_com_hyperledger_burrow_binary.HexBytes `protobuf:"bytes,4,opt,name=GenesisHash,proto3,customtype=github.com/hyperledger/burrow/binary.HexBytes" json:"GenesisHash"`
	NodeInfo          *tendermint.NodeInfo                          `protobuf:"bytes,2,opt,name=NodeInfo" json:"NodeInfo,omitempty"`
	NodeVersion       string                                        `protobuf:"bytes,3,opt,name=NodeVersion,proto3" json:"NodeVersion,omitempty"`
	PublicKey         crypto.PublicKey                              `protobuf:"bytes,5,opt,name=PublicKey" json:"PublicKey"`
	LatestBlockHash   github_com_hyperledger_burrow_binary.HexBytes `` /* 130-byte string literal not displayed */
	LatestBlockHeight uint64                                        `protobuf:"varint,7,opt,name=LatestBlockHeight,proto3" json:""`
	LatestBlockTime   time.Time                                     `protobuf:"bytes,8,opt,name=LatestBlockTime,stdtime" json:"LatestBlockTime"`
}

func Status added in v0.20.0

func Status(blockchain bcm.BlockchainInfo, nodeView *tendermint.NodeView, blockWithin string) (*ResultStatus, error)

func (*ResultStatus) Descriptor added in v0.20.0

func (*ResultStatus) Descriptor() ([]byte, []int)

func (*ResultStatus) GetChainID added in v0.20.0

func (m *ResultStatus) GetChainID() string

func (*ResultStatus) GetLatestBlockHeight added in v0.20.0

func (m *ResultStatus) GetLatestBlockHeight() uint64

func (*ResultStatus) GetLatestBlockTime added in v0.20.0

func (m *ResultStatus) GetLatestBlockTime() time.Time

func (*ResultStatus) GetNodeInfo added in v0.20.0

func (m *ResultStatus) GetNodeInfo() *tendermint.NodeInfo

func (*ResultStatus) GetNodeVersion added in v0.20.0

func (m *ResultStatus) GetNodeVersion() string

func (*ResultStatus) GetPublicKey added in v0.20.0

func (m *ResultStatus) GetPublicKey() crypto.PublicKey

func (*ResultStatus) Marshal added in v0.20.0

func (m *ResultStatus) Marshal() (dAtA []byte, err error)

func (*ResultStatus) MarshalTo added in v0.20.0

func (m *ResultStatus) MarshalTo(dAtA []byte) (int, error)

func (*ResultStatus) ProtoMessage added in v0.20.0

func (*ResultStatus) ProtoMessage()

func (*ResultStatus) Reset added in v0.20.0

func (m *ResultStatus) Reset()

func (*ResultStatus) Size added in v0.20.0

func (m *ResultStatus) Size() (n int)

func (*ResultStatus) String added in v0.20.0

func (m *ResultStatus) String() string

func (*ResultStatus) Unmarshal added in v0.20.0

func (m *ResultStatus) Unmarshal(dAtA []byte) error

func (*ResultStatus) XXX_MessageName added in v0.20.0

func (*ResultStatus) XXX_MessageName() string

type ResultSubscribe added in v0.18.0

type ResultSubscribe struct {
	EventID        string
	SubscriptionID string
}

type ResultUnsubscribe added in v0.18.0

type ResultUnsubscribe struct {
	SubscriptionID string
}

type ServerConfig added in v0.19.0

type ServerConfig struct {
	Enabled       bool
	ListenAddress string
}

func DefaultGRPCConfig added in v0.19.0

func DefaultGRPCConfig() *ServerConfig

func DefaultProfilerConfig added in v0.18.0

func DefaultProfilerConfig() *ServerConfig

func DefaultTMConfig added in v0.18.0

func DefaultTMConfig() *ServerConfig

type Service added in v0.18.0

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

Base service that provides implementation for all underlying RPC methods

func NewService added in v0.18.0

func NewService(state state.IterableReader, nameReg names.IterableReader, blockchain bcm.BlockchainInfo,
	nodeView *tendermint.NodeView, logger *logging.Logger) *Service

Service provides an internal query and information service with serialisable return types on which can accomodate a number of transport front ends

func (*Service) BlockchainInfo added in v0.19.0

func (s *Service) BlockchainInfo() bcm.BlockchainInfo

func (*Service) ChainID added in v0.20.0

func (s *Service) ChainID() string

func (*Service) ChainIdentifiers added in v0.19.0

func (s *Service) ChainIdentifiers() (*ResultChainId, error)

func (*Service) DumpConsensusState added in v0.18.0

func (s *Service) DumpConsensusState() (*ResultDumpConsensusState, error)

func (*Service) DumpStorage added in v0.18.0

func (s *Service) DumpStorage(address crypto.Address) (*ResultDumpStorage, error)

func (*Service) GeneratePrivateAccount added in v0.18.0

func (s *Service) GeneratePrivateAccount() (*ResultGeneratePrivateAccount, error)

func (*Service) Genesis added in v0.18.0

func (s *Service) Genesis() (*ResultGenesis, error)

func (*Service) GetAccount added in v0.18.0

func (s *Service) GetAccount(address crypto.Address) (*ResultGetAccount, error)

Accounts

func (*Service) GetAccountHumanReadable added in v0.18.0

func (s *Service) GetAccountHumanReadable(address crypto.Address) (*ResultGetAccountHumanReadable, error)

func (*Service) GetBlock added in v0.18.0

func (s *Service) GetBlock(height uint64) (*ResultGetBlock, error)

func (*Service) GetName added in v0.18.0

func (s *Service) GetName(name string) (*ResultGetName, error)

Name registry

func (*Service) GetStorage added in v0.18.0

func (s *Service) GetStorage(address crypto.Address, key []byte) (*ResultGetStorage, error)

func (*Service) ListAccounts added in v0.18.0

func (s *Service) ListAccounts(predicate func(acm.Account) bool) (*ResultListAccounts, error)

func (*Service) ListBlocks added in v0.18.0

func (s *Service) ListBlocks(minHeight, maxHeight uint64) (*ResultListBlocks, error)

Returns the current blockchain height and metadata for a range of blocks between minHeight and maxHeight. Only returns maxBlockLookback block metadata from the top of the range of blocks. Passing 0 for maxHeight sets the upper height of the range to the current blockchain height.

func (*Service) ListNames added in v0.18.0

func (s *Service) ListNames(predicate func(*names.Entry) bool) (*ResultListNames, error)

func (*Service) ListUnconfirmedTxs added in v0.18.0

func (s *Service) ListUnconfirmedTxs(maxTxs int) (*ResultListUnconfirmedTxs, error)

func (*Service) ListValidators added in v0.18.0

func (s *Service) ListValidators() (*ResultListValidators, error)

func (*Service) NetInfo added in v0.18.0

func (s *Service) NetInfo() (*ResultNetInfo, error)

func (*Service) Peers added in v0.18.0

func (s *Service) Peers() (*ResultPeers, error)

func (*Service) State added in v0.18.0

func (s *Service) State() state.Reader

func (*Service) Status added in v0.18.0

func (s *Service) Status(blockWithin string) (*ResultStatus, error)

type StorageItem added in v0.18.0

type StorageItem struct {
	Key   binary.HexBytes
	Value binary.HexBytes
}

Directories

Path Synopsis
lib
server
Commons for HTTP handling
Commons for HTTP handling
Package rpcevents is a generated protocol buffer package.
Package rpcevents is a generated protocol buffer package.
Package rpcquery is a generated protocol buffer package.
Package rpcquery is a generated protocol buffer package.
Package rpctransact is a generated protocol buffer package.
Package rpctransact is a generated protocol buffer package.
tm

Jump to

Keyboard shortcuts

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