Example #1
0
func (b *BpTree) Range(from, to *subgraph.SubGraph) (it Iterator, err error) {
	b.mutex.Lock()
	defer b.mutex.Unlock()
	raw, err := b.bpt.Range(subgraph_embedding.SerializeSubGraph(from), subgraph_embedding.SerializeSubGraph(to))
	if err != nil {
		return nil, err
	}
	return b.kvIter(raw), nil
}
Example #2
0
func (b *BpTree) Remove(key *subgraph.SubGraph, where func([]map[int]bool) bool) error {
	b.mutex.Lock()
	defer b.mutex.Unlock()
	return b.bpt.Remove(subgraph_embedding.SerializeSubGraph(key), func(bytes []byte) bool {
		return where(DeserializeOverlap(bytes))
	})
}
Example #3
0
func (b *BpTree) Find(key *subgraph.SubGraph) (it Iterator, err error) {
	b.mutex.Lock()
	defer b.mutex.Unlock()
	raw, err := b.bpt.Find(subgraph_embedding.SerializeSubGraph(key))
	if err != nil {
		return nil, err
	}
	return b.kvIter(raw), nil
}
Example #4
0
func (b *BpTree) Has(key *subgraph.SubGraph) (bool, error) {
	b.mutex.Lock()
	defer b.mutex.Unlock()
	return b.bpt.Has(subgraph_embedding.SerializeSubGraph(key))
}
Example #5
0
func (b *BpTree) Count(key *subgraph.SubGraph) (int, error) {
	b.mutex.Lock()
	defer b.mutex.Unlock()
	return b.bpt.Count(subgraph_embedding.SerializeSubGraph(key))
}
Example #6
0
func (b *BpTree) Add(key *subgraph.SubGraph, val []map[int]bool) error {
	b.mutex.Lock()
	defer b.mutex.Unlock()
	return b.bpt.Add(subgraph_embedding.SerializeSubGraph(key), SerializeOverlap(val))
}