Versions in this module Expand all Collapse all v1 v1.14.2 Aug 2, 2025 Changes in this version + var DefaultParameters = Parameters + var ErrInsufficientElements = errors.New("insufficient elements") + var ErrTooManyElements = errors.New("too many elements requested") + type BestSampler interface + Clear func() + Sample func() []ids.NodeID + SetScore func(nodeID ids.NodeID, score uint64) + func NewBest(k int) BestSampler + type Parameters struct + Alpha *int + AlphaConfidence int + AlphaPreference int + Beta int + ConcurrentRepolls int + K int + MaxItemProcessingTime time.Duration + MaxOutstandingItems int + OptimalProcessing int + func (p Parameters) Valid() error + type Sampler interface + Add func(ids.NodeID) + CanSample func(size int) bool + Clear func() + Len func() int + Sample func(size int) ([]ids.NodeID, error) + Weighted func() bool + func NewDeterministicUniform(seed int64) Sampler + func NewUniform() Sampler + type Type byte + const BestSamplerType + const MaxSamplerType + const UniformSamplerType + const WeightedSamplerType + func (t Type) String() string + type Uniform struct + func (u *Uniform) Add(nodeID ids.NodeID) + func (u *Uniform) CanSample(size int) bool + func (u *Uniform) Clear() + func (u *Uniform) Len() int + func (u *Uniform) Sample(size int) ([]ids.NodeID, error) + func (u *Uniform) Weighted() bool + type Weighted struct + func (w *Weighted) Add(nodeID ids.NodeID) + func (w *Weighted) AddWeighted(nodeID ids.NodeID, weight uint64) + func (w *Weighted) CanSample(size int) bool + func (w *Weighted) Clear() + func (w *Weighted) Len() int + func (w *Weighted) Sample(size int) ([]ids.NodeID, error) + func (w *Weighted) Weighted() bool + type WeightedSampler interface + AddWeighted func(nodeID ids.NodeID, weight uint64) + func NewWeighted() WeightedSampler Other modules containing this package github.com/luxfi/node/v2