SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
SWC::Ranger::Blocks Class Referencefinal

#include <swcdb/ranger/db/RangeBlocks.h>

+ Collaboration diagram for SWC::Ranger::Blocks:

Public Types

typedef BlocksPtr
 

Public Member Functions

 Blocks (const DB::Types::KeySeq key_seq)
 
 Blocks (const Blocks &)=delete
 
 Blocks (const Blocks &&)=delete
 
Blocksoperator= (const Blocks &)=delete
 
void init (const RangePtr &for_range)
 
Ptr ptr ()
 
 ~Blocks () noexcept
 
void schema_update ()
 
void processing_increment ()
 
void processing_decrement ()
 
void load (int &err)
 
void unload ()
 
void remove (int &err)
 
void expand (DB::Cells::Interval &intval)
 
void expand_and_align (DB::Cells::Interval &intval)
 
void apply_new (int &err, CellStore::Writers &w_cellstores, CommitLog::Fragments::Vec &fragments_old)
 
void add_logged (const DB::Cells::Cell &cell)
 
void scan (ReqScan::Ptr req, Block::Ptr blk_ptr=nullptr)
 
bool _split (Block::Ptr blk, bool loaded)
 
size_t cells_count ()
 
size_t size () noexcept
 
size_t size_bytes ()
 
size_t size_bytes_total (bool only_loaded=false)
 
size_t release (size_t bytes)
 
size_t release (size_t bytes, uint8_t level)
 
void reset_blocks ()
 
bool processing () noexcept
 
bool wait_processing (int64_t quit_time=0)
 
void print (std::ostream &out, bool minimal)
 

Public Attributes

RangePtr range
 
CommitLog::Fragments commitlog
 
CellStore::Readers cellstores
 

Private Member Functions

size_t SWC_PURE_FUNC _size () const noexcept
 
size_t _size_bytes ()
 
bool _processing () const noexcept
 
void _clear ()
 
void init_blocks (int &err)
 
size_t SWC_PURE_FUNC _get_block_idx (const Block::Ptr blk) const noexcept
 
size_t _narrow (const DB::Cell::Key &key) const
 

Private Attributes

Core::MutexSptd m_mutex
 
Block::Ptr m_block
 
Core::Vector< Block::Ptrm_blocks_idx
 
Core::Atomic< size_t > m_processing
 

Static Private Attributes

static const uint8_t MAX_IDX_NARROW = 20
 

Detailed Description

Definition at line 23 of file RangeBlocks.h.

Member Typedef Documentation

◆ Ptr

Definition at line 25 of file RangeBlocks.h.

Constructor & Destructor Documentation

◆ Blocks() [1/3]

SWC_CAN_INLINE SWC::Ranger::Blocks::Blocks ( const DB::Types::KeySeq  key_seq)
explicit

Definition at line 13 of file RangeBlocks.cc.

◆ Blocks() [2/3]

SWC::Ranger::Blocks::Blocks ( const Blocks )
delete

◆ Blocks() [3/3]

SWC::Ranger::Blocks::Blocks ( const Blocks &&  )
delete

◆ ~Blocks()

SWC::Ranger::Blocks::~Blocks ( )
inlinenoexcept

Definition at line 45 of file RangeBlocks.h.

Member Function Documentation

◆ _clear()

void SWC::Ranger::Blocks::_clear ( )
private

Definition at line 458 of file RangeBlocks.cc.

References m_block, m_blocks_idx, SWC::Ranger::Block::next, and SWC::Ranger::Block::prev.

Referenced by init_blocks(), release(), remove(), reset_blocks(), and unload().

+ Here is the caller graph for this function:

◆ _get_block_idx()

SWC_CAN_INLINE size_t SWC::Ranger::Blocks::_get_block_idx ( const Block::Ptr  blk) const
privatenoexcept

Definition at line 505 of file RangeBlocks.cc.

Referenced by _split().

+ Here is the caller graph for this function:

◆ _narrow()

SWC_CAN_INLINE size_t SWC::Ranger::Blocks::_narrow ( const DB::Cell::Key key) const
private

