@Override public void prev() { iterator.prev(); status(); }
@Override public void prev() { iterator.prev(); status(); }
public Map.Entry<byte[], byte[]> prev() { Map.Entry<byte[], byte[]> rc = peekPrev(); iterator.prev(); return rc; }
@Override public void prev() { iterator.prev(); status(); }
public Map.Entry<byte[], byte[]> peekPrev() { iterator.prev(); try { return peekNext(); } finally { if (iterator.isValid()) { iterator.next(); } else { iterator.seekToFirst(); } } }
@Benchmark public void readRev(final Reader r, final Blackhole bh) { final RocksIterator iterator = r.db.newIterator(); iterator.seekToLast(); while (iterator.isValid()) { bh.consume(iterator.value()); iterator.prev(); } }
public boolean hasPrev() { if (!iterator.isValid()) return false; iterator.prev(); try { return iterator.isValid(); } finally { if (iterator.isValid()) { iterator.next(); } else { iterator.seekToFirst(); } } }
private boolean findNext() { // Sanity check assert Thread.holdsLock(this); assert !this.closed; assert this.next == null; if (this.finished) return false; // Advance cursor if (this.reverse) { assert RocksDBUtil.isInitialized(this.cursor); this.cursor.prev(); if (RocksDBKVStore.this.log.isTraceEnabled()) { assert RocksDBUtil.isInitialized(this.cursor); RocksDBKVStore.this.log.trace("seek previous -> " + (this.cursor.isValid() ? new KVPair(this.cursor.key(), this.cursor.value()) : "START")); } } else { assert RocksDBUtil.isInitialized(this.cursor); this.cursor.next(); if (RocksDBKVStore.this.log.isTraceEnabled()) { assert RocksDBUtil.isInitialized(this.cursor); RocksDBKVStore.this.log.trace("seek next -> " + (this.cursor.isValid() ? new KVPair(this.cursor.key(), this.cursor.value()) : "END")); } } // Update from cursor return this.updateFromCursor(); }
RocksDBKVStore.this.log.trace("valid, seek to previous before " + ByteUtil.toString(maxKey)); assert RocksDBUtil.isInitialized(this.cursor); this.cursor.prev(); } else { if (RocksDBKVStore.this.log.isTraceEnabled())
@Override public Entry<byte[], byte[]> getFloor(byte[] key) throws IOException { try (RocksIterator iterator = db.newIterator(optionCache)) { // Position the iterator on the record whose key is >= to the supplied key iterator.seek(key); if (!iterator.isValid()) { // There are no entries >= key iterator.seekToLast(); if (iterator.isValid()) { return new EntryWrapper(iterator.key(), iterator.value()); } else { // Db is empty return null; } } iterator.prev(); if (!iterator.isValid()) { // Iterator is on the 1st entry of the db and this entry key is >= to the target // key return null; } else { return new EntryWrapper(iterator.key(), iterator.value()); } } }