github.com/annchain/OG@v0.0.9/communication/interface.go (about)

     1  package communication
     2  
     3  import (
     4  	"github.com/annchain/OG/eventbus"
     5  	"github.com/annchain/OG/message"
     6  )
     7  
     8  type GeneralPeerCommunicatorOutgoing interface {
     9  	Broadcast(msg message.GeneralMessage)
    10  	Multicast(msg message.GeneralMessage, peers []message.GeneralPeer)
    11  	Unicast(msg message.GeneralMessage, peer message.GeneralPeer)
    12  }
    13  type GeneralPeerCommunicatorIncoming interface {
    14  	GetPipeIn() chan *message.GeneralMessageEvent
    15  	GetPipeOut() chan *message.GeneralMessageEvent
    16  }
    17  
    18  type GeneralMessageEventHandler interface {
    19  	Handle(msgEvent *message.GeneralMessageEvent)
    20  }
    21  
    22  type GeneralMessageHandlerPlugin interface {
    23  	SupportedMessageTypes() []message.GeneralMessageType
    24  	SupportedEventHandlers() []eventbus.EventHandlerRegisterInfo
    25  	GetMessageEventHandler() GeneralMessageEventHandler
    26  	SetOutgoing(GeneralPeerCommunicatorOutgoing)
    27  	Start()
    28  	Stop()
    29  }