service

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2019 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiBackend

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

func NewApiBackend

func NewApiBackend(s *Service) *ApiBackend

func (*ApiBackend) AccountManager

func (b *ApiBackend) AccountManager() *accounts.Manager

func (*ApiBackend) BalanceRecordByNumber

func (b *ApiBackend) BalanceRecordByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.BlockBalanceRecords, error)

func (*ApiBackend) Block

func (b *ApiBackend) Block(heightPtr *uint64) (*rtypes.ResultBlock, error)

func (*ApiBackend) BlockByNumber

func (b *ApiBackend) BlockByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Block, error)

func (*ApiBackend) BloomStatus

func (b *ApiBackend) BloomStatus() (uint64, uint64)

bloom filter

func (*ApiBackend) Coinbase

func (b *ApiBackend) Coinbase() common.Address

func (*ApiBackend) ConsensusState

func (b *ApiBackend) ConsensusState() (*rtypes.ResultConsensusState, error)

func (*ApiBackend) DumpConsensusState

func (b *ApiBackend) DumpConsensusState() (*rtypes.ResultDumpConsensusState, error)

func (*ApiBackend) EVMAllowed

func (b *ApiBackend) EVMAllowed() bool

implement backend methods.

func (*ApiBackend) EventBus

func (b *ApiBackend) EventBus() *types.EventBus

func (*ApiBackend) GetBlock

func (b *ApiBackend) GetBlock(ctx context.Context, blockHash common.Hash) (*types.Block, error)

func (*ApiBackend) GetBlockBalanceRecords

func (b *ApiBackend) GetBlockBalanceRecords(height uint64) *types.BlockBalanceRecords

func (*ApiBackend) GetBlockTokenOutputSeq

func (b *ApiBackend) GetBlockTokenOutputSeq(ctx context.Context, blockHeight uint64) map[string]int64

func (*ApiBackend) GetMaxOutputIndex

func (b *ApiBackend) GetMaxOutputIndex(ctx context.Context, token common.Address) int64

GetMaxOutputIndex get max UTXO output index by token

func (*ApiBackend) GetOutput

func (b *ApiBackend) GetOutput(ctx context.Context, token common.Address, index uint64) (*types.UTXOOutputData, error)

GetOutput get UTXO output

func (*ApiBackend) GetPoolNonce

func (b *ApiBackend) GetPoolNonce(ctx context.Context, addr common.Address) (uint64, error)

func (*ApiBackend) GetPoolTransaction

func (b *ApiBackend) GetPoolTransaction(txHash common.Hash) *types.Transaction

func (*ApiBackend) GetPoolTx

func (b *ApiBackend) GetPoolTx(txHash common.Hash) types.Tx

func (*ApiBackend) GetReceipts

func (b *ApiBackend) GetReceipts(ctx context.Context, blockNr uint64) types.Receipts

func (*ApiBackend) GetSeeds added in v0.1.1

func (b *ApiBackend) GetSeeds() []rtypes.Node

func (*ApiBackend) GetTransactionReceipt

func (b *ApiBackend) GetTransactionReceipt(hash common.Hash) (*types.Receipt, common.Hash, uint64, uint64)

func (*ApiBackend) GetTx

func (b *ApiBackend) GetTx(hash common.Hash) (types.Tx, *types.TxEntry)

BlockChain API

func (*ApiBackend) GetTxsResult

func (b *ApiBackend) GetTxsResult(ctx context.Context, blockNr uint64) (*types.TxsResult, error)

func (*ApiBackend) GetUTXOGas

func (b *ApiBackend) GetUTXOGas() uint64

func (*ApiBackend) GetVM

func (b *ApiBackend) GetVM(ctx context.Context, msg types.Message, state *state.StateDB, header *types.Header,
	vmCfg evm.Config) (vm.VmInterface, func() error, error)

func (*ApiBackend) HeaderByHeight

func (b *ApiBackend) HeaderByHeight(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error)

func (*ApiBackend) HeaderByNumber

func (b *ApiBackend) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error)

func (*ApiBackend) Height

func (b *ApiBackend) Height() uint64

func (*ApiBackend) NetInfo

