Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllIndicesCleaner ¶
AllIndicesCleaner is a cleaner that removes all existing indices
Types ¶
type By ¶
type By func(a, b *spectypes.SSVMessage) bool
By is function to compare messages
func ByConsensusMsgType ¶
func ByConsensusMsgType(messageTypes ...specqbft.MessageType) By
ByConsensusMsgType implements By for msg type based priority ()
func (By) Add ¶
func (by By) Add(msgs []*MsgContainer, msg *MsgContainer) []*MsgContainer
Add adds a new container
type Cleaner ¶
Cleaner is a function for iterating over keys and clean irrelevant ones
func DefaultMsgCleaner ¶
DefaultMsgCleaner cleans ssv msgs from the queue
func SignedMsgCleaner ¶
SignedMsgCleaner cleans consensus messages from the queue it will clean messages of the given identifier and under the given height
type Index ¶
type Index struct { Name string // Mt is the message type Mt spectypes.MsgType // ID is the identifier ID string // H (optional) is the height, -1 is treated as nil H specqbft.Height // S (optional) is the slot S spec.Slot // Cmt (optional) is the consensus msg type, -1 is treated as nil Cmt specqbft.MessageType }
Index is a struct representing an index in msg queue
func DecidedMsgIndex ¶
DecidedMsgIndex indexes a decided specqbft.SignedMessage by identifier, msg type
func DefaultMsgIndex ¶
DefaultMsgIndex is the default msg index
func SignedMsgIndex ¶
func SignedMsgIndex(msgType spectypes.MsgType, mid string, h specqbft.Height, cmt ...specqbft.MessageType) []Index
SignedMsgIndex indexes a specqbft.SignedMessage by identifier, msg type and height
func SignedPostConsensusMsgIndex ¶
SignedPostConsensusMsgIndex indexes a message.SignedPostConsensusMessage by identifier and height
type IndexIterator ¶
type IndexIterator struct {
// contains filtered or unexported fields
}
IndexIterator enables to iterate over future created indices
func NewIndexIterator ¶
func NewIndexIterator() *IndexIterator
NewIndexIterator creates a new iterator
func (*IndexIterator) Add ¶
func (ii *IndexIterator) Add(generators ...IndexGenerator) *IndexIterator
Add adds a new generator
func (*IndexIterator) AddIndex ¶ added in v0.3.2
func (ii *IndexIterator) AddIndex(idx Index) *IndexIterator
AddIndex adds an index
func (*IndexIterator) Next ¶
func (ii *IndexIterator) Next() IndexGenerator
Next returns the next generator
func (*IndexIterator) Reset ¶
func (ii *IndexIterator) Reset()
Reset set iterator to 0. NOTE: use only in case we want to reuse the iterator
type Indexer ¶
type Indexer func(msg *spectypes.SSVMessage) Index
Indexer indexes the given message, returns an empty string if not applicable use WithIndexers to inject indexers upon start
func DecidedMsgIndexer ¶
func DecidedMsgIndexer() Indexer
DecidedMsgIndexer is the Indexer used for decided specqbft.SignedMessage
func DefaultMsgIndexer ¶
func DefaultMsgIndexer() Indexer
DefaultMsgIndexer returns the default msg indexer to use for message.SSVMessage
func SignedMsgIndexer ¶
func SignedMsgIndexer() Indexer
SignedMsgIndexer is the Indexer used for specqbft.SignedMessage
func SignedPostConsensusMsgIndexer ¶
func SignedPostConsensusMsgIndexer() Indexer
SignedPostConsensusMsgIndexer is the Indexer used for message.SignedPostConsensusMessage
type MsgContainer ¶
type MsgContainer struct {
// contains filtered or unexported fields
}
MsgContainer is a container for a message
type MsgQueue ¶
type MsgQueue interface { // Add adds a new message to the queue for the matching indices Add(msg *spectypes.SSVMessage) // Peek returns the first n messages for an index Peek(n int, idx Index) []*spectypes.SSVMessage // WithIterator looping through all indexes and return true when relevant and pop WithIterator(n int, peek bool, iterator func(index Index) bool) []*spectypes.SSVMessage // Pop clears and returns the first n messages for an index Pop(n int, idx Index) []*spectypes.SSVMessage // PopIndices clears and returns the first n messages for indices that are created on demand using the iterator PopIndices(n int, generator *IndexIterator) []*spectypes.SSVMessage // Purge clears indexed messages for the given index Purge(idx Index) int64 // Clean enables to aid in a custom Cleaner to clear any set of indices // TODO: check performance Clean(cleaners ...Cleaner) int64 // Count counts messages for the given index Count(idx Index) int // Len counts all messages Len() int }
MsgQueue is a message broker for message.SSVMessage
type Option ¶
Option helps to configure the Options
func WithIndexers ¶
WithIndexers is an option that configures indexers. it can be called multiple times