rpc

package
v0.0.0-...-2c813a9 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2021 License: MIT Imports: 44 Imported by: 0

Documentation

Overview

*

  • @file
  • @copyright defined in meycoin/LICENSE.txt

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUninitAccessor = errors.New("accessor is not initilized")
)

Functions

This section is empty.

Types

type AdminService

type AdminService struct {
	*component.ComponentHub
	*log.Logger
	// contains filtered or unexported fields
}

func NewAdminService

func NewAdminService(conf *config.RPCConfig, hub *component.ComponentHub) *AdminService

func (*AdminService) MempoolTx

func (as *AdminService) MempoolTx(ctx context.Context, in *types.AccountList) (*types.SingleBytes, error)

MempoolTx returns the TX-relasted statistics of the current mempool.

func (*AdminService) MempoolTxStat

func (as *AdminService) MempoolTxStat(ctx context.Context, in *types.Empty) (*types.SingleBytes, error)

MempoolTxStat returns the TX-relasted statistics of the current mempool.

func (*AdminService) Start

func (as *AdminService) Start()

type Authentication

type Authentication = int
const (
	ReadBlockChain  Authentication = 1
	WriteBlockChain Authentication = 2
	ShowNode        Authentication = 4
	ControlNode     Authentication = 8
)

type EventStream

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

type MeyCoinRPCService

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

MeyCoinRPCService implements GRPC server which is defined in rpc.proto

func (*MeyCoinRPCService) Blockchain

func (rpc *MeyCoinRPCService) Blockchain(ctx context.Context, in *types.Empty) (*types.BlockchainStatus, error)

Blockchain handle rpc request blockchain. It has no additional input parameter

func (*MeyCoinRPCService) BroadcastToEventStream

func (rpc *MeyCoinRPCService) BroadcastToEventStream(events []*types.Event) error

func (*MeyCoinRPCService) BroadcastToListBlockMetadataStream

func (rpc *MeyCoinRPCService) BroadcastToListBlockMetadataStream(meta *types.BlockMetadata)

func (*MeyCoinRPCService) BroadcastToListBlockStream

func (rpc *MeyCoinRPCService) BroadcastToListBlockStream(block *types.Block)

func (*MeyCoinRPCService) ChainStat

func (rpc *MeyCoinRPCService) ChainStat(ctx context.Context, in *types.Empty) (*types.ChainStats, error)

ChainStat handles rpc request chainstat.

func (*MeyCoinRPCService) CommitTX

CommitTX handle rpc request commit

func (*MeyCoinRPCService) CreateAccount

func (rpc *MeyCoinRPCService) CreateAccount(ctx context.Context, in *types.Personal) (*types.Account, error)

CreateAccount handle rpc request newaccount

func (*MeyCoinRPCService) ExportAccount

func (rpc *MeyCoinRPCService) ExportAccount(ctx context.Context, in *types.Personal) (*types.SingleBytes, error)

func (*MeyCoinRPCService) ExportAccountKeystore

func (rpc *MeyCoinRPCService) ExportAccountKeystore(ctx context.Context, in *types.Personal) (*types.SingleBytes, error)

func (*MeyCoinRPCService) GetABI

func (rpc *MeyCoinRPCService) GetABI(ctx context.Context, in *types.SingleBytes) (*types.ABI, error)

func (*MeyCoinRPCService) GetAccountVotes

func (rpc *MeyCoinRPCService) GetAccountVotes(ctx context.Context, in *types.AccountAddress) (*types.AccountVoteInfo, error)

func (*MeyCoinRPCService) GetAccounts

func (rpc *MeyCoinRPCService) GetAccounts(ctx context.Context, in *types.Empty) (*types.AccountList, error)

GetAccounts handle rpc request getaccounts

func (*MeyCoinRPCService) GetBlock

func (rpc *MeyCoinRPCService) GetBlock(ctx context.Context, in *types.SingleBytes) (*types.Block, error)

GetBlock handle rpc request getblock

func (*MeyCoinRPCService) GetBlockBody

GetBlockBody handle rpc request getblockbody

func (*MeyCoinRPCService) GetBlockMetadata

func (rpc *MeyCoinRPCService) GetBlockMetadata(ctx context.Context, in *types.SingleBytes) (*types.BlockMetadata, error)

GetBlockMetadata handle rpc request getblock

func (*MeyCoinRPCService) GetBlockTX

func (rpc *MeyCoinRPCService) GetBlockTX(ctx context.Context, in *types.SingleBytes) (*types.TxInBlock, error)

