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 *message.SSVMessage) bool
By is function to compare messages
func ByConsensusMsgType ¶
func ByConsensusMsgType(messageTypes ...message.ConsensusMessageType) 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 ¶
func DefaultMsgCleaner(mid message.Identifier, mts ...message.MsgType) Cleaner
DefaultMsgCleaner cleans ssv msgs from the queue
func SignedMsgCleaner ¶
func SignedMsgCleaner(mid message.Identifier, h message.Height) Cleaner
SignedMsgCleaner cleans consensus messages from the queue it will clean messages of the given identifier and under the given height
func SignedPostConsensusMsgCleaner ¶
func SignedPostConsensusMsgCleaner(mid message.Identifier, h message.Height) Cleaner
SignedPostConsensusMsgCleaner cleans post 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 message.MsgType // ID is the identifier ID string // H (optional) is the height, -1 is treated as nil H message.Height // Cmt (optional) is the consensus msg type, -1 is treated as nil Cmt message.ConsensusMessageType }
Index is a struct representing an index in msg queue
func DecidedMsgIndex ¶
DecidedMsgIndex indexes a decided message.SignedMessage by identifier, msg type
func DefaultMsgIndex ¶
func DefaultMsgIndex(mt message.MsgType, mid message.Identifier) Index
DefaultMsgIndex is the default msg index
func SignedMsgIndex ¶
func SignedMsgIndex(msgType message.MsgType, mid string, h message.Height, cmt ...message.ConsensusMessageType) []Index
SignedMsgIndex indexes a message.SignedMessage by identifier, msg type 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) 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 *message.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 message.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 message.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 *message.SSVMessage) // Peek returns the first n messages for an index Peek(n int, idx Index) []*message.SSVMessage // Pop clears and returns the first n messages for an index Pop(n int, idx Index) []*message.SSVMessage // PopIndices clears and returns the first n messages for indices that are created on demand using the iterator PopIndices(n int, generator *IndexIterator) []*message.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