Пример #1
0
func (ldbs *Store) getWithSnapshot(key []byte, snapshot *leveldb.Snapshot) ([]byte, error) {
	options := defaultReadOptions()
	b, err := snapshot.Get(key, options)
	if err == leveldb.ErrNotFound {
		return nil, nil
	}
	return b, err
}
Пример #2
0
func newIteratorWithSnapshot(store *Store, snapshot *leveldb.Snapshot) *Iterator {
	options := defaultReadOptions()
	iter := snapshot.NewIterator(nil, options)
	rv := Iterator{
		store:    store,
		iterator: iter,
	}
	return &rv
}