fabric: github.com/hyperledger/fabric/gossip/gossip/msgstore Index | Files

package msgstore

import "github.com/hyperledger/fabric/gossip/gossip/msgstore"

Index

Package Files

msgs.go

func Noop Uses

func Noop(_ interface{})

Noop is a function that doesn't do anything

type MessageStore Uses

type MessageStore interface {
    // add adds a message to the store
    // returns true or false whether the message was added to the store
    Add(msg interface{}) bool

    // Checks if message is valid for insertion to store
    // returns true or false whether the message can be added to the store
    CheckValid(msg interface{}) bool

    // size returns the amount of messages in the store
    Size() int

    // get returns all messages in the store
    Get() []interface{}

    // Stop all associated go routines
    Stop()

    // Purge purges all messages that are accepted by
    // the given predicate
    Purge(func(interface{}) bool)
}

MessageStore adds messages to an internal buffer. When a message is received, it might:

- Be added to the buffer
- Discarded because of some message already in the buffer (invalidated)
- Make a message already in the buffer to be discarded (invalidates)

When a message is invalidated, the invalidationTrigger is invoked on that message.

func NewMessageStore Uses

func NewMessageStore(pol common.MessageReplacingPolicy, trigger invalidationTrigger) MessageStore

NewMessageStore returns a new MessageStore with the message replacing policy and invalidation trigger passed.

func NewMessageStoreExpirable Uses

func NewMessageStoreExpirable(pol common.MessageReplacingPolicy, trigger invalidationTrigger, msgTTL time.Duration, externalLock func(), externalUnlock func(), externalExpire func(interface{})) MessageStore

NewMessageStoreExpirable returns a new MessageStore with the message replacing policy and invalidation trigger passed. It supports old message expiration after msgTTL, during expiration first external lock taken, expiration callback invoked and external lock released. Callback and external lock can be nil.

Package msgstore imports 3 packages (graph) and is imported by 3 packages. Updated 2018-12-16. Refresh now. Tools for package owners.