diff --git a/leveldb-api/src/main/java/org/iq80/leveldb/DBIterator.java b/leveldb-api/src/main/java/org/iq80/leveldb/DBIterator.java index 6a1ab6fa..501ba833 100644 --- a/leveldb-api/src/main/java/org/iq80/leveldb/DBIterator.java +++ b/leveldb-api/src/main/java/org/iq80/leveldb/DBIterator.java @@ -62,4 +62,28 @@ public interface DBIterator * Repositions the iterator so it is at the end of of the Database. */ void seekToLast(); + + /** + * An iterator is either positioned at a key/value pair, or + * not valid. This method returns true iff the iterator is valid. + * @return + */ + boolean Valid(); + + /** + * Return the key for the current entry. The underlying storage for + * the returned slice is valid only until the next modification of + * the iterator. + * REQUIRES: Valid() + */ + byte[] key(); + + /** + * Return the value for the current entry. The underlying storage for + * the returned slice is valid only until the next modification of + * the iterator. + * REQUIRES: Valid() + */ + + byte[] value(); } diff --git a/leveldb/src/main/java/org/iq80/leveldb/impl/SeekingIteratorAdapter.java b/leveldb/src/main/java/org/iq80/leveldb/impl/SeekingIteratorAdapter.java index d39a0878..51c6db65 100644 --- a/leveldb/src/main/java/org/iq80/leveldb/impl/SeekingIteratorAdapter.java +++ b/leveldb/src/main/java/org/iq80/leveldb/impl/SeekingIteratorAdapter.java @@ -98,6 +98,21 @@ public void seekToLast() throw new UnsupportedOperationException(); } + @Override + public boolean Valid() { + throw new UnsupportedOperationException(); + } + + @Override + public byte[] key() { + throw new UnsupportedOperationException(); + } + + @Override + public byte[] value() { + throw new UnsupportedOperationException(); + } + @Override public boolean hasPrev() {