Versions in this module Expand all Collapse all v1 v1.0.0 Jan 16, 2024 Changes in this version + type ExecQueue struct + func NewExecQueue(capacity int) *ExecQueue + func (q *ExecQueue) CanQueue() bool + func (q *ExecQueue) Clear() + func (q *ExecQueue) Queue(f func()) bool + func (q *ExecQueue) Quit() + type ExpirationFactor struct + Exp uint64 + Factor float64 + func ExpFactor(logOffset Fixed64) ExpirationFactor + func (e ExpirationFactor) Value(base float64, exp uint64) float64 + type ExpiredValue struct + Base uint64 + Exp uint64 + func (e *ExpiredValue) Add(amount int64, logOffset Fixed64) int64 + func (e *ExpiredValue) AddExp(a ExpiredValue) + func (e *ExpiredValue) IsZero() bool + func (e *ExpiredValue) SubExp(a ExpiredValue) + func (e ExpiredValue) Value(logOffset Fixed64) uint64 + type Expirer struct + func (e *Expirer) LogOffset(now mclock.AbsTime) Fixed64 + func (e *Expirer) SetLogOffset(now mclock.AbsTime, logOffset Fixed64) + func (e *Expirer) SetRate(now mclock.AbsTime, rate float64) + type Fixed64 int64 + func Float64ToFixed64(f float64) Fixed64 + func Uint64ToFixed64(f uint64) Fixed64 + func (f64 Fixed64) Fraction() Fixed64 + func (f64 Fixed64) Pow2() float64 + func (f64 Fixed64) ToUint64() uint64 + type Limiter struct + func NewLimiter(sumCostLimit uint) *Limiter + func (l *Limiter) Add(id enode.ID, address string, value float64, reqCost uint) chan chan struct{} + func (l *Limiter) Stop() + type LinearExpiredValue struct + Offset uint64 + Rate mclock.AbsTime + Val uint64 + func (e *LinearExpiredValue) Add(amount int64, now mclock.AbsTime) uint64 + func (e LinearExpiredValue) Value(now mclock.AbsTime) uint64 + type UpdateTimer struct + func NewUpdateTimer(clock mclock.Clock, threshold time.Duration) *UpdateTimer + func (t *UpdateTimer) Update(callback func(diff time.Duration) bool) bool + func (t *UpdateTimer) UpdateAt(at mclock.AbsTime, callback func(diff time.Duration) bool) bool + type ValueExpirer interface + LogOffset func(now mclock.AbsTime) Fixed64 + SetLogOffset func(now mclock.AbsTime, logOffset Fixed64) + SetRate func(now mclock.AbsTime, rate float64) + type WeightFn func(interface{}) uint64 + type WeightedRandomSelect struct + func NewWeightedRandomSelect(wfn WeightFn) *WeightedRandomSelect + func (w *WeightedRandomSelect) Choose() WrsItem + func (w *WeightedRandomSelect) IsEmpty() bool + func (w *WeightedRandomSelect) Remove(item WrsItem) + func (w *WeightedRandomSelect) Update(item WrsItem) + type WrsItem interface