Skip to content

Commit

Permalink
docs: add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Rustin170506 committed Sep 25, 2024
1 parent 12d87f0 commit 58352da
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/statistics/handle/autoanalyze/internal/heap/heap.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// 1. Use the `errors` package from PingCAP.
// 2. Use generics to define the `heapData` struct.
// 3. Add a peak API.
// 4. Add an IsEmpty API.

package heap

Expand Down Expand Up @@ -221,6 +222,7 @@ func (h *Heap[K, V]) Peek() (V, error) {
return h.data.items[h.data.queue[0]].obj, nil
}

// IsEmpty returns true if the heap is empty.
func (h *Heap[K, V]) IsEmpty() bool {
h.lock.RLock()
defer h.lock.RUnlock()
Expand Down

0 comments on commit 58352da

Please sign in to comment.