diff options
Diffstat (limited to 'include/shard/MemISAM.h')
| -rw-r--r-- | include/shard/MemISAM.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/shard/MemISAM.h b/include/shard/MemISAM.h index 55699be..8ac17e4 100644 --- a/include/shard/MemISAM.h +++ b/include/shard/MemISAM.h @@ -27,6 +27,8 @@ thread_local size_t mrun_cancelations = 0; template <RecordInterface R> class MemISAM { private: + friend class InternalLevel; + typedef decltype(R::key) K; typedef decltype(R::value) V; @@ -178,6 +180,26 @@ public: return m_tombstone_cnt; } + R *point_lookup(R &rec, bool filter) { + + if (filter && !m_bf->lookup(rec.key)) { + return nullptr; + } + + size_t idx = get_lower_bound(rec.key); + if (idx >= m_reccnt) { + return false; + } + + while (idx < m_reccnt && m_data[idx] < rec) ++idx; + + if (m_data[idx] == rec) { + return m_data + idx; + } + + return nullptr; + } + bool delete_record(const K& key, const V& val) { size_t idx = get_lower_bound(key); if (idx >= m_reccnt) { |