func (b *ApiBackend) NetInfo() (*rtypes.ResultNetInfo, error)

func (*ApiBackend) PrometheusMetrics

func (b *ApiBackend) PrometheusMetrics() string

func (*ApiBackend) ProtocolVersion

func (b *ApiBackend) ProtocolVersion() string

General Ethereum API

func (*ApiBackend) SendTx

func (b *ApiBackend) SendTx(ctx context.Context, signedTx types.Tx) error

TxPool API

func (*ApiBackend) ServiceFilter

func (b *ApiBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession)

func (*ApiBackend) StartTheWorld

func (b *ApiBackend) StartTheWorld() bool

func (*ApiBackend) StateAndHeaderByNumber

func (b *ApiBackend) StateAndHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*state.StateDB, *types.Header, error)

func (*ApiBackend) Stats

func (b *ApiBackend) Stats() (int, int, int)

func (*ApiBackend) Status

func (b *ApiBackend) Status() (*rtypes.ResultStatus, error)

func (*ApiBackend) StopTheWorld

func (b *ApiBackend) StopTheWorld() bool

Consensus API

func (*ApiBackend) SuggestPrice

func (b *ApiBackend) SuggestPrice(ctx context.Context) (*big.Int, error)

func (*ApiBackend) Validators

func (b *ApiBackend) Validators(heightPtr *uint64) (*rtypes.ResultValidators, error)

type App

type App interface {
	GetNonce(addr common.Address) uint64
	GetBalance(addr common.Address) *big.Int
	GetPendingStateDB() *state.StateDB
	GetLatestStateDB() *state.StateDB
	GetPendingBlock() *types.Block
	GetUTXOGas() uint64
}

type BalanceRecordStore

type BalanceRecordStore interface {
	Save(blockHeight uint64, bbr *types.BlockBalanceRecords)
	Get(blockHeight uint64) *types.BlockBalanceRecords
}

type BlockStore

type BlockStore interface {
	Height() uint64
	LoadBlockMeta(height uint64) *types.BlockMeta
	LoadTxsResult(height uint64) (*types.TxsResult, error)
	LoadBlock(height uint64) *types.Block
	GetDB() dbm.DB
	//GetTx(hash common.Hash) (types.Tx, common.Hash, uint64, uint64)
	GetTx(hash common.Hash) (types.Tx, *types.TxEntry)
	GetTransactionReceipt(hash common.Hash) (*types.Receipt, common.Hash, uint64, uint64)
	GetHeader(height uint64) *types.Header
	LoadBlockByHash(hash common.Hash) *types.Block
	LoadBlockMetaByHash(hash common.Hash) *types.BlockMeta
	GetReceipts(height uint64) *types.Receipts
}

type BloomService

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

func NewBloomService

func NewBloomService(basic *Service) *BloomService

func (*BloomService) Start

func (bs *BloomService) Start() error

func (*BloomService) Stop

func (bs *BloomService) Stop() error

type Consensus

type Consensus interface {
	GetState() cs.NewStatus
	GetValidators() (uint64, []*types.Validator)
	GetRoundStateJSON() ([]byte, error)
	GetRoundStateSimpleJSON() ([]byte, error)
}

type Context

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

func NewContext

func NewContext() *Context

func (*Context) GetCoinBase

func (c *Context) GetCoinBase() common.Address

func (*Context) GetConsensusReactor

func (c *Context) GetConsensusReactor() *cs.ConsensusReactor

func (*Context) GetMempool

func (c *Context) GetMempool() Mempool

func (*Context) SetAccountManager

func (c *Context) SetAccountManager(am *accounts.Manager)

func (*Context) SetApp

func (c *Context) SetApp(app App)

func (*Context) SetBalanceRecordStore

func (c *Context) SetBalanceRecordStore(brs BalanceRecordStore)

func (*Context) SetBlockstore

func (c *Context) SetBlockstore(bs BlockStore)

func (*Context) SetConsensus

func (c *Context) SetConsensus(cs Consensus)

func (*Context) SetConsensusReactor

func (c *Context) SetConsensusReactor(conR *cs.ConsensusReactor)

