Documentation
¶
Index ¶
- type MessageQueue
- func (mq *MessageQueue) Consume(h process.Height, propose func(process.Propose), prevote func(process.Prevote), ...) (n int)
- func (mq *MessageQueue) InsertPrecommit(precommit process.Precommit)
- func (mq *MessageQueue) InsertPrevote(prevote process.Prevote)
- func (mq *MessageQueue) InsertPropose(propose process.Propose)
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MessageQueue ¶
type MessageQueue struct {
// contains filtered or unexported fields
}
A MessageQueue is used to sort incoming messages by their height and round, where messages with lower heights/rounds are found at the beginning of the queue. Every sender, identified by their pid, has their own dedicated queue with its own dedicated maximum capacity. This limits how far in the future the MessageQueue will buffer messages, to prevent running out of memory. However, this also means that explicit resynchronisation is needed, because not all messages that are received are guaranteed to be kept. MessageQueues do not handle de-duplication, and are not safe for concurrent use.
func (*MessageQueue) Consume ¶
func (mq *MessageQueue) Consume(h process.Height, propose func(process.Propose), prevote func(process.Prevote), precommit func(process.Precommit)) (n int)
Consume Propose, Prevote, and Precommit messages from the MessageQueue that have heights up to (and including) the given height. The appropriate callback will be called for every message that is consumed. All consumed messages will be dropped from the MessageQueue.
func (*MessageQueue) InsertPrecommit ¶
func (mq *MessageQueue) InsertPrecommit(precommit process.Precommit)
InsertPrecommit message into the MessageQueue. This method assumes that the sender has already been authenticated and filtered.
func (*MessageQueue) InsertPrevote ¶
func (mq *MessageQueue) InsertPrevote(prevote process.Prevote)
InsertPrevote message into the MessageQueue. This method assumes that the sender has already been authenticated and filtered.
func (*MessageQueue) InsertPropose ¶
func (mq *MessageQueue) InsertPropose(propose process.Propose)
InsertPropose message into the MessageQueue. This method assumes that the sender has already been authenticated and filtered.
type Options ¶
type Options struct {
Logger logrus.FieldLogger
MaxCapacity int
}
func DefaultOptions ¶
func DefaultOptions() Options