示例#1
0
文件: wrapper.go 项目: timtadh/sfp
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
}
示例#2
0
文件: wrapper.go 项目: timtadh/sfp
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))
	})
}
示例#3
0
文件: wrapper.go 项目: timtadh/sfp
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
}
示例#4
0
文件: wrapper.go 项目: timtadh/sfp
func (b *BpTree) Has(key *subgraph.SubGraph) (bool, error) {
	b.mutex.Lock()
	defer b.mutex.Unlock()
	return b.bpt.Has(subgraph_embedding.SerializeSubGraph(key))
}
示例#5
0
文件: wrapper.go 项目: timtadh/sfp
func (b *BpTree) Count(key *subgraph.SubGraph) (int, error) {
	b.mutex.Lock()
	defer b.mutex.Unlock()
	return b.bpt.Count(subgraph_embedding.SerializeSubGraph(key))
}
示例#6
0
文件: wrapper.go 项目: timtadh/sfp
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))
}