Versions in this module Expand all Collapse all v1 v1.11.10 Jul 13, 2024 Changes in this version + var ErrInvalidDiscardedSize = errors.New("discarded size cannot be negative") + var ErrInvalidNumNonValidators = errors.New("num non-validators cannot be negative") + var ErrInvalidNumPeers = errors.New("num peers cannot be negative") + var ErrInvalidNumToGossip = errors.New("must gossip to at least one peer") + var ErrInvalidNumValidators = errors.New("num validators cannot be negative") + var ErrInvalidRegossipFrequency = errors.New("re-gossip frequency cannot be negative") + var ErrInvalidTargetGossipSize = errors.New("target gossip size cannot be negative") + func Every(ctx context.Context, log logging.Logger, gossiper Gossiper, ...) + func MarshalAppGossip(gossip [][]byte) ([]byte, error) + func MarshalAppRequest(filter, salt []byte) ([]byte, error) + func MarshalAppResponse(gossip [][]byte) ([]byte, error) + func ParseAppGossip(bytes []byte) ([][]byte, error) + func ParseAppRequest(bytes []byte) (*bloom.ReadFilter, ids.ID, error) + func ParseAppResponse(bytes []byte) ([][]byte, error) + func ResetBloomFilterIfNeeded(bloomFilter *BloomFilter, targetElements int) (bool, error) + type BloomFilter struct + func NewBloomFilter(registerer prometheus.Registerer, namespace string, minTargetElements int, ...) (*BloomFilter, error) + func (b *BloomFilter) Add(gossipable Gossipable) + func (b *BloomFilter) Has(gossipable Gossipable) bool + func (b *BloomFilter) Marshal() ([]byte, []byte) + type BranchingFactor struct + NonValidators int + Peers int + StakePercentage float64 + Validators int + func (b *BranchingFactor) Verify() error + type EmptySet struct + func (EmptySet[T]) Add(T) error + func (EmptySet[T]) Has(ids.ID) bool + func (EmptySet[T]) Iterate(func(gossipable T) bool) + func (EmptySet[_]) GetFilter() ([]byte, []byte) + func (EmptySet[_]) Gossip(context.Context) error + type FullSet struct + func (FullSet[T]) Add(T) error + func (FullSet[T]) Has(ids.ID) bool + func (FullSet[T]) Iterate(func(gossipable T) bool) + func (FullSet[_]) GetFilter() ([]byte, []byte) + func (FullSet[_]) Gossip(context.Context) error + type Gossipable interface + GossipID func() ids.ID + type Gossiper interface + Gossip func(ctx context.Context) error + type Handler struct + func NewHandler[T Gossipable](log logging.Logger, marshaller Marshaller[T], set Set[T], metrics Metrics, ...) *Handler[T] + func (h Handler[T]) AppRequest(_ context.Context, _ ids.NodeID, _ time.Time, requestBytes []byte) ([]byte, *common.AppError) + func (h Handler[_]) AppGossip(_ context.Context, nodeID ids.NodeID, gossipBytes []byte) + type Marshaller interface + MarshalGossip func(T) ([]byte, error) + UnmarshalGossip func([]byte) (T, error) + type Metrics struct + func NewMetrics(metrics prometheus.Registerer, namespace string) (Metrics, error) + type NoOpGossiper struct + func (NoOpGossiper) Gossip(context.Context) error + type PullGossiper struct + func NewPullGossiper[T Gossipable](log logging.Logger, marshaller Marshaller[T], set Set[T], client *p2p.Client, ...) *PullGossiper[T] + func (p *PullGossiper[_]) Gossip(ctx context.Context) error + type PushGossiper struct + func NewPushGossiper[T Gossipable](marshaller Marshaller[T], mempool Set[T], validators p2p.ValidatorSubset, ...) (*PushGossiper[T], error) + func (p *PushGossiper[T]) Add(gossipables ...T) + func (p *PushGossiper[T]) Gossip(ctx context.Context) error + type Set interface + Add func(gossipable T) error + GetFilter func() (bloom []byte, salt []byte) + Has func(gossipID ids.ID) bool + Iterate func(f func(gossipable T) bool) + type TestGossiper struct + GossipF func(ctx context.Context) error + func (t *TestGossiper) Gossip(ctx context.Context) error + type ValidatorGossiper struct + NodeID ids.NodeID + Validators p2p.ValidatorSet + func (v ValidatorGossiper) Gossip(ctx context.Context) error