6
6
package span
7
7
8
8
import (
9
- "container/heap"
10
9
"fmt"
11
10
"iter"
12
11
"strings"
@@ -17,6 +16,7 @@ import (
17
16
_ "github.com/cockroachdb/cockroach/pkg/keys"
18
17
"github.com/cockroachdb/cockroach/pkg/roachpb"
19
18
"github.com/cockroachdb/cockroach/pkg/util/buildutil"
19
+ "github.com/cockroachdb/cockroach/pkg/util/container/heap"
20
20
"github.com/cockroachdb/cockroach/pkg/util/hlc"
21
21
"github.com/cockroachdb/cockroach/pkg/util/interval"
22
22
"github.com/cockroachdb/cockroach/pkg/util/syncutil"
@@ -135,6 +135,8 @@ type btreeFrontier struct {
135
135
disallowMutationWhileIterating atomic.Bool
136
136
}
137
137
138
+ var _ Frontier = (* btreeFrontier )(nil )
139
+
138
140
// btreeFrontierEntry represents a timestamped span. It is used as the nodes in both
139
141
// the tree and heap needed to keep the Frontier.
140
142
// btreeFrontierEntry implements interval/generic interface.
@@ -652,6 +654,8 @@ func (e *btreeFrontierEntry) isEmptyRange() bool {
652
654
// of the heap.
653
655
type frontierHeap []* btreeFrontierEntry
654
656
657
+ var _ heap.Interface [* btreeFrontierEntry ] = (* frontierHeap )(nil )
658
+
655
659
// Len implements heap.Interface.
656
660
func (h frontierHeap ) Len () int { return len (h ) }
657
661
@@ -670,15 +674,14 @@ func (h frontierHeap) Swap(i, j int) {
670
674
}
671
675
672
676
// Push implements heap.Interface.
673
- func (h * frontierHeap ) Push (x interface {} ) {
677
+ func (h * frontierHeap ) Push (x * btreeFrontierEntry ) {
674
678
n := len (* h )
675
- entry := x .(* btreeFrontierEntry )
676
- entry .heapIdx = n
677
- * h = append (* h , entry )
679
+ x .heapIdx = n
680
+ * h = append (* h , x )
678
681
}
679
682
680
683
// Pop implements heap.Interface.
681
- func (h * frontierHeap ) Pop () interface {} {
684
+ func (h * frontierHeap ) Pop () * btreeFrontierEntry {
682
685
old := * h
683
686
n := len (old )
684
687
entry := old [n - 1 ]
0 commit comments