@Override public boolean cursorRegister(long cursorId, long indexId) throws IOException { Index ix = openIndex(indexId); if (ix != null) { TreeCursor c = (TreeCursor) ix.newCursor(Transaction.BOGUS); c.autoload(false); mCursors.insert(cursorId).value = c; } return true; }
@Override public void store(Transaction txn, byte[] key, byte[] value) throws IOException { keyCheck(key); TreeCursor cursor = new TreeCursor(this, txn); cursor.autoload(false); cursor.findAndStore(key, value); }
@Override public boolean replace(Transaction txn, byte[] key, byte[] value) throws IOException { keyCheck(key); TreeCursor cursor = new TreeCursor(this, txn); cursor.autoload(false); return cursor.findAndModify(key, TreeCursor.MODIFY_REPLACE, value); }
@Override public boolean replace(Transaction txn, byte[] key, byte[] value) throws IOException { keyCheck(key); TreeCursor cursor = new TreeCursor(this, txn); cursor.autoload(false); return cursor.findAndModify(key, TreeCursor.MODIFY_REPLACE, value); }
@Override public boolean insert(Transaction txn, byte[] key, byte[] value) throws IOException { keyCheck(key); TreeCursor cursor = new TreeCursor(this, txn); cursor.autoload(false); return cursor.findAndModify(key, TreeCursor.MODIFY_INSERT, value); }
@Override public void store(Transaction txn, byte[] key, byte[] value) throws IOException { keyCheck(key); TreeCursor cursor = new TreeCursor(this, txn); cursor.autoload(false); cursor.findAndStore(key, value); }
@Override public boolean insert(Transaction txn, byte[] key, byte[] value) throws IOException { keyCheck(key); TreeCursor cursor = new TreeCursor(this, txn); cursor.autoload(false); return cursor.findAndModify(key, TreeCursor.MODIFY_INSERT, value); }
@Override public Stats analyze(byte[] lowKey, byte[] highKey) throws IOException { TreeCursor cursor = new TreeCursor(this, Transaction.BOGUS); try { cursor.autoload(false); cursor.random(lowKey, highKey); return cursor.key() == null ? new Stats(0, 0, 0, 0, 0) : cursor.analyze(); } catch (Throwable e) { cursor.reset(); throw e; } }
@Override public Stats analyze(byte[] lowKey, byte[] highKey) throws IOException { TreeCursor cursor = new TreeCursor(this, Transaction.BOGUS); try { cursor.autoload(false); cursor.random(lowKey, highKey); return cursor.key() == null ? new Stats(0, 0, 0, 0, 0) : cursor.analyze(); } catch (Throwable e) { cursor.reset(); throw e; } }
@Override public long count(byte[] lowKey, byte[] highKey) throws IOException { TreeCursor cursor = new TreeCursor(this, Transaction.BOGUS); TreeCursor high = null; try { if (highKey != null) { high = new TreeCursor(this, Transaction.BOGUS); high.autoload(false); high.find(highKey); if (high.mKey == null) { // Found nothing. return 0; } } return cursor.count(lowKey, high); } finally { cursor.reset(); if (high != null) { high.reset(); } } }
@Override public long count(byte[] lowKey, byte[] highKey) throws IOException { TreeCursor cursor = new TreeCursor(this, Transaction.BOGUS); TreeCursor high = null; try { if (highKey != null) { high = new TreeCursor(this, Transaction.BOGUS); high.autoload(false); high.find(highKey); if (high.mKey == null) { // Found nothing. return 0; } } return cursor.count(lowKey, high); } finally { cursor.reset(); if (high != null) { high.reset(); } } }
cursor.autoload(false); cursor.findGt(prefix); byte[] key = cursor.key();
cursor.autoload(false); cursor.findGt(prefix); byte[] key = cursor.key();
cursor.autoload(false); cursor.findGt(prefix); byte[] key = cursor.key();
/** * @param view view to pass to observer * @return false if should stop */ final boolean verifyTree(Index view, VerificationObserver observer) throws IOException { TreeCursor cursor = new TreeCursor(this, Transaction.BOGUS); try { cursor.autoload(false); cursor.first(); // must start with loaded key int height = cursor.height(); if (!observer.indexBegin(view, height)) { cursor.reset(); return false; } if (!cursor.verify(height, observer)) { cursor.reset(); return false; } cursor.reset(); } catch (Throwable e) { observer.failed = true; throw e; } return true; }
/** * @param view view to pass to observer * @return false if should stop */ final boolean verifyTree(Index view, VerificationObserver observer) throws IOException { TreeCursor cursor = new TreeCursor(this, Transaction.BOGUS); try { cursor.autoload(false); cursor.first(); // must start with loaded key int height = cursor.height(); if (!observer.indexBegin(view, height)) { cursor.reset(); return false; } if (!cursor.verify(height, observer)) { cursor.reset(); return false; } cursor.reset(); } catch (Throwable e) { observer.failed = true; throw e; } return true; }
cursor.autoload(false); cursor.findGt(prefix);
cursor.autoload(false); cursor.findGt(prefix);
cursor.autoload(false); cursor.first();
TreeCursor cursor = new TreeCursor(mTrash, Transaction.BOGUS); try { cursor.autoload(false); cursor.findGt(prefix); while (true) {