GetBlockTX handle rpc request gettx

func (*MeyCoinRPCService) GetChainInfo

func (rpc *MeyCoinRPCService) GetChainInfo(ctx context.Context, in *types.Empty) (*types.ChainInfo, error)

GetChainInfo handles a getchaininfo RPC request.

func (*MeyCoinRPCService) GetConfChangeProgress

func (rpc *MeyCoinRPCService) GetConfChangeProgress(ctx context.Context, in *types.SingleBytes) (*types.ConfChangeProgress, error)

func (*MeyCoinRPCService) GetConsensusInfo

func (rpc *MeyCoinRPCService) GetConsensusInfo(ctx context.Context, in *types.Empty) (*types.ConsensusInfo, error)

GetConsensusInfo handle rpc request blockchain. It has no additional input parameter

func (*MeyCoinRPCService) GetEnterpriseConfig

func (rpc *MeyCoinRPCService) GetEnterpriseConfig(ctx context.Context, in *types.EnterpriseConfigKey) (*types.EnterpriseConfig, error)

GetEnterpriseConfig return meycoin.enterprise configure values. key "ADMINS" is for getting register admin addresses and "ALL" is for getting all key list.

func (*MeyCoinRPCService) GetNameInfo

func (rpc *MeyCoinRPCService) GetNameInfo(ctx context.Context, in *types.Name) (*types.NameInfo, error)

func (*MeyCoinRPCService) GetPeers

func (rpc *MeyCoinRPCService) GetPeers(ctx context.Context, in *types.PeersParams) (*types.PeerList, error)

GetPeers handle rpc request getpeers

func (*MeyCoinRPCService) GetReceipt

func (rpc *MeyCoinRPCService) GetReceipt(ctx context.Context, in *types.SingleBytes) (*types.Receipt, error)

func (*MeyCoinRPCService) GetServerInfo

func (rpc *MeyCoinRPCService) GetServerInfo(ctx context.Context, in *types.KeyParams) (*types.ServerInfo, error)

func (*MeyCoinRPCService) GetStaking

func (rpc *MeyCoinRPCService) GetStaking(ctx context.Context, in *types.AccountAddress) (*types.Staking, error)

GetStaking handle rpc request getstaking

func (*MeyCoinRPCService) GetState

func (rpc *MeyCoinRPCService) GetState(ctx context.Context, in *types.SingleBytes) (*types.State, error)

GetState handle rpc request getstate

func (*MeyCoinRPCService) GetStateAndProof

func (rpc *MeyCoinRPCService) GetStateAndProof(ctx context.Context, in *types.AccountAndRoot) (*types.AccountProof, error)

GetStateAndProof handle rpc request getstateproof

func (*MeyCoinRPCService) GetTX

func (rpc *MeyCoinRPCService) GetTX(ctx context.Context, in *types.SingleBytes) (*types.Tx, error)

GetTX handle rpc request gettx

func (*MeyCoinRPCService) GetVotes

func (rpc *MeyCoinRPCService) GetVotes(ctx context.Context, in *types.VoteParams) (*types.VoteList, error)

GetVotes handle rpc request getvotes

func (*MeyCoinRPCService) ImportAccount

func (rpc *MeyCoinRPCService) ImportAccount(ctx context.Context, in *types.ImportFormat) (*types.Account, error)

func (*MeyCoinRPCService) ListBlockHeaders

func (rpc *MeyCoinRPCService) ListBlockHeaders(ctx context.Context, in *types.ListParams) (*types.BlockHeaderList, error)

ListBlockHeaders (Deprecated) handle rpc request listblocks

func (*MeyCoinRPCService) ListBlockMetadata

func (rpc *MeyCoinRPCService) ListBlockMetadata(ctx context.Context, in *types.ListParams) (*types.BlockMetadataList, error)

ListBlockMetadata handle rpc request

func (*MeyCoinRPCService) ListBlockMetadataStream

func (rpc *MeyCoinRPCService) ListBlockMetadataStream(in *types.Empty, stream types.MeyCoinRPCService_ListBlockMetadataStreamServer) error

ListBlockMetadataStream starts a stream of new blocks' metadata

func (*MeyCoinRPCService) ListBlockStream

ListBlockStream starts a stream of new blocks

func (*MeyCoinRPCService) ListEventStream

func (*MeyCoinRPCService) ListEvents

func (rpc *MeyCoinRPCService) ListEvents(ctx context.Context, in *types.FilterInfo) (*types.EventList, error)

