Documentation
¶
Index ¶
- type Dispatcher
- type IotxDispatcher
- func (d *IotxDispatcher) AddSubscriber(chainID uint32, subscriber Subscriber)
- func (d *IotxDispatcher) EventAudit() map[iotexrpc.MessageType]int
- func (d *IotxDispatcher) EventQueueSize() map[string]int
- func (d *IotxDispatcher) HandleBroadcast(ctx context.Context, chainID uint32, peer string, message proto.Message)
- func (d *IotxDispatcher) HandleTell(ctx context.Context, chainID uint32, peer peerstore.PeerInfo, ...)
- func (d *IotxDispatcher) Start(ctx context.Context) error
- func (d *IotxDispatcher) Stop(ctx context.Context) error
- type Subscriber
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶ added in v0.4.0
type Dispatcher interface {
lifecycle.StartStopper
// AddSubscriber adds to dispatcher
AddSubscriber(uint32, Subscriber)
// HandleBroadcast handles the incoming broadcast message. The transportation layer semantics is at least once.
// That said, the handler is likely to receive duplicate messages.
HandleBroadcast(context.Context, uint32, string, proto.Message)
// HandleTell handles the incoming tell message. The transportation layer semantics is exact once. The sender is
// given for the sake of replying the message
HandleTell(context.Context, uint32, peerstore.PeerInfo, proto.Message)
}
Dispatcher is used by peers, handles incoming block and header notifications and relays announcements of new blocks.
func NewDispatcher ¶
func NewDispatcher(cfg config.Config) (Dispatcher, error)
NewDispatcher creates a new Dispatcher
type IotxDispatcher ¶ added in v0.4.0
type IotxDispatcher struct {
// contains filtered or unexported fields
}
IotxDispatcher is the request and event dispatcher for iotx node.
func (*IotxDispatcher) AddSubscriber ¶ added in v0.4.0
func (d *IotxDispatcher) AddSubscriber( chainID uint32, subscriber Subscriber, )
AddSubscriber adds a subscriber to dispatcher
func (*IotxDispatcher) EventAudit ¶ added in v0.4.0
func (d *IotxDispatcher) EventAudit() map[iotexrpc.MessageType]int
EventAudit returns the event audit map
func (*IotxDispatcher) EventQueueSize ¶ added in v1.1.1
func (d *IotxDispatcher) EventQueueSize() map[string]int
EventQueueSize returns the event queue size
func (*IotxDispatcher) HandleBroadcast ¶ added in v0.4.0
func (d *IotxDispatcher) HandleBroadcast(ctx context.Context, chainID uint32, peer string, message proto.Message)
HandleBroadcast handles incoming broadcast message
func (*IotxDispatcher) HandleTell ¶ added in v0.4.0
func (d *IotxDispatcher) HandleTell(ctx context.Context, chainID uint32, peer peerstore.PeerInfo, message proto.Message)
HandleTell handles incoming unicast message
type Subscriber ¶ added in v0.4.0
type Subscriber interface {
ReportFullness(context.Context, iotexrpc.MessageType, float32)
HandleAction(context.Context, *iotextypes.Action) error
HandleBlock(context.Context, string, *iotextypes.Block) error
HandleSyncRequest(context.Context, peerstore.PeerInfo, *iotexrpc.BlockSync) error
HandleConsensusMsg(*iotextypes.ConsensusMessage) error
}
Subscriber is the dispatcher subscriber interface
Click to show internal directories.
Click to hide internal directories.