Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler interface {
// MessageType return the message type which the handler want to collect
MessageType() MessageType
// GetRequiredMessageCount gets required message count in this round
GetRequiredMessageCount() uint32
// IsHandled checks if the id's message is handled before
IsHandled(logger log.Logger, id string) bool
// HandleMessage handles the message
HandleMessage(logger log.Logger, msg Message) error
// Finalize finalizes the result based on the collected messages and return the next handler.
// If next handler is nil, it means it's the end of the main process
Finalize(logger log.Logger) (Handler, error)
}
Handler defines the message handler
type Message ¶
type Message interface {
// GetId returns the message id
GetId() string
// GetMessageType returns the message type
GetMessageType() MessageType
// IsValid checks if message is valid or not
IsValid() bool
}
Message defines the message interface
type MessageMain ¶
type MessageMain interface {
AddMessage(senderId string, msg Message) error
GetHandler() Handler
GetState() MainState
Start()
Stop()
}
MessageMain defines the message main interface
type PeerManager ¶
type PeerManager interface {
NumPeers() uint32
PeerIDs() []string
SelfID() string
MustSend(id string, msg interface{})
}
PeerManager defines the peer interface
type StateChangedListener ¶
Click to show internal directories.
Click to hide internal directories.