msgqueue

package
v0.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2021 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecidedIndexKey added in v0.0.4

func DecidedIndexKey(lambda []byte) string

DecidedIndexKey is the ibft decisions index key

func IBFTAllRoundChangeIndexKey added in v0.0.6

func IBFTAllRoundChangeIndexKey(lambda []byte, seqNumber uint64) string

IBFTAllRoundChangeIndexKey is the ibft index key for all round change msgs

func IBFTMessageIndexKey added in v0.0.5

func IBFTMessageIndexKey(lambda []byte, seqNumber uint64, round uint64) string

IBFTMessageIndexKey is the ibft index key

func SigRoundIndexKey

func SigRoundIndexKey(lambda []byte, seqNumber uint64) string

SigRoundIndexKey is the SSV node signature collection index key

func SyncIndexKey added in v0.0.4

func SyncIndexKey(lambda []byte) string

SyncIndexKey is the ibft sync index key

Types

type IndexFunc

type IndexFunc func(msg *network.Message) []string

IndexFunc is the function that indexes messages to be later pulled by those indexes

type MessageQueue

type MessageQueue struct {
	// contains filtered or unexported fields
}

MessageQueue is a broker of messages for the IBFT instance to process. Messages can come in various times, even next round's messages can come "early" as other nodes can change round before this node. To solve this issue we have a message broker from which the instance pulls new messages, this also reduces concurrency issues as the instance is now single threaded. The message queue has internal logic to organize messages by their round.

func New

func New() *MessageQueue

New is the constructor of MessageQueue

func (*MessageQueue) AddIndexFunc

func (q *MessageQueue) AddIndexFunc(f IndexFunc)

AddIndexFunc adds an index function that will be activated every new message the queue receives

func (*MessageQueue) AddMessage

func (q *MessageQueue) AddMessage(msg *network.Message)

AddMessage adds a message the queue based on the message round. AddMessage is thread safe

func (*MessageQueue) DeleteMessagesWithIds added in v0.0.6

func (q *MessageQueue) DeleteMessagesWithIds(ids []string)

DeleteMessagesWithIds deletes all msgs by the given id

func (*MessageQueue) MessagesForIndex added in v0.0.6

func (q *MessageQueue) MessagesForIndex(index string) map[string]*network.Message

MessagesForIndex returns all messages for an index

func (*MessageQueue) MsgCount

func (q *MessageQueue) MsgCount(index string) int

MsgCount will return a count of messages by their index

func (*MessageQueue) PopMessage

func (q *MessageQueue) PopMessage(index string) *network.Message

PopMessage will return a message by its index if found, will also delete all other index occurrences of that message

func (*MessageQueue) PurgeIndexedMessages

func (q *MessageQueue) PurgeIndexedMessages(index string)

PurgeIndexedMessages will delete all indexed messages for the given index

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL