Example #1
0
func (b *BpTree) Range(from, to int32) (it Iterator, err error) {
	b.mutex.Lock()
	defer b.mutex.Unlock()
	raw, err := b.bpt.Range(int_int.SerializeInt32(from), int_int.SerializeInt32(to))
	if err != nil {
		return nil, err
	}
	return b.kvIter(raw), nil
}
Example #2
0
func (b *BpTree) Remove(key int32, where func(map[string]interface{}) bool) error {
	b.mutex.Lock()
	defer b.mutex.Unlock()
	return b.bpt.Remove(int_int.SerializeInt32(key), func(bytes []byte) bool {
		return where(DeserializeJson(bytes))
	})
}
Example #3
0
func (b *BpTree) Remove(key int32, where func(subgraph.Edge) bool) error {
	b.mutex.Lock()
	defer b.mutex.Unlock()
	return b.bpt.Remove(int_int.SerializeInt32(key), func(bytes []byte) bool {
		return where(DeserializeEdge(bytes))
	})
}
Example #4
0
func (b *BpTree) Find(key int32) (it Iterator, err error) {
	b.mutex.Lock()
	defer b.mutex.Unlock()
	raw, err := b.bpt.Find(int_int.SerializeInt32(key))
	if err != nil {
		return nil, err
	}
	return b.kvIter(raw), nil
}
Example #5
0
func (b *BpTree) Has(key int32) (bool, error) {
	b.mutex.Lock()
	defer b.mutex.Unlock()
	return b.bpt.Has(int_int.SerializeInt32(key))
}
Example #6
0
func (b *BpTree) Count(key int32) (int, error) {
	b.mutex.Lock()
	defer b.mutex.Unlock()
	return b.bpt.Count(int_int.SerializeInt32(key))
}
Example #7
0
func (b *BpTree) Add(key int32, val map[string]interface{}) error {
	b.mutex.Lock()
	defer b.mutex.Unlock()
	return b.bpt.Add(int_int.SerializeInt32(key), SerializeJson(val))
}
Example #8
0
func (b *BpTree) Add(key int32, val subgraph.Edge) error {
	b.mutex.Lock()
	defer b.mutex.Unlock()
	return b.bpt.Add(int_int.SerializeInt32(key), SerializeEdge(val))
}
Example #9
0
func (b *BpTree) Add(key []byte, val int32) error {
	b.mutex.Lock()
	defer b.mutex.Unlock()
	return b.bpt.Add(bytes_subgraph.Identity(key), int_int.SerializeInt32(val))
}
Example #10
0
func (b *BpTree) Add(key []int32, val int32) error {
	b.mutex.Lock()
	defer b.mutex.Unlock()
	return b.bpt.Add(ints_ints.SerializeInt32s(key), int_int.SerializeInt32(val))
}