Skip to content

Commit

Permalink
Inline index_offset_buffer_t methods (#1439)
Browse files Browse the repository at this point in the history
* Inline index_offset_buffer_t methods

* Consistently order methods
  • Loading branch information
senderista authored Mar 29, 2022
1 parent d0a6800 commit bb37304
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 50 deletions.
10 changes: 5 additions & 5 deletions production/db/inc/index/index.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ constexpr size_t c_offset_buffer_size = 32;
class index_offset_buffer_t
{
public:
void insert(gaia_offset_t offset, common::gaia_type_t type);
gaia_offset_t get_offset(size_t index) const;
common::gaia_type_t get_type(size_t index) const;
bool empty() const;
size_t size() const;
inline void insert(gaia_offset_t offset, common::gaia_type_t type);
inline gaia_offset_t get_offset(size_t index) const;
inline common::gaia_type_t get_type(size_t index) const;
inline size_t size() const;
inline bool empty() const;

private:
std::array<std::pair<gaia_offset_t, common::gaia_type_t>, c_offset_buffer_size> m_offsets = {};
Expand Down
26 changes: 26 additions & 0 deletions production/db/inc/index/index.inc
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,29 @@ typename T_structure::iterator index_t<T_structure, T_iterator>::find_physical_k

return m_data.end();
}

void index_offset_buffer_t::insert(gaia_offset_t offset, common::gaia_type_t type)
{
m_offsets[m_size] = std::make_pair<gaia_offset_t, common::gaia_type_t>(std::move(offset), std::move(type));
++m_size;
}

gaia_offset_t index_offset_buffer_t::get_offset(size_t index) const
{
return m_offsets[index].first;
}

common::gaia_type_t index_offset_buffer_t::get_type(size_t index) const
{
return m_offsets[index].second;
}

size_t index_offset_buffer_t::size() const
{
return m_size;
}

bool index_offset_buffer_t::empty() const
{
return m_size == 0;
}
3 changes: 1 addition & 2 deletions production/db/index/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ add_library(gaia_index STATIC
src/base_index.cpp
src/index.cpp
src/hash_index.cpp
src/range_index.cpp
src/index_offset_buffer.cpp)
src/range_index.cpp)
configure_gaia_target(gaia_index)
target_include_directories(gaia_index PUBLIC ${GAIA_INDEX_INCLUDES})
target_link_libraries(gaia_index PRIVATE gaia_common gaia_payload_types)
Expand Down
43 changes: 0 additions & 43 deletions production/db/index/src/index_offset_buffer.cpp

This file was deleted.

0 comments on commit bb37304

Please sign in to comment.