Documentation ¶
Index ¶
- type Builder
- func (builder *Builder) Build() (*ChainService, error)
- func (builder *Builder) BuildForSubChain() (*ChainService, error)
- func (builder *Builder) BuildForTest() (*ChainService, error)
- func (builder *Builder) SetActionPool(ap actpool.ActPool) *Builder
- func (builder *Builder) SetBlockDAO(bd blockdao.BlockDAO) *Builder
- func (builder *Builder) SetBlockSync(bs blocksync.BlockSync) *Builder
- func (builder *Builder) SetBlockchain(bc blockchain.Blockchain) *Builder
- func (builder *Builder) SetElectionCommittee(c committee.Committee) *Builder
- func (builder *Builder) SetFactory(f factory.Factory) *Builder
- func (builder *Builder) SetP2PAgent(agent p2p.Agent) *Builder
- type ChainService
- func (cs *ChainService) ActionPool() actpool.ActPool
- func (cs *ChainService) BlockDAO() blockdao.BlockDAO
- 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) HandleAction(ctx context.Context, actPb *iotextypes.Action) error
- func (cs *ChainService) HandleBlock(ctx context.Context, peer string, pbBlock *iotextypes.Block) error
- func (cs *ChainService) HandleConsensusMsg(msg *iotextypes.ConsensusMessage) error
- func (cs *ChainService) HandleSyncRequest(ctx context.Context, peer peer.AddrInfo, sync *iotexrpc.BlockSync) error
- func (cs *ChainService) NewAPIServer(cfg config.API, plugins map[int]interface{}) (*api.ServerV2, error)
- func (cs *ChainService) Registry() *protocol.Registry
- func (cs *ChainService) ReportFullness(_ context.Context, messageType iotexrpc.MessageType, fullness float32)
- func (cs *ChainService) Start(ctx context.Context) error
- func (cs *ChainService) StateFactory() factory.Factory
- func (cs *ChainService) Stop(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶ added in v1.8.0
type Builder struct {
// contains filtered or unexported fields
}
Builder is a builder to build chainservice
func NewBuilder ¶ added in v1.8.0
NewBuilder creates a new chainservice builder
func (*Builder) Build ¶ added in v1.8.0
func (builder *Builder) Build() (*ChainService, error)
Build builds a chainservice
func (*Builder) BuildForSubChain ¶ added in v1.8.0
func (builder *Builder) BuildForSubChain() (*ChainService, error)
BuildForSubChain builds a chainservice for subchain
func (*Builder) BuildForTest ¶ added in v1.8.0
func (builder *Builder) BuildForTest() (*ChainService, error)
BuildForTest builds a chainservice for test purpose
func (*Builder) SetActionPool ¶ added in v1.8.0
SetActionPool sets the action pool instance
func (*Builder) SetBlockDAO ¶ added in v1.8.0
SetBlockDAO sets the blockdao instance
func (*Builder) SetBlockSync ¶ added in v1.8.0
SetBlockSync sets the block sync instance
func (*Builder) SetBlockchain ¶ added in v1.8.0
func (builder *Builder) SetBlockchain(bc blockchain.Blockchain) *Builder
SetBlockchain sets the blockchain instance
func (*Builder) SetElectionCommittee ¶ added in v1.8.0
SetElectionCommittee sets the election committee instance
func (*Builder) SetFactory ¶ added in v1.8.0
SetFactory sets the factory instance
type ChainService ¶
type ChainService struct {
// contains filtered or unexported fields
}
ChainService is a blockchain service with all blockchain components.
func (*ChainService) ActionPool ¶
func (cs *ChainService) ActionPool() actpool.ActPool
ActionPool returns the Action pool
func (*ChainService) BlockDAO ¶ added in v0.11.0
func (cs *ChainService) BlockDAO() blockdao.BlockDAO
BlockDAO returns the blockdao
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) HandleAction ¶
func (cs *ChainService) HandleAction(ctx context.Context, actPb *iotextypes.Action) error
HandleAction handles incoming action request.
func (*ChainService) HandleBlock ¶
func (cs *ChainService) HandleBlock(ctx context.Context, peer string, pbBlock *iotextypes.Block) error
HandleBlock handles incoming block request.
func (*ChainService) HandleConsensusMsg ¶ added in v0.4.4
func (cs *ChainService) HandleConsensusMsg(msg *iotextypes.ConsensusMessage) error
HandleConsensusMsg handles incoming consensus message.
func (*ChainService) HandleSyncRequest ¶
func (cs *ChainService) HandleSyncRequest(ctx context.Context, peer peer.AddrInfo, sync *iotexrpc.BlockSync) error
HandleSyncRequest handles incoming sync request.
func (*ChainService) NewAPIServer ¶ added in v1.8.1
func (cs *ChainService) NewAPIServer(cfg config.API, plugins map[int]interface{}) (*api.ServerV2, error)
NewAPIServer creates a new api server
func (*ChainService) Registry ¶ added in v0.5.0
func (cs *ChainService) Registry() *protocol.Registry
Registry returns a pointer to the registry
func (*ChainService) ReportFullness ¶ added in v1.2.0
func (cs *ChainService) ReportFullness(_ context.Context, messageType iotexrpc.MessageType, fullness float32)
ReportFullness switch on or off block sync
func (*ChainService) Start ¶
func (cs *ChainService) Start(ctx context.Context) error
Start starts the server
func (*ChainService) StateFactory ¶ added in v0.11.0
func (cs *ChainService) StateFactory() factory.Factory
StateFactory returns the state factory