func (*MeyCoinRPCService) LockAccount

func (rpc *MeyCoinRPCService) LockAccount(ctx context.Context, in *types.Personal) (*types.Account, error)

LockAccount handle rpc request lockaccount

func (*MeyCoinRPCService) Metric

func (*MeyCoinRPCService) NodeState

func (rpc *MeyCoinRPCService) NodeState(ctx context.Context, in *types.NodeReq) (*types.SingleBytes, error)

NodeState handle rpc request nodestate

func (*MeyCoinRPCService) QueryContract

func (rpc *MeyCoinRPCService) QueryContract(ctx context.Context, in *types.Query) (*types.SingleBytes, error)

func (*MeyCoinRPCService) QueryContractState

func (rpc *MeyCoinRPCService) QueryContractState(ctx context.Context, in *types.StateQuery) (*types.StateQueryProof, error)

QueryContractState queries the state of a contract state variable without executing a contract function.

func (*MeyCoinRPCService) SendTX

func (rpc *MeyCoinRPCService) SendTX(ctx context.Context, tx *types.Tx) (*types.CommitResult, error)

SendTX try to fill the nonce, sign, hash, chainIdHash in the transaction automatically and commit it

func (*MeyCoinRPCService) SetConsensusAccessor

func (rpc *MeyCoinRPCService) SetConsensusAccessor(ca consensus.ConsensusAccessor)

func (*MeyCoinRPCService) SignTX

func (rpc *MeyCoinRPCService) SignTX(ctx context.Context, in *types.Tx) (*types.Tx, error)

SignTX handle rpc request signtx

func (*MeyCoinRPCService) UnlockAccount

func (rpc *MeyCoinRPCService) UnlockAccount(ctx context.Context, in *types.Personal) (*types.Account, error)

UnlockAccount handle rpc request unlockaccount

func (*MeyCoinRPCService) VerifyTX

func (rpc *MeyCoinRPCService) VerifyTX(ctx context.Context, in *types.Tx) (*types.VerifyResult, error)

VerifyTX handle rpc request verifytx

type RPC

type RPC struct {
	*component.BaseComponent
	// contains filtered or unexported fields
}

RPC is actor for providing rpc service

func NewRPC

func NewRPC(cfg *config.Config, chainAccessor types.ChainAccessor, version string) *RPC

NewRPC create an rpc service

func (*RPC) AfterStart

func (ns *RPC) AfterStart()

func (*RPC) BeforeStart

func (ns *RPC) BeforeStart()

Start start rpc service.

func (*RPC) BeforeStop

func (ns *RPC) BeforeStop()

Stop stops rpc service.

func (*RPC) CallRequest

func (ns *RPC) CallRequest(actor string, msg interface{}, timeout time.Duration) (interface{}, error)

CallRequest implement interface method of ActorService

func (*RPC) CallRequestDefaultTimeout

func (ns *RPC) CallRequestDefaultTimeout(actor string, msg interface{}) (interface{}, error)

CallRequest implement interface method of ActorService

func (*RPC) CollectServerInfo

func (ns *RPC) CollectServerInfo(categories []string) *types.ServerInfo

func (*RPC) FutureRequest

func (ns *RPC) FutureRequest(actor string, msg interface{}, timeout time.Duration) *actor.Future

FutureRequest implement interface method of ActorService

func (*RPC) FutureRequestDefaultTimeout

func (ns *RPC) FutureRequestDefaultTimeout(actor string, msg interface{}) *actor.Future

FutureRequestDefaultTimeout implement interface method of ActorService

func (*RPC) GetChainAccessor

func (ns *RPC) GetChainAccessor() types.ChainAccessor

GetChainAccessor implment interface method of ActorService

func (*RPC) Receive

func (ns *RPC) Receive(context actor.Context)

func (*RPC) SendRequest

func (ns *RPC) SendRequest(actor string, msg interface{})

SendRequest implement interface method of ActorService

func (*RPC) SetConsensusAccessor

func (ns *RPC) SetConsensusAccessor(ca consensus.ConsensusAccessor)

func (*RPC) SetHub

func (ns *RPC) SetHub(hub *component.ComponentHub)

func (*RPC) Statistics

func (ns *RPC) Statistics() *map[string]interface{}

func (*RPC) TellRequest

func (ns *RPC) TellRequest(actor string, msg interface{})

TellRequest implement interface method of ActorService

Jump to

Keyboard shortcuts

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