Documentation
¶
Index ¶
- type Dispatcher
- type IotxDispatcher
- func (d *IotxDispatcher) AddSubscriber(chainID uint32, subscriber Subscriber)
- func (d *IotxDispatcher) EventAudit() map[uint32]int
- func (d *IotxDispatcher) EventChan() *chan interface{}
- func (d *IotxDispatcher) HandleBroadcast(chainID uint32, message proto.Message, done chan bool)
- func (d *IotxDispatcher) HandleTell(chainID uint32, sender net.Addr, message proto.Message, done chan bool)
- 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(uint32, proto.Message, chan bool)
// 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(uint32, net.Addr, proto.Message, chan bool)
}
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[uint32]int
EventAudit returns the event audit map
func (*IotxDispatcher) EventChan ¶ added in v0.4.0
func (d *IotxDispatcher) EventChan() *chan interface{}
EventChan returns the event chan
func (*IotxDispatcher) HandleBroadcast ¶ added in v0.4.0
func (d *IotxDispatcher) HandleBroadcast(chainID uint32, message proto.Message, done chan bool)
HandleBroadcast handles incoming broadcast message
func (*IotxDispatcher) HandleTell ¶ added in v0.4.0
func (d *IotxDispatcher) HandleTell(chainID uint32, sender net.Addr, message proto.Message, done chan bool)
HandleTell handles incoming unicast message
type Subscriber ¶ added in v0.4.0
type Subscriber interface {
HandleAction(*pb.ActionPb) error
HandleBlock(*pb.BlockPb) error
HandleBlockSync(*pb.BlockPb) error
HandleSyncRequest(string, *pb.BlockSync) error
HandleBlockPropose(*pb.ProposePb) error
HandleEndorse(*pb.EndorsePb) error
}
Subscriber is the dispatcher subscriber interface
Click to show internal directories.
Click to hide internal directories.