mirror of
https://gitee.com/gitea/gitea.git
synced 2024-12-15 10:00:49 +08:00
27 lines
444 B
Go
Vendored
27 lines
444 B
Go
Vendored
package goleveldb
|
|
|
|
import (
|
|
"github.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()
|
|
}
|