chainservice

package
v0.5.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2019 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainService

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

ChainService is a blockchain service with all blockchain components.

func New

func New(
	cfg config.Config,
	p2pAgent *p2p.Agent,
	dispatcher dispatcher.Dispatcher,
	opts ...Option,
) (*ChainService, error)

New creates a ChainService from config and network.Overlay and dispatcher.Dispatcher.

func (*ChainService) ActionPool

func (cs *ChainService) ActionPool() actpool.ActPool

ActionPool returns the Action pool

func (*ChainService) BlockSync

func (cs *ChainService) BlockSync() blocksync.BlockSync

BlockSync returns the block syncer

func (*ChainService) Blockchain

func (cs *ChainService) Blockchain() blockchain.Blockchain

Blockchain returns the Blockchain

func (*ChainService) ChainID

func (cs *ChainService) ChainID() uint32

ChainID returns ChainID.

func (*ChainService) Consensus

func (cs *ChainService) Consensus() consensus.Consensus

Consensus returns the consensus instance

func (*ChainService) ElectionCommittee

func (cs *ChainService) ElectionCommittee() committee.Committee

ElectionCommittee returns the election committee

func (*ChainService) Explorer

func (cs *ChainService) Explorer() *explorer.Server

Explorer returns the explorer instance

func (*ChainService) HandleAction

func (cs *ChainService) HandleAction(_ context.Context, actPb *iotextypes.Action) error

HandleAction handles incoming action request.

func (*ChainService) HandleBlock

func (cs *ChainService) HandleBlock(ctx context.Context, pbBlock *iotextypes.Block) error

HandleBlock handles incoming block request.

func (*ChainService) HandleBlockSync

func (cs *ChainService) HandleBlockSync(ctx context.Context, pbBlock *iotextypes.Block) error

HandleBlockSync handles incoming block sync request.

func (*ChainService) HandleConsensusMsg

func (cs *ChainService) HandleConsensusMsg(msg *iotexrpc.Consensus) error

HandleConsensusMsg handles incoming consensus message.

func (*ChainService) HandleSyncRequest

func (cs *ChainService) HandleSyncRequest(ctx context.Context, peer peerstore.PeerInfo, sync *iotexrpc.BlockSync) error

HandleSyncRequest handles incoming sync request.

func (*ChainService) IndexService

func (cs *ChainService) IndexService() *indexservice.Server

IndexService returns the indexservice instance

func (*ChainService) RegisterProtocol

func (cs *ChainService) RegisterProtocol(id string, p protocol.Protocol) error

RegisterProtocol register a protocol

func (*ChainService) Registry

func (cs *ChainService) Registry() *protocol.Registry

Registry returns a pointer to the registry

func (*ChainService) Start

func (cs *ChainService) Start(ctx context.Context) error

Start starts the server

func (*ChainService) Stop

func (cs *ChainService) Stop(ctx context.Context) error

Stop stops the server

type Option

type Option func(ops *optionParams) error

Option sets ChainService construction parameter.

func WithGenesis

func WithGenesis(genesisConfig genesis.Genesis) Option

WithGenesis is an option to set genesis config

func WithRootChainAPI

func WithRootChainAPI(exp explorerapi.Explorer) Option

WithRootChainAPI is an option to add a root chain api to ChainService.

func WithTesting

func WithTesting() Option

WithTesting is an option to create a testing ChainService.

Jump to

Keyboard shortcuts

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