Skip to content

Commit

Permalink
Collapse iterator methods Next/Valid to Next() bool
Browse files Browse the repository at this point in the history
  • Loading branch information
roysc committed Aug 18, 2021
1 parent 8b5d7cb commit 69e5a9a
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions db/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,9 @@ type Iterator interface {
// CONTRACT: start, end readonly []byte
Domain() (start []byte, end []byte)

// Valid returns whether the current iterator is valid. Once invalid, the Iterator remains
// invalid forever.
Valid() bool

// Next moves the iterator to the next key in the database, as defined by order of iteration.
// If Valid returns false, this method will panic.
Next()
// Next moves the iterator to the next key in the database, as defined by order of iteration;
// returns whether the iterator is valid. Once invalid, it remains invalid forever.
Next() bool

// Key returns the key at the current position. Panics if the iterator is invalid.
// CONTRACT: key readonly []byte
Expand Down Expand Up @@ -190,9 +186,8 @@ type VersionSet interface {

type VersionIterator interface {
// Next advances the iterator to the next element.
Next()
// Returns whether the iterator is valid; once invalid, it remains invalid forever.
Next() bool
// Value returns the version ID at the current position.
Value() uint64
// Valid returns whether the iterator is valid. Once invalid, the iterator remains invalid.
Valid() bool
}

0 comments on commit 69e5a9a

Please sign in to comment.