Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidMessage is return if the message is invalid ErrInvalidMessage = errors.New("invalid message") // ErrUndefinedMessage is return if the message is not defined ErrUndefinedMessage = errors.New("undefined message") // ErrFullChannel is returned if the message channel is full ErrFullChannel = errors.New("full channel") )
View Source
var ( ErrOldMessage = errors.New("old message") ErrBadMsg = errors.New("bad message") ErrInvalidStateTransition = errors.New("invalid state transition") ErrDupMsg = errors.New("duplicate message") )
View Source
var ( ErrNotEchoMsg = errors.New("not a echo message") ErrDifferentHash = errors.New("different hash") )
View Source
var ( ErrDupMessage = errors.New("duplicate message") ErrNotYours = errors.New("not yours") )
Functions ¶
This section is empty.
Types ¶
type EchoMessage ¶
type EchoMessage interface { proto.Message types.Message // GetEchoMessage() return the message to broadcast in echo protocol GetEchoMessage() types.Message }
Message defines the message interface
type EchoMsgMain ¶
type EchoMsgMain struct { types.MessageMain // contains filtered or unexported fields }
func NewEchoMsgMain ¶
func NewEchoMsgMain(next types.MessageMain, pm types.PeerManager) *EchoMsgMain
func (*EchoMsgMain) AddMessage ¶
func (t *EchoMsgMain) AddMessage(senderId string, msg types.Message) error
NOTE: Avoid duplicate messages from the same peer should be handled in the caller
type MsgChans ¶
type MsgChans struct {
// contains filtered or unexported fields
}
func NewMsgChans ¶
func NewMsgChans(bufferLen uint32, ts ...types.MessageType) *MsgChans
type MsgMain ¶
type MsgMain struct {
// contains filtered or unexported fields
}
func NewMsgMain ¶
func NewMsgMain(id string, peerNum uint32, listener types.StateChangedListener, initHandler types.Handler, msgTypes ...types.MessageType) *MsgMain
func (*MsgMain) GetHandler ¶
type Peer ¶
type Peer struct { Id string Messages map[types.MessageType]types.Message // contains filtered or unexported fields }
func (*Peer) GetMessage ¶
func (p *Peer) GetMessage(t types.MessageType) types.Message
Click to show internal directories.
Click to hide internal directories.