Definition at line 513 of file RangeBlocks.cc.

References SWC::DB::Cell::Key::empty(), m_blocks_idx, and MAX_IDX_NARROW.

Referenced by add_logged(), and scan().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _processing()

SWC_CAN_INLINE bool SWC::Ranger::Blocks::_processing ( ) const
privatenoexcept

Definition at line 448 of file RangeBlocks.cc.

References m_block, m_processing, and SWC::Ranger::Block::next.

Referenced by print(), and processing().

+ Here is the caller graph for this function:

◆ _size()

SWC_CAN_INLINE size_t SWC::Ranger::Blocks::_size ( ) const
privatenoexcept

Definition at line 432 of file RangeBlocks.cc.

References m_block, and SWC::Ranger::Block::next.

Referenced by print(), and size().

+ Here is the caller graph for this function:

◆ _size_bytes()

SWC_CAN_INLINE size_t SWC::Ranger::Blocks::_size_bytes ( )
private

Definition at line 440 of file RangeBlocks.cc.

References m_block, and SWC::Ranger::Block::next.

Referenced by print(), size_bytes(), and size_bytes_total().

+ Here is the caller graph for this function:

◆ _split()

bool SWC::Ranger::Blocks::_split ( Block::Ptr  blk,
bool  loaded 
)

Definition at line 241 of file RangeBlocks.cc.

References _get_block_idx(), SWC::Ranger::Block::_need_split(), SWC::Ranger::Block::_split(), commitlog, SWC::Ranger::CommitLog::Fragments::is_compacting(), SWC::Ranger::Block::loaded(), m_blocks_idx, m_mutex, SWC::System::Resources::need_ram(), SWC::Ranger::Block::preload(), SWC::Ranger::Block::processing_increment(), range, SWC::Env::Rgr::res(), SWC::Env::Rgr::scan_reserved_bytes(), SWC::Core::MutexSptd::try_full_lock(), and SWC::Core::MutexSptd::unlock().

Referenced by SWC::Ranger::Block::splitter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_logged()

SWC_CAN_INLINE void SWC::Ranger::Blocks::add_logged ( const DB::Cells::Cell cell)

Definition at line 111 of file RangeBlocks.cc.

References _narrow(), SWC::Ranger::CommitLog::Fragments::add(), SWC::Ranger::Block::add_logged(), commitlog, SWC::DB::Cells::Cell::key, m_block, m_blocks_idx, m_mutex, and SWC::Ranger::Block::next.

Referenced by SWC::Ranger::Range::_run_add_queue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ apply_new()

void SWC::Ranger::Blocks::apply_new ( int &  err,
CellStore::Writers w_cellstores,
CommitLog::Fragments::Vec fragments_old 
)

Definition at line 94 of file RangeBlocks.cc.

References cellstores, commitlog, m_mutex, SWC::Ranger::CommitLog::Fragments::remove(), SWC::Ranger::CellStore::Readers::replace(), SWC::Ranger::RangeData::save(), and wait_processing().

Referenced by SWC::Ranger::Range::apply_new().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cells_count()

size_t SWC::Ranger::Blocks::cells_count ( )

Definition at line 274 of file RangeBlocks.cc.

References m_block, m_mutex, and SWC::Ranger::Block::next.

◆ expand()

SWC_CAN_INLINE void SWC::Ranger::Blocks::expand ( DB::Cells::Interval intval)

Definition at line 83 of file RangeBlocks.cc.

References cellstores, commitlog, SWC::Ranger::CommitLog::Fragments::expand(), and SWC::Ranger::CellStore::Readers::expand().

Referenced by SWC::Ranger::Range::expand_and_align(), and SWC::Ranger::Range::load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ expand_and_align()

SWC_CAN_INLINE void SWC::Ranger::Blocks::expand_and_align ( DB::Cells::Interval intval)

Definition at line 89 of file RangeBlocks.cc.

References cellstores, commitlog, SWC::Ranger::CommitLog::Fragments::expand_and_align(), and SWC::Ranger::CellStore::Readers::expand_and_align().

Referenced by SWC::Ranger::Range::expand_and_align(), and SWC::Ranger::Range::load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init()

