本站源代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
444B

  1. package goleveldb
  2. import (
  3. "github.com/lunny/nodb/store/driver"
  4. "github.com/syndtr/goleveldb/leveldb"
  5. )
  6. type Snapshot struct {
  7. db *DB
  8. snp *leveldb.Snapshot
  9. }
  10. func (s *Snapshot) Get(key []byte) ([]byte, error) {
  11. return s.snp.Get(key, s.db.iteratorOpts)
  12. }
  13. func (s *Snapshot) NewIterator() driver.IIterator {
  14. it := &Iterator{
  15. s.snp.NewIterator(nil, s.db.iteratorOpts),
  16. }
  17. return it
  18. }
  19. func (s *Snapshot) Close() {
  20. s.snp.Release()
  21. }
上海开阖软件有限公司 沪ICP备12045867号-1