bool increment(llong* id, valvec<byte>* key) override { auto owner = static_cast<const MockReadonlyIndex*>(m_index.get()); assert(nullptr != id); if (terark_likely(m_pos > 0)) { owner->getIndexKey(id, key, --m_pos); return true; } return false; }
int seekLowerBound(fstring key, llong* id, valvec<byte>* retKey) override { auto owner = static_cast<const MockReadonlyIndex*>(m_index.get()); int ret = owner->forwardLowerBound(key, &m_pos); if (ret >= 0) { assert(m_pos < owner->m_ids.size()); owner->getIndexKey(id, retKey, m_pos); m_pos++; } return ret; }
void reset() { auto owner = static_cast<const MockReadonlyIndex*>(m_index.get()); m_pos = owner->m_ids.size(); }