SWC_CAN_INLINE void SWC::Ranger::Blocks::init ( const RangePtr for_range)

Definition at line 20 of file RangeBlocks.cc.

References cellstores, commitlog, SWC::Ranger::CellStore::Readers::init(), SWC::Ranger::CommitLog::Fragments::init(), and range.

Referenced by SWC::Ranger::Range::init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_blocks()

void SWC::Ranger::Blocks::init_blocks ( int &  err)
private

Definition at line 471 of file RangeBlocks.cc.

References SWC::Ranger::Block::_add(), _clear(), SWC::Ranger::Block::_cond_key_end(), SWC::Ranger::Block::_free_key_end(), SWC::Ranger::Block::_set_key_end(), SWC::Ranger::Block::_set_prev_key_end(), cellstores, SWC::Condition::EQ, SWC::Ranger::CellStore::Readers::get_blocks(), m_block, m_blocks_idx, SWC::Ranger::Block::make(), SWC::Ranger::Block::next, ptr(), range, SWC::Error::RGR_NOT_LOADED_RANGE, and SWC::Core::Vector< T, SizeT, GROW_SZ >::size().

Referenced by scan().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load()

SWC_CAN_INLINE void SWC::Ranger::Blocks::load ( int &  err)

Definition at line 50 of file RangeBlocks.cc.

References cellstores, commitlog, SWC::Ranger::CellStore::Readers::load(), and SWC::Ranger::CommitLog::Fragments::load().

Referenced by SWC::Ranger::Range::load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator=()

Blocks& SWC::Ranger::Blocks::operator= ( const Blocks )
delete

◆ print()

void SWC::Ranger::Blocks::print ( std::ostream &  out,
bool  minimal 
)

Definition at line 403 of file RangeBlocks.cc.

References _processing(), _size(), _size_bytes(), cellstores, commitlog, m_block, m_mutex, SWC::Ranger::Block::next, SWC::Ranger::Block::print(), SWC::Ranger::CommitLog::Fragments::print(), and SWC::Ranger::CellStore::Readers::print().

Referenced by SWC::Ranger::Range::print().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ processing()

bool SWC::Ranger::Blocks::processing ( )
noexcept

Definition at line 371 of file RangeBlocks.cc.

References _processing(), m_mutex, SWC::Core::MutexSptd::try_full_lock(), and SWC::Core::MutexSptd::unlock().

Referenced by SWC::Ranger::Range::compact_possible(), and wait_processing().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ processing_decrement()

SWC_CAN_INLINE void SWC::Ranger::Blocks::processing_decrement ( )

Definition at line 45 of file RangeBlocks.cc.

References SWC::Core::Atomic< T, OrderT >::fetch_sub(), and m_processing.

Referenced by SWC::Ranger::Range::_run_add_queue(), SWC::Ranger::Range::_run_scan_queue(), SWC::Ranger::Block::_scan(), SWC::Ranger::Range::loaded(), SWC::Ranger::Block::loader_loaded(), release(), remove(), SWC::Ranger::Range::scan(), scan(), and unload().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ processing_increment()

SWC_CAN_INLINE void SWC::Ranger::Blocks::processing_increment ( )

Definition at line 40 of file RangeBlocks.cc.

References SWC::Core::Atomic< T, OrderT >::fetch_add(), and m_processing.

Referenced by SWC::Ranger::Range::_run_add_queue(), SWC::Ranger::Range::_run_scan_queue(), SWC::Ranger::Range::load(), release(), remove(), SWC::Ranger::Range::scan(), scan(), unload(), and SWC::Ranger::Range::wait().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ptr()

SWC_CAN_INLINE Blocks::Ptr SWC::Ranger::Blocks::ptr ( )

Definition at line 27 of file RangeBlocks.cc.

Referenced by init_blocks().

+ Here is the caller graph for this function:

◆ release() [1/2]

size_t SWC::Ranger::Blocks::release ( size_t  bytes)

Definition at line 299 of file RangeBlocks.cc.

References SWC::DB::Types::SystemColumn::is_data(), and range.

