/** * Provides Read-Your-Own-Writes like functionality by * creating a new Iterator that will use {@link org.rocksdb.WBWIRocksIterator} * as a delta and baseIterator as a base * * Updating write batch with the current key of the iterator is not safe. * We strongly recommand users not to do it. It will invalidate the current * key() and value() of the iterator. This invalidation happens even before * the write batch update finishes. The state may recover after Next() is * called. * * @param columnFamilyHandle The column family to iterate over * @param baseIterator The base iterator, * e.g. {@link org.rocksdb.RocksDB#newIterator()} * @return An iterator which shows a view comprised of both the database * point-in-time from baseIterator and modifications made in this write batch. */ public RocksIterator newIteratorWithBase( final ColumnFamilyHandle columnFamilyHandle, final RocksIterator baseIterator) { RocksIterator iterator = new RocksIterator( baseIterator.parent_, iteratorWithBase(nativeHandle_, columnFamilyHandle.nativeHandle_, baseIterator.nativeHandle_)); //when the iterator is deleted it will also delete the baseIterator baseIterator.disOwnNativeHandle(); return iterator; }