Esempio n. 1
0
func first(target *btree.BTree) (result btree.Item) {
	target.Ascend(func(i btree.Item) bool {
		result = i
		return false
	})
	return
}
Esempio n. 2
0
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)
}
Esempio n. 3
0
func insert(target *btree.BTree, item btree.Item) {
	if target.ReplaceOrInsert(item) != nil {
		panic("Insert failed. item already exists")
	}
}