+ Here is the call graph for this function:

◆ release() [2/2]

size_t SWC::Ranger::Blocks::release ( size_t  bytes,
uint8_t  level 
)

◆ remove()

void SWC::Ranger::Blocks::remove ( int &  err)

Definition at line 68 of file RangeBlocks.cc.

References _clear(), cellstores, commitlog, m_mutex, processing_decrement(), processing_increment(), range, SWC::Ranger::CommitLog::Fragments::remove(), SWC::Ranger::CellStore::Readers::unload(), and wait_processing().

Referenced by SWC::Ranger::Range::internal_remove().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reset_blocks()

void SWC::Ranger::Blocks::reset_blocks ( )

Definition at line 366 of file RangeBlocks.cc.

References _clear(), and m_mutex.

+ Here is the call graph for this function:

◆ scan()

void SWC::Ranger::Blocks::scan ( ReqScan::Ptr  req,
Block::Ptr  blk_ptr = nullptr 
)

◆ schema_update()

void SWC::Ranger::Blocks::schema_update ( )

Definition at line 31 of file RangeBlocks.cc.

References commitlog, m_block, m_mutex, SWC::Ranger::Block::next, and SWC::Ranger::CommitLog::Fragments::schema_update().

Referenced by SWC::Ranger::Range::schema_update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ size()

size_t SWC::Ranger::Blocks::size ( )
noexcept

Definition at line 282 of file RangeBlocks.cc.

References _size(), and m_mutex.

+ Here is the call graph for this function:

◆ size_bytes()

size_t SWC::Ranger::Blocks::size_bytes ( )

Definition at line 287 of file RangeBlocks.cc.

References _size_bytes(), and m_mutex.

+ Here is the call graph for this function:

◆ size_bytes_total()

size_t SWC::Ranger::Blocks::size_bytes_total ( bool  only_loaded = false)

Definition at line 292 of file RangeBlocks.cc.

References _size_bytes(), cellstores, commitlog, m_mutex, SWC::Ranger::CommitLog::Fragments::size_bytes(), and SWC::Ranger::CellStore::Readers::size_bytes().

Referenced by SWC::Ranger::Range::internal_unload().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unload()

void SWC::Ranger::Blocks::unload ( )

Definition at line 55 of file RangeBlocks.cc.

References _clear(), cellstores, SWC::Ranger::CommitLog::Fragments::commit_finalize(), commitlog, m_mutex, processing_decrement(), processing_increment(), range, SWC::Ranger::CellStore::Readers::unload(), SWC::Ranger::CommitLog::Fragments::unload(), and wait_processing().

Referenced by SWC::Ranger::Range::internal_unload().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ wait_processing()

bool SWC::Ranger::Blocks::wait_processing ( int64_t  quit_time = 0)

Definition at line 381 of file RangeBlocks.cc.

References cellstores, commitlog, SWC::LOG_WARN, SWC::Time::now_ns(), SWC::Ranger::CellStore::Readers::processing(), SWC::Ranger::CommitLog::Fragments::processing(), processing(), range, SWC_FMT_LU, SWC_LOG_OSTREAM, SWC_LOG_OUT, and SWC_LOG_PRINTF.

Referenced by apply_new(), remove(), and unload().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ cellstores

◆ commitlog

◆ m_block

Block::Ptr SWC::Ranger::Blocks::m_block
private

◆ m_blocks_idx

Core::Vector<Block::Ptr> SWC::Ranger::Blocks::m_blocks_idx
private

Definition at line 113 of file RangeBlocks.h.

Referenced by _clear(), _narrow(), _split(), add_logged(), init_blocks(), and scan().

◆ m_mutex

◆ m_processing

Core::Atomic<size_t> SWC::Ranger::Blocks::m_processing
private

Definition at line 114 of file RangeBlocks.h.

Referenced by _processing(), processing_decrement(), processing_increment(), and release().

◆ MAX_IDX_NARROW

const uint8_t SWC::Ranger::Blocks::MAX_IDX_NARROW = 20
staticprivate

Definition at line 109 of file RangeBlocks.h.

Referenced by _narrow().

◆ range


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