mutable
A Database System for Research and Fast Prototyping
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
m::PaxStore Struct Reference

This class implements a generic PAX store. More...

#include <PaxStore.hpp>

Inheritance diagram for m::PaxStore:
[legend]
Collaboration diagram for m::PaxStore:
[legend]

Public Member Functions

 PaxStore (const Table &table, uint32_t block_size_in_bytes=BLOCK_SIZE)
 
 ~PaxStore ()
 
virtual std::size_t num_rows () const override
 Return the number of rows in this store.
 
std::size_t num_rows_per_block () const
 
uint32_t block_size () const
 
uint32_t offset (uint32_t idx) const
 
uint32_t offset (const Attribute &attr) const
 
void append () override
 Append a row to the store.
 
void drop () override
 Drop the most recently appended row.
 
const memory::Memorymemory () const override
 Returns the memory of the store.
 
void dump (std::ostream &out) const override
 
virtual void dump (std::ostream &out) const=0
 
void dump () const
 
const Tabletable () const
 

Static Public Attributes

static constexpr std::size_t ALLOCATION_SIZE = 1UL << 30
 1 GiB
 
static constexpr uint32_t BLOCK_SIZE = 1UL << 12
 4 KiB
 

Private Member Functions

void compute_block_offsets ()
 Computes the offsets of the columns within a PAX block, the rows size, the number of rows that fit in a PAX block, and the capacity.
 

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 of each column within a PAX block, in bits
 
uint32_t block_size_
 the size of a PAX block, in bytes; includes padding
 
std::size_t num_rows_per_block_
 the number of rows within a PAX block
 
const Tabletable_
 the table defining this store's schema
 

Detailed Description

This class implements a generic PAX store.

Definition at line 11 of file PaxStore.hpp.

Constructor & Destructor Documentation

◆ PaxStore()

PaxStore::PaxStore ( const Table table,
uint32_t  block_size_in_bytes = BLOCK_SIZE 
)

◆ ~PaxStore()

PaxStore::~PaxStore ( )

Definition at line 24 of file PaxStore.cpp.

References offsets_.

Member Function Documentation

◆ append()

void m::PaxStore::append ( )
inlineoverridevirtual

Append a row to the store.

Implements m::Store.

Definition at line 44 of file PaxStore.hpp.

References capacity_, and num_rows_.

◆ block_size()

uint32_t m::PaxStore::block_size ( ) const
inline

Definition at line 36 of file PaxStore.hpp.

References block_size_.

◆ compute_block_offsets()

void PaxStore::compute_block_offsets ( )
private

Computes the offsets of the columns within a PAX block, the rows size, the number of rows that fit in a PAX block, and the capacity.

Tries to maximize the number of rows within a PAX block by storing the attributes in descending order of their size, avoiding padding.

Definition at line 29 of file PaxStore.cpp.

References m::Type::alignment(), ALLOCATION_SIZE, block_size_, capacity_, m::Attribute::id, M_insist, m::Table::num_attrs(), num_rows_per_block_, offsets_, m::Type::size(), m::Store::table(), and m::Attribute::type.

Referenced by PaxStore().

◆ drop()

void m::PaxStore::drop ( )
inlineoverridevirtual

Drop the most recently appended row.

Implements m::Store.

Definition at line 50 of file PaxStore.hpp.

References M_insist, and num_rows_.

◆ dump() [1/3]

M_LCOV_EXCL_START void Store::dump ( ) const

Definition at line 51 of file Store.cpp.

◆ dump() [2/3]

M_LCOV_EXCL_START void PaxStore::dump ( std::ostream &  out) const
overridevirtual

◆ dump() [3/3]

virtual void m::Store::dump ( std::ostream &  out) const
virtual

Implements m::Store.

◆ memory()

const memory::Memory & m::PaxStore::memory ( ) const
inlineoverridevirtual

Returns the memory of the store.

Implements m::Store.

Definition at line 56 of file PaxStore.hpp.

References data_.

◆ num_rows()

virtual std::size_t m::PaxStore::num_rows ( ) const
inlineoverridevirtual

Return the number of rows in this store.

Implements m::Store.

Definition at line 34 of file PaxStore.hpp.

References num_rows_.

◆ num_rows_per_block()

std::size_t m::PaxStore::num_rows_per_block ( ) const
inline

Definition at line 35 of file PaxStore.hpp.

References num_rows_per_block_.

◆ offset() [1/2]

uint32_t m::PaxStore::offset ( const Attribute attr) const
inline

Definition at line 42 of file PaxStore.hpp.

References m::Attribute::id, and offset().

Referenced by offset().

◆ offset() [2/2]

uint32_t m::PaxStore::offset ( uint32_t  idx) const
inline

Definition at line 38 of file PaxStore.hpp.

References M_insist, offsets_, and m::Store::table().

◆ table()

const Table & m::Store::table ( ) const
inlineinherited

Field Documentation

◆ ALLOCATION_SIZE

constexpr std::size_t m::PaxStore::ALLOCATION_SIZE = 1UL << 30
staticconstexpr

1 GiB

Definition at line 14 of file PaxStore.hpp.

Referenced by compute_block_offsets(), and PaxStore().

◆ allocator_

memory::LinearAllocator m::PaxStore::allocator_
private

the memory allocator

Definition at line 22 of file PaxStore.hpp.

Referenced by PaxStore().

◆ BLOCK_SIZE

constexpr uint32_t m::PaxStore::BLOCK_SIZE = 1UL << 12
staticconstexpr

4 KiB

Definition at line 19 of file PaxStore.hpp.

◆ block_size_

uint32_t m::PaxStore::block_size_
private

the size of a PAX block, in bytes; includes padding

Definition at line 27 of file PaxStore.hpp.

Referenced by block_size(), compute_block_offsets(), and dump().

◆ capacity_

std::size_t m::PaxStore::capacity_
private

the number of available rows

Definition at line 25 of file PaxStore.hpp.

Referenced by append(), compute_block_offsets(), and dump().

◆ data_

memory::Memory m::PaxStore::data_
private

the underlying memory containing the data

Definition at line 23 of file PaxStore.hpp.

Referenced by dump(), memory(), and PaxStore().

◆ num_rows_

std::size_t m::PaxStore::num_rows_ = 0
private

the number of rows in use

Definition at line 24 of file PaxStore.hpp.

Referenced by append(), drop(), dump(), and num_rows().

◆ num_rows_per_block_

std::size_t m::PaxStore::num_rows_per_block_
private

the number of rows within a PAX block

Definition at line 28 of file PaxStore.hpp.

Referenced by compute_block_offsets(), dump(), and num_rows_per_block().

◆ offsets_

uint32_t* m::PaxStore::offsets_
private

the offsets of each column within a PAX block, in bits

Definition at line 26 of file PaxStore.hpp.

Referenced by compute_block_offsets(), dump(), offset(), and ~PaxStore().

◆ table_

const Table& m::Store::table_
privateinherited

the table defining this store's schema

Definition at line 24 of file Store.hpp.


The documentation for this struct was generated from the following files: