Example #1
0
func (b *BpTree) keyIter(raw fs2.ItemIterator) (it KeyIterator) {
	it = func() (key []int32, err error, _ KeyIterator) {
		b.mutex.Lock()
		defer b.mutex.Unlock()
		var i []byte
		i, err, raw = raw()
		if err != nil {
			return nil, err, nil
		}
		if raw == nil {
			return nil, nil, nil
		}
		key = ints_ints.DeserializeInt32s(i)
		return key, nil, it
	}
	return it
}
Example #2
0
func (b *BpTree) kvIter(kvi fs2.Iterator) (it Iterator) {
	it = func() (key []int32, value int32, err error, _ Iterator) {
		b.mutex.Lock()
		defer b.mutex.Unlock()
		var k, v []byte
		k, v, err, kvi = kvi()
		if err != nil {
			return nil, 0, err, nil
		}
		if kvi == nil {
			return nil, 0, nil, nil
		}
		key = ints_ints.DeserializeInt32s(k)
		value = int_int.DeserializeInt32(v)
		return key, value, nil, it
	}
	return it
}