70ea2300ca
* Vendor: update gitea.com/macaron/session to a177a270 * make vendor * Vendor: update gitea.com/macaron/macaron to 0db5d458 * make vendor * Vendor: update gitea.com/macaron/cache to 905232fb * make vendor * Vendor: update gitea.com/macaron/i18n to 4ca3dd0c * make vendor * Vendor: update gitea.com/macaron/gzip to efa5e847 * make vendor * Vendor: update gitea.com/macaron/captcha to e8597820 * make vendor
26 lines
443 B
Go
Vendored
26 lines
443 B
Go
Vendored
package goleveldb
|
|
|
|
import (
|
|
"gitea.com/lunny/nodb/store/driver"
|
|
"github.com/syndtr/goleveldb/leveldb"
|
|
)
|
|
|
|
type Snapshot struct {
|
|
db *DB
|
|
snp *leveldb.Snapshot
|
|
}
|
|
|
|
func (s *Snapshot) Get(key []byte) ([]byte, error) {
|
|
return s.snp.Get(key, s.db.iteratorOpts)
|
|
}
|
|
|
|
func (s *Snapshot) NewIterator() driver.IIterator {
|
|
it := &Iterator{
|
|
s.snp.NewIterator(nil, s.db.iteratorOpts),
|
|
}
|
|
return it
|
|
}
|
|
|
|
func (s *Snapshot) Close() {
|
|
s.snp.Release()
|
|
}
|