Exemplo n.º 1
0
func (b *BpTree) keyIter(raw fs2.ItemIterator) (it KeyIterator) {
	it = func() (key *subgraph.SubGraph, 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 = subgraph_embedding.DeserializeSubGraph(i)
		return key, nil, it
	}
	return it
}
Exemplo n.º 2
0
func (b *BpTree) kvIter(kvi fs2.Iterator) (it Iterator) {
	it = func() (key *subgraph.SubGraph, value []map[int]bool, err error, _ Iterator) {
		b.mutex.Lock()
		defer b.mutex.Unlock()
		var k, v []byte
		k, v, err, kvi = kvi()
		if err != nil {
			return nil, nil, err, nil
		}
		if kvi == nil {
			return nil, nil, nil, nil
		}
		key = subgraph_embedding.DeserializeSubGraph(k)
		value = DeserializeOverlap(v)
		return key, value, nil, it
	}
	return it
}