Browse Source

Remove GetError() from Iterator

pull/1842/head
Jae Kwon 7 years ago
parent
commit
5636a02d03
4 changed files with 12 additions and 16 deletions
  1. +5
    -2
      db/c_level_db.go
  2. +7
    -4
      db/go_level_db.go
  3. +0
    -4
      db/mem_db.go
  4. +0
    -6
      db/types.go

+ 5
- 2
db/c_level_db.go View File

@ -190,6 +190,7 @@ func (c cLevelDBIterator) Domain() ([]byte, []byte) {
}
func (c cLevelDBIterator) Valid() bool {
c.assertNoError()
return c.itr.Valid()
}
@ -218,6 +219,8 @@ func (c cLevelDBIterator) Release() {
c.itr.Close()
}
func (c cLevelDBIterator) GetError() error {
return c.itr.GetError()
func (c cLevelDBIterator) assertNoError() {
if err := c.itr.GetError(); err != nil {
panic(err)
}
}

+ 7
- 4
db/go_level_db.go View File

@ -220,11 +220,8 @@ func (it *goLevelDBIterator) Value() []byte {
return v
}
func (it *goLevelDBIterator) GetError() error {
return it.source.Error()
}
func (it *goLevelDBIterator) Valid() bool {
it.assertNoError()
if it.invalid {
return false
}
@ -253,3 +250,9 @@ func (it *goLevelDBIterator) Close() {
func (it *goLevelDBIterator) Release() {
it.source.Release()
}
func (it *goLevelDBIterator) assertNoError() {
if err := it.source.Error(); err != nil {
panic(err)
}
}

+ 0
- 4
db/mem_db.go View File

@ -223,8 +223,4 @@ func (it *memDBIterator) Close() {
it.keys = nil
}
func (it *memDBIterator) GetError() error {
return nil
}
func (it *memDBIterator) Release() {}

+ 0
- 6
db/types.go View File

@ -107,12 +107,6 @@ type Iterator interface {
// If Valid returns false, this method will panic.
Value() []byte
// GetError returns an IteratorError from LevelDB if it had one during
// iteration.
//
// This method is safe to call when Valid returns false.
GetError() error
// Release deallocates the given Iterator.
Release()
}


Loading…
Cancel
Save