return leaf, found
}
+// nextLeaf returns the oldest leaf in the window that can start.
+func (q *BuildQueue) nextLeaf() (NodeKey, bool) {
+ for _, id := range q.leaves[:min(len(q.leaves), buildLeafWindow)] {
+ key := NodeKey{0, id}
+ if !q.running[key] && !q.failed[key] {
+ return key, true
+ }
+ }
+
+ return NodeKey{}, false
+}
+
// Done removes a built node from the queue.
func (q *BuildQueue) Done(key NodeKey) {
delete(q.running, key)
return len(q.running)
}
-// nextLeaf returns the oldest leaf in the window that can start.
-func (q *BuildQueue) nextLeaf() (NodeKey, bool) {
- for _, id := range q.leaves[:min(len(q.leaves), buildLeafWindow)] {
- key := NodeKey{0, id}
- if !q.running[key] && !q.failed[key] {
- return key, true
- }
- }
-
- return NodeKey{}, false
-}
-
func (h BuildMergeHeap) Len() int {
return len(h)
}