From 0cf160ee68d37be93665e665ef22ae6e211a157d Mon Sep 17 00:00:00 2001 From: Douglas Rumbaugh Date: Mon, 22 May 2023 14:58:22 -0400 Subject: More updates/restructuring --- include/shard/MemISAM.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'include/shard/MemISAM.h') 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 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) { -- cgit v1.2.3