![]() |
mutable
A Database System for Research and Fast Prototyping
|
This class implements a row store. More...
#include <RowStore.hpp>
Public Member Functions | |
| RowStore (const Table &table) | |
| ~RowStore () | |
| virtual std::size_t | num_rows () const override |
| Return the number of rows in this store. | |
| int | offset (uint32_t idx) const |
| int | offset (const Attribute &attr) const |
| std::size_t | row_size () const |
| Returns the effective size of a row, in bits. | |
| void | append () override |
| Append a row to the store. | |
| void | drop () override |
| Drop the most recently appended row. | |
| const memory::Memory & | memory () const override |
| Returns the memory of the store. | |
| void | memory (memory::Memory memory) |
Sets the memory of the store to memory. | |
| void | dump (std::ostream &out) const override |
| virtual void | dump (std::ostream &out) const=0 |
| void | dump () const |
| const Table & | table () const |
Static Public Attributes | |
| static constexpr std::size_t | ALLOCATION_SIZE = 1UL << 30 |
| 1 GiB | |
Private Member Functions | |
| void | compute_offsets () |
| Computes the offsets of the attributes within a row. | |
| uintptr_t | at (std::size_t idx) const |
Return a pointer to the idxth row. | |
Private Attributes | |
| memory::LinearAllocator | allocator_ |
| the memory allocator | |
| memory::Memory | data_ |
| the underlying memory containing the data | |
| std::size_t | num_rows_ = 0 |
| the number of rows in use | |
| std::size_t | capacity_ |
| the number of available rows | |
| uint32_t * | offsets_ |
| the offsets from the first column, in bits, of all columns | |
| uint32_t | row_size_ |
| the size of a row, in bits; includes NULL bitmap and other meta data | |
| const Table & | table_ |
| the table defining this store's schema | |
This class implements a row store.
Definition at line 11 of file RowStore.hpp.
| RowStore::RowStore | ( | const Table & | table | ) |
Definition at line 17 of file RowStore.cpp.
References m::memory::LinearAllocator::allocate(), ALLOCATION_SIZE, allocator_, capacity_, compute_offsets(), data_, and row_size_.
| RowStore::~RowStore | ( | ) |
Definition at line 26 of file RowStore.cpp.
References offsets_.
|
inlineoverridevirtual |
|
inlineprivate |
Return a pointer to the idxth row.
Definition at line 67 of file RowStore.hpp.
References m::memory::Memory::as(), data_, and row_size_.
|
private |
Computes the offsets of the attributes within a row.
Tries to minimize the row size by storing the attributes in descending order of their size, avoiding padding.
Definition at line 31 of file RowStore.cpp.
References m::Type::alignment(), m::Attribute::id, m::Table::num_attrs(), offsets_, row_size_, m::Type::size(), m::Store::table(), and m::Attribute::type.
Referenced by RowStore().
|
inlineoverridevirtual |
Drop the most recently appended row.
Implements m::Store.
Definition at line 48 of file RowStore.hpp.
| M_LCOV_EXCL_START void Store::dump | ( | ) | const |
|
overridevirtual |
Implements m::Store.
Definition at line 67 of file RowStore.cpp.
References m::memory::Memory::addr(), capacity_, data_, m::Table::name(), num_rows_, offsets_, row_size_, and m::Store::table().
|
virtual |
Implements m::Store.
|
inlineoverridevirtual |
Returns the memory of the store.
Implements m::Store.
Definition at line 54 of file RowStore.hpp.
References data_.
Referenced by memory().
|
inline |
Sets the memory of the store to memory.
Definition at line 56 of file RowStore.hpp.
|
inlineoverridevirtual |
Return the number of rows in this store.
Implements m::Store.
Definition at line 31 of file RowStore.hpp.
References num_rows_.
|
inline |
Definition at line 37 of file RowStore.hpp.
References m::Attribute::id, and offset().
Referenced by offset().
|
inline |
Definition at line 33 of file RowStore.hpp.
References M_insist, offsets_, and m::Store::table().
|
inline |
Returns the effective size of a row, in bits.
Definition at line 40 of file RowStore.hpp.
References row_size_.
|
inlineinherited |
Definition at line 36 of file Store.hpp.
Referenced by m::ColumnStore::ColumnStore(), m::PaxStore::compute_block_offsets(), compute_offsets(), m::ColumnStore::dump(), m::PaxStore::dump(), dump(), m::ColumnStore::memory(), m::PaxStore::offset(), offset(), and m::ScanOperator::ScanOperator().
|
staticconstexpr |
|
private |
|
private |
the number of available rows
Definition at line 23 of file RowStore.hpp.
Referenced by append(), dump(), and RowStore().
|
private |
the underlying memory containing the data
Definition at line 21 of file RowStore.hpp.
Referenced by at(), dump(), memory(), and RowStore().
|
private |
the number of rows in use
Definition at line 22 of file RowStore.hpp.
Referenced by append(), drop(), dump(), and num_rows().
|
private |
the offsets from the first column, in bits, of all columns
Definition at line 24 of file RowStore.hpp.
Referenced by compute_offsets(), dump(), offset(), and ~RowStore().
|
private |
the size of a row, in bits; includes NULL bitmap and other meta data
Definition at line 25 of file RowStore.hpp.
Referenced by at(), compute_offsets(), dump(), row_size(), and RowStore().
|
privateinherited |