Beispiel #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
}
Beispiel #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))
	})
}
Beispiel #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))
	})
}
Beispiel #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
}
Beispiel #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))
}
Beispiel #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))
}
Beispiel #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))
}
Beispiel #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))
}
Beispiel #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))
}
Beispiel #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))
}