1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-06 00:00:55 +00:00
Beego/vendor/github.com/siddontang/ledisdb/store/goleveldb/snapshot.go

27 lines
452 B
Go
Raw Normal View History

2018-11-09 04:37:28 +00:00
package goleveldb
import (
"github.com/siddontang/ledisdb/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()
}