1717package prque
1818
1919import (
20+ "cmp"
2021 "container/heap"
2122 "time"
2223
2324 "github.com/ethereum/go-ethereum/common/mclock"
24- "golang.org/x/exp/constraints"
2525)
2626
2727// LazyQueue is a priority queue data structure where priorities can change over
@@ -33,7 +33,7 @@ import (
3333//
3434// If the upper estimate is exceeded then Update should be called for that item.
3535// A global Refresh function should also be called periodically.
36- type LazyQueue [P constraints .Ordered , V any ] struct {
36+ type LazyQueue [P cmp .Ordered , V any ] struct {
3737 clock mclock.Clock
3838 // Items are stored in one of two internal queues ordered by estimated max
3939 // priority until the next and the next-after-next refresh. Update and Refresh
@@ -50,12 +50,12 @@ type LazyQueue[P constraints.Ordered, V any] struct {
5050}
5151
5252type (
53- PriorityCallback [P constraints .Ordered , V any ] func (data V ) P // actual priority callback
54- MaxPriorityCallback [P constraints .Ordered , V any ] func (data V , until mclock.AbsTime ) P // estimated maximum priority callback
53+ PriorityCallback [P cmp .Ordered , V any ] func (data V ) P // actual priority callback
54+ MaxPriorityCallback [P cmp .Ordered , V any ] func (data V , until mclock.AbsTime ) P // estimated maximum priority callback
5555)
5656
5757// NewLazyQueue creates a new lazy queue
58- func NewLazyQueue [P constraints .Ordered , V any ](setIndex SetIndexCallback [V ], priority PriorityCallback [P , V ], maxPriority MaxPriorityCallback [P , V ], clock mclock.Clock , refreshPeriod time.Duration ) * LazyQueue [P , V ] {
58+ func NewLazyQueue [P cmp .Ordered , V any ](setIndex SetIndexCallback [V ], priority PriorityCallback [P , V ], maxPriority MaxPriorityCallback [P , V ], clock mclock.Clock , refreshPeriod time.Duration ) * LazyQueue [P , V ] {
5959 q := & LazyQueue [P , V ]{
6060 popQueue : newSstack [P , V ](nil ),
6161 setIndex : setIndex ,
0 commit comments