Documentation ¶
Index ¶
- type ChainService
- func (cs *ChainService) ActionPool() actpool.ActPool
- func (cs *ChainService) AddProtocols(protocols ...Protocol)
- func (cs *ChainService) BlockSync() blocksync.BlockSync
- func (cs *ChainService) Blockchain() blockchain.Blockchain
- func (cs *ChainService) ChainID() uint32
- func (cs *ChainService) Consensus() consensus.Consensus
- func (cs *ChainService) Explorer() *explorer.Server
- func (cs *ChainService) HandleAction(actPb *pb.ActionPb) error
- func (cs *ChainService) HandleBlock(pbBlock *pb.BlockPb) error
- func (cs *ChainService) HandleBlockPropose(propose *pb.ProposePb) error
- func (cs *ChainService) HandleBlockSync(pbBlock *pb.BlockPb) error
- func (cs *ChainService) HandleEndorse(endorse *pb.EndorsePb) error
- func (cs *ChainService) HandleSyncRequest(sender string, sync *pb.BlockSync) error
- func (cs *ChainService) IndexService() *indexservice.Server
- func (cs *ChainService) Protocols() []Protocol
- func (cs *ChainService) Start(ctx context.Context) error
- func (cs *ChainService) Stop(ctx context.Context) error
- type Option
- type Protocol
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, p2p network.Overlay, 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) AddProtocols ¶
func (cs *ChainService) AddProtocols(protocols ...Protocol)
AddProtocols add the protocols
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) Consensus ¶
func (cs *ChainService) Consensus() consensus.Consensus
Consensus returns the consensus instance
func (*ChainService) Explorer ¶
func (cs *ChainService) Explorer() *explorer.Server
Explorer returns the explorer instance
func (*ChainService) HandleAction ¶
func (cs *ChainService) HandleAction(actPb *pb.ActionPb) error
HandleAction handles incoming action request.
func (*ChainService) HandleBlock ¶
func (cs *ChainService) HandleBlock(pbBlock *pb.BlockPb) error
HandleBlock handles incoming block request.
func (*ChainService) HandleBlockPropose ¶
func (cs *ChainService) HandleBlockPropose(propose *pb.ProposePb) error
HandleBlockPropose handles incoming block propose request.
func (*ChainService) HandleBlockSync ¶
func (cs *ChainService) HandleBlockSync(pbBlock *pb.BlockPb) error
HandleBlockSync handles incoming block sync request.
func (*ChainService) HandleEndorse ¶
func (cs *ChainService) HandleEndorse(endorse *pb.EndorsePb) error
HandleEndorse handles incoming endorse request.
func (*ChainService) HandleSyncRequest ¶
func (cs *ChainService) HandleSyncRequest(sender string, sync *pb.BlockSync) error
HandleSyncRequest handles incoming sync request.
func (*ChainService) IndexService ¶
func (cs *ChainService) IndexService() *indexservice.Server
IndexService returns the indexservice instance
func (*ChainService) Protocols ¶
func (cs *ChainService) Protocols() []Protocol
Protocols returns the protocols
type Option ¶
type Option func(ops *optionParams) error
Option sets ChainService construction parameter.
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.
type Protocol ¶
type Protocol interface { actpool.ActionValidator state.ActionHandler }
Protocol defines the protocol interfaces atop IoTeX blockchain