Documentation
¶
Overview ¶
Package messagelog provides a storage for an ordered set of messages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MessageLog ¶
type MessageLog interface {
Append(msg messages.Message)
Stream(done <-chan struct{}) <-chan messages.Message
Messages() []messages.Message
Reset(msgs []messages.Message)
}
MessageLog represents the message storage. It allows to asynchronously append messages, as well as to obtain multiple independent asynchronous streams to receive new messages from. Each of the streams provides an ordered sequence of all messages as they appear in the log. All methods are safe to invoke concurrently.
Append appends a new message to the log. It will never be blocked by any of the message streams.
Stream returns an independent channel to receive all messages as they appear in the log. Closing the channel passed to this function indicates the returned channel should be closed. Nil channel may be passed if there's no need to close the returned channel.
Messages returns all messages currently in the log.
Reset replaces messages stored in the log with the supplied ones.