func first(target *btree.BTree) (result btree.Item) { target.Ascend(func(i btree.Item) bool { result = i return false }) return }
func (p *PageQueue) moveFromTo(pg Page, from, to *btree.BTree) { pageToMove := from.Delete(pg) if pageToMove == nil { // If we can't find our page in the from list, // we have to assume it is in the to list already. return } if pageToMove != pg { panic("Unrecongized page passed to ReclaimHigh or ReclaimLow") } insert(to, pageToMove) }
func insert(target *btree.BTree, item btree.Item) { if target.ReplaceOrInsert(item) != nil { panic("Insert failed. item already exists") } }