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(); }
MockReadonlyIndexIterBackward(const MockReadonlyIndex* owner) { m_isUniqueInSchema = owner->m_schema->m_isUnique; m_index.reset(const_cast<MockReadonlyIndex*>(owner)); m_pos = owner->m_ids.size(); }
MockReadonlyIndexIterator(const MockReadonlyIndex* owner) { m_isUniqueInSchema = owner->m_schema->m_isUnique; m_index.reset(const_cast<MockReadonlyIndex*>(owner)); m_pos = 0; }
MockReadonlyIndexIterBackward(const MockReadonlyIndex* owner) { m_index.reset(const_cast<MockReadonlyIndex*>(owner)); m_pos = owner->m_ids.size(); }
MockReadonlyIndexIterator(const MockReadonlyIndex* owner) { m_index.reset(const_cast<MockReadonlyIndex*>(owner)); m_pos = 0; }