func (it *Iterator) Valid() bool {
	if it.valid && it.curr == it.s.tail {
		it.valid = false
	}
	return it.valid
}
Valid returns true when iterator reaches the end
If the specified item is not found, start with the predecessor node
This is used for implementing disk block based storage
package skiplist
import "sync/atomic"
import "unsafe"
type Iterator struct {
	cmp        CompareFn
	s          *Skiplist
	prev, curr *Node
	valid      bool
	buf        *ActionBuffer
	deleted    bool
	bs *BarrierSession
}
func (s *Skiplist) NewIterator(cmp CompareFn,
	buf *ActionBuffer) *Iterator {
	return &Iterator{
		cmp: cmp,
		s:   s,
		buf: buf,
		bs:  s.barrier.Acquire(),
	}
}
func (it *Iterator) SeekFirst() {
	it.prev = it.s.head
	it.curr, _ = it.s.head.getNext(0)
	it.valid = true
}
func (it *Iterator) SeekWithCmp(itm unsafe.Pointer, cmp CompareFn, eqCmp CompareFn) bool {
	var found bool
	if found = it.s.findPath(itm, cmp, it.buf, &it.s.Stats) != nil; found {
		it.prev = it.buf.preds[0]
		it.curr = it.buf.succs[0]
	} else {
		if found = eqCmp != nil && Compare(eqCmp, itm, it.buf.preds[0].Item()) == 0; found {
			it.prev = nil
			it.curr = it.buf.preds[0]
		}
	}
	return found
}
func (it *Iterator) SeekWithSkip(itm unsafe.Pointer, skipItm func(unsafe.Pointer) bool) bool {
	it.valid = true
	found := it.s.findPath2(itm, it.cmp, skipItm, it.buf, &it.s.Stats) != nil
	it.prev = it.buf.preds[0]
	it.curr = it.buf.succs[0]
	return found
}
func (it *Iterator) Seek(itm unsafe.Pointer) bool {
	return it.SeekWithSkip(itm, nil)
}
func (it *Iterator) SeekPrev(itm unsafe.Pointer, skip func(unsafe.Pointer) bool) {
	if !it.SeekWithSkip(itm, skip) && it.prev != it.s.head {
		it.curr = it.prev
		it.prev = nil
	}
}