DiskLoc CappedIterator::getNext() {
        DiskLoc ret = _curr;

        const NamespaceDetails* nsd = _collection->_details;
        const ExtentManager* em = _collection->getExtentManager();

        // Move to the next thing.
        if (!isEOF()) {
            _curr = getNextCapped(nsd, em, _curr, _direction );
        }
        else if (_tailable && !_prev.isNull()) {
            // If we're tailable, there COULD have been something inserted even though we were
            // previously EOF.  Look at the next thing from 'prev' and see.
            DiskLoc newCurr = getNextCapped(nsd, em, _prev, _direction);

            if (!newCurr.isNull()) {
                // There's something new to return.  _curr always points to the next thing to
                // return.  Update it, and move _prev to the thing we just returned.
                ret = _prev = newCurr;
                _curr = getNextCapped(nsd, em, _prev, _direction);
            }
        }

        return ret;
    }
    DiskLoc CappedRecordStoreV1Iterator::getNext() {
        DiskLoc ret = _curr;

        // Move to the next thing.
        if (!isEOF()) {
            _prev = _curr;
            _curr = getNextCapped(_curr);
        }
        else if (_tailable && !_prev.isNull()) {
            // If we're tailable, there COULD have been something inserted even though we were
            // previously EOF.  Look at the next thing from 'prev' and see.
            DiskLoc newCurr = getNextCapped(_prev);

            if (!newCurr.isNull()) {
                // There's something new to return.  _curr always points to the next thing to
                // return.  Update it, and move _prev to the thing we just returned.
                _prev = ret = newCurr;
                _curr = getNextCapped(_prev);
            }
        }

        return ret;
    }