Documentation ¶
Index ¶
Constants ¶
View Source
const (
MessageTypeNewBlock = "NewBlockMessage"
)
MessageTypeNewBlock
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher a message dispatcher service.
func (*Dispatcher) Deregister ¶
func (dp *Dispatcher) Deregister(subscribers ...*Subscriber)
Deregister deregister subscribers.
func (*Dispatcher) PutMessage ¶
func (dp *Dispatcher) PutMessage(msg Message)
PutMessage put new message to chan, then subscribers will be notified to process.
func (*Dispatcher) Register ¶
func (dp *Dispatcher) Register(subscribers ...*Subscriber)
Register register subscribers.
type DummyManager ¶
type DummyManager struct {
// contains filtered or unexported fields
}
DummyManager support dummy mode
func NewDummyManager ¶
func NewDummyManager(sharedBlockCh chan interface{}) *DummyManager
NewDummyManager create DummyManager instance.
func (*DummyManager) BroadcastBlock ¶
func (nm *DummyManager) BroadcastBlock(block interface{})
BroadcastBlock broadcast block to network.
func (*DummyManager) Deregister ¶
func (nm *DummyManager) Deregister(subscribers ...*Subscriber)
Deregister Deregister the subscribers.
func (*DummyManager) PutMessage ¶
func (nm *DummyManager) PutMessage(msg Message)
PutMessage put message to dispatcher.
func (*DummyManager) Register ¶
func (nm *DummyManager) Register(subscribers ...*Subscriber)
Register register the subscribers.
type Manager ¶
type Manager interface { Start() Stop() Register(subscribers ...*Subscriber) Deregister(subscribers ...*Subscriber) BroadcastBlock(block interface{}) }
Manager manager interface
type Message ¶
type Message interface { MessageType() MessageType Data() interface{} }
Message interface for message.
type Subscriber ¶
type Subscriber struct {
// contains filtered or unexported fields
}
Subscriber subscriber.
func NewSubscriber ¶
func NewSubscriber(id interface{}, msgChan chan Message, msgTypes ...MessageType) *Subscriber
NewSubscriber return new Subscriber instance.
func (*Subscriber) MessageChan ¶
func (s *Subscriber) MessageChan() chan Message
MessageChan return msgChan.
func (*Subscriber) MessageType ¶
func (s *Subscriber) MessageType() []MessageType
MessageType return msgTypes.
Click to show internal directories.
Click to hide internal directories.