Ejemplo n.º 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
}
Ejemplo n.º 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))
	})
}
Ejemplo n.º 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))
	})
}
Ejemplo n.º 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
}
Ejemplo n.º 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))
}
Ejemplo n.º 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))
}
Ejemplo n.º 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))
}
Ejemplo n.º 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))
}
Ejemplo n.º 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))
}
Ejemplo n.º 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))
}