Documentation ¶
Index ¶
Constants ¶
View Source
const HashLength = 8
Variables ¶
This section is empty.
Functions ¶
func ResetBloomFilterIfNeeded ¶
func ResetBloomFilterIfNeeded( bloomFilter *BloomFilter, maxFilledRatio float64, ) bool
ResetBloomFilterIfNeeded resets a bloom filter if it breaches a ratio of filled elements. Returns true if the bloom filter was reset.
Types ¶
type BloomFilter ¶
type BloomFilter struct { Bloom *bloomfilter.Filter // Salt is provided to eventually unblock collisions in Bloom Salt []byte }
func NewBloomFilter ¶
func NewBloomFilter(m uint64, p float64) (*BloomFilter, error)
func (*BloomFilter) Add ¶
func (b *BloomFilter) Add(gossipable Gossipable)
func (*BloomFilter) Has ¶
func (b *BloomFilter) Has(gossipable Gossipable) bool
type Gossipable ¶
type Gossipable interface { // GetHash represents the unique hash of this item GetHash() Hash Marshal() ([]byte, error) Unmarshal(bytes []byte) error }
Gossipable is an item that can be gossiped across the network
type GossipableAny ¶
type GossipableAny[T any] interface { *T Gossipable }
GossipableAny exists to help create non-nil pointers to a concrete Gossipable
type Gossiper ¶
type Gossiper[T any, U GossipableAny[T]] struct { // contains filtered or unexported fields }
func NewGossiper ¶
type Handler ¶
type Handler[T Gossipable] struct { // contains filtered or unexported fields }
func NewHandler ¶
func (Handler[T]) AppRequest ¶
type PullGossipRequest ¶
type PullGossipResponse ¶
type PullGossipResponse struct {
GossipBytes [][]byte `serialize:"true"`
}
type Set ¶
type Set[T Gossipable] interface { // Add adds a Gossipable to the set Add(gossipable T) error // Get returns elements that match the provided filter function Get(filter func(gossipable T) bool) []T // GetFilter returns a bloom filter containing the elements in Set GetFilter() *BloomFilter }
Set holds a set of known Gossipable items
Click to show internal directories.
Click to hide internal directories.