func (*Context) SetEventBus

func (c *Context) SetEventBus(eb *types.EventBus)

func (*Context) SetLogger

func (c *Context) SetLogger(logger log.Logger)

func (*Context) SetMempool

func (c *Context) SetMempool(mem Mempool)

func (*Context) SetPubKey

func (c *Context) SetPubKey(pk crypto.PubKey)

func (*Context) SetStateDB

func (c *Context) SetStateDB(db dbm.DB)

func (*Context) SetSwitch

func (c *Context) SetSwitch(sw *p2p.Switch)

func (*Context) SetTrieDB

func (c *Context) SetTrieDB(db dbm.DB, isTrie bool)

func (*Context) SetTxService

func (c *Context) SetTxService(txSrv *txmgr.Service)

func (*Context) SetUTXO

func (c *Context) SetUTXO(utxo UtxoStore)

type Mempool

type Mempool interface {
	AddTx(peerID string, tx types.Tx) error
	//PendingTxs(nums int) (types.Txs, error)
	Stats() (int, int, int)
}

type MockMempool

type MockMempool struct {
	mock.Mock
}

MockMempool is an autogenerated mock type for the Mempool type

func (*MockMempool) AddTx

func (_m *MockMempool) AddTx(tx types.Tx) error

AddTx provides a mock function with given fields: tx

func (*MockMempool) Stats

func (_m *MockMempool) Stats() (int, int, int)

Stats provides a mock function with given fields:

type PubsubApi

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

func (*PubsubApi) BalanceRecordsSubscribe

func (ps *PubsubApi) BalanceRecordsSubscribe(ctx context.Context) (*rpc.Subscription, error)

func (*PubsubApi) BlockSubscribe

func (ps *PubsubApi) BlockSubscribe(ctx context.Context) (*rpc.Subscription, error)

BlockSubscribe subscribe new block notifi.

func (*PubsubApi) BroadcastTxSync

func (ps *PubsubApi) BroadcastTxSync(txBytes []byte, txType string) (bool, error)

BroadcastTxSync to broadcast a tx with txType

func (*PubsubApi) GetBalance

func (ps *PubsubApi) GetBalance(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (*big.Int, error)

GetBalance the same as rpc api

func (*PubsubApi) GetBlock

func (ps *PubsubApi) GetBlock(blockNr rpc.BlockNumber) (*rtypes.WholeBlock, error)

GetBlock query block

func (*PubsubApi) GetLogs

func (ps *PubsubApi) GetLogs(ctx context.Context, crit filters.FilterCriteria) ([]*types.Log, error)

GetLogs by filter

func (*PubsubApi) GetTransaction

func (ps *PubsubApi) GetTransaction(hash common.Hash) *rtypes.RPCTx

GetTransaction by hash and type.

func (*PubsubApi) GetTransactionCount

func (ps *PubsubApi) GetTransactionCount(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (uint64, error)

GetTransactionCount the same as rpc api

func (*PubsubApi) LogsSubscribe

func (ps *PubsubApi) LogsSubscribe(ctx context.Context, crit filters.FilterCriteria) (*rpc.Subscription, error)

LogsSubscribe subscribe new log notifi.

func (*PubsubApi) ReceiptsSubscribe

func (ps *PubsubApi) ReceiptsSubscribe(ctx context.Context) (*rpc.Subscription, error)

func (*PubsubApi) Validators

func (ps *PubsubApi) Validators(ctx context.Context, number rpc.BlockNumber) (*rtypes.ResultValidators, error)

type Service

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

func New

func New(conf *config.RPCConfig, ctx *Context) *Service

New new rpc service

func (*Service) Start

func (s *Service) Start() error

Start rpc service

func (*Service) Stop

func (s *Service) Stop()

Stop rpc service

type UtxoStore

type UtxoStore interface {
	GetUtxoOutput(token common.Address, index uint64) (*types.UTXOOutputData, error)
	GetMaxUtxoOutputSeq(token common.Address) int64
	GetBlockTokenUtxoOutputSeq(blockHeight uint64) map[string]int64
}

UtxoStore utxo storage

Jump to

Keyboard shortcuts

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