Documentation ¶
Overview ¶
Package messageservice is a messaging service responsible for routing messages to peers and relaying messages received from peers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Broker ¶
type Broker struct {
// contains filtered or unexported fields
}
A Broker manages a mapping from identifying address to a TestMessageService, allowing messages sent from one message service to be directed to the intended recipient
type MessageService ¶
type TestMessageService ¶
type TestMessageService struct {
// contains filtered or unexported fields
}
TestMessageService is an implementation of the MessageService interface for use in multi-engine test environments.
It allows for individual nitro nodes / engines to:
- be instantiated together via test setup data
- "connect" with one another via gochans
- run independently in information-silo goroutines, while communicating on the simulated network
func NewTestMessageService ¶
func NewTestMessageService(address types.Address, broker Broker, maxDelay time.Duration) TestMessageService
NewTestMessageService returns a running TestMessageService It accepts an address, a broker, and a max delay for messages. Messages will be handled with a random delay between 0 and maxDelay
func (TestMessageService) Close ¶
func (tms TestMessageService) Close() error
Close stops the TestMessagerService from sending or receiving messages.
func (TestMessageService) HandleMessage ¶
func (tms TestMessageService) HandleMessage(message []byte)
HandleMessage deserialize the message and feed it to the engine
func (TestMessageService) Out ¶
func (t TestMessageService) Out() <-chan protocols.Message