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::CellStore::Block::Read Class Referencefinal

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

+ Collaboration diagram for SWC::Ranger::CellStore::Block::Read:

Public Types

enum  State : uint8_t {
  NONE,
  LOADING,
  LOADED
}
 
typedef ReadPtr
 

Public Member Functions

 Read (Header &&header) noexcept
 
void init (CellStore::Read *cellstore) noexcept
 
 Read (const Read &)=delete
 
 Read (const Read &&)=delete
 
Readoperator= (const Read &)=delete
 
 ~Read () noexcept
 
bool load (BlockLoader *loader)
 
void load ()
 
void load_cells (int &err, Ranger::Block::Ptr cells_block)
 
void processing_decrement () noexcept
 
size_t release ()
 
bool processing () noexcept
 
bool loaded () const noexcept
 
bool loaded (int &err) noexcept
 
size_t size_bytes (bool only_loaded=false) const noexcept
 
size_t size_bytes_enc (bool only_loaded=false) const noexcept
 
void print (std::ostream &out)
 

Static Public Member Functions

static const char *SWC_CONST_FUNC to_string (const State state) noexcept
 
static void load_header (int &err, FS::SmartFd::Ptr &smartfd, Header &header)
 

Public Attributes

const Header header
 
CellStore::Readcellstore
 

Private Member Functions

void load_open (int err)
 
void load_read (int err, StaticBuffer &&buffer)
 
void load_finish (int err)
 

Private Attributes

Core::MutexSptd m_mutex
 
Core::Atomic< Statem_state
 
int m_err
 
Core::Atomic< uint32_t > m_cells_remain
 
Core::Atomic< size_t > m_processing
 
StaticBuffer m_buffer
 
std::queue< BlockLoader * > m_queue
 

Detailed Description

Definition at line 28 of file CellStoreBlock.h.

Member Typedef Documentation

◆ Ptr

Definition at line 30 of file CellStoreBlock.h.

Member Enumeration Documentation

◆ State

Enumerator
NONE 
LOADING 
LOADED 

Definition at line 32 of file CellStoreBlock.h.

Constructor & Destructor Documentation

◆ Read() [1/3]

SWC_CAN_INLINE SWC::Ranger::CellStore::Block::Read::Read ( Header &&  header)
explicitnoexcept

Definition at line 79 of file CellStoreBlock.cc.

◆ Read() [2/3]

SWC::Ranger::CellStore::Block::Read::Read ( const Read )
delete

◆ Read() [3/3]

SWC::Ranger::CellStore::Block::Read::Read ( const Read &&  )
delete

◆ ~Read()

SWC::Ranger::CellStore::Block::Read::~Read ( )
noexcept

Definition at line 92 of file CellStoreBlock.cc.

References header, SWC::System::Resources::less_mem_releasable(), m_state, SWC::Env::Rgr::res(), and SWC::Ranger::CellStore::Block::Header::size_plain.

+ Here is the call graph for this function:

Member Function Documentation

◆ init()

SWC_CAN_INLINE void SWC::Ranger::CellStore::Block::Read::init ( CellStore::Read cellstore)
noexcept

Definition at line 88 of file CellStoreBlock.cc.

◆ load() [1/2]

SWC_CAN_INLINE void SWC::Ranger::CellStore::Block::Read::load ( )

Definition at line 129 of file CellStoreBlock.cc.

References load_open(), SWC::Error::OK, SWC::Env::Rgr::post(), and SWC_CAN_INLINE.

+ Here is the call graph for this function:

◆ load() [2/2]

SWC_CAN_INLINE bool SWC::Ranger::CellStore::Block::Read::load ( BlockLoader loader)

Definition at line 105 of file CellStoreBlock.cc.

References SWC::Core::AtomicBase< T, OrderT >::compare_exchange_weak(), SWC::Core::Atomic< T, OrderT >::fetch_add(), header, SWC::Ranger::BlockLoader::loaded(), SWC::DB::Types::MngrColumn::LOADING, m_mutex, m_processing, m_queue, m_state, SWC::System::Resources::more_mem_future(), SWC::System::Resources::more_mem_releasable(), SWC::Condition::NONE, SWC::Env::Rgr::res(), and SWC::Ranger::CellStore::Block::Header::size_plain.

Referenced by SWC::Ranger::CellStore::Read::_run_queued().

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

◆ load_cells()

◆ load_finish()

void SWC::Ranger::CellStore::Block::Read::load_finish ( int  err)
private

Definition at line 320 of file CellStoreBlock.cc.

References SWC::Ranger::CellStore::Read::_run_queued(), cellstore, SWC::Core::Buffer< T >::free(), SWC::Error::FS_PATH_NOT_FOUND, header, SWC::System::Resources::less_mem_future(), SWC::System::Resources::less_mem_releasable(), SWC::LOG_ERROR, m_buffer, m_err, m_mutex, m_queue, m_state, SWC::Condition::NONE, SWC::Error::OK, SWC::Env::Rgr::post(), print(), SWC::Error::print(), SWC::Env::Rgr::res(), SWC::Ranger::CellStore::Block::Header::size_plain, SWC::Ranger::CellStore::Read::smartfd, SWC::Core::AtomicBase< T, OrderT >::store(), SWC_CAN_INLINE, SWC_LOG_OSTREAM, and SWC_LOG_OUT.

Referenced by load_open(), and load_read().

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

◆ load_header()

void SWC::Ranger::CellStore::Block::Read::load_header ( int &  err,
FS::SmartFd::Ptr smartfd,
Header header 
)
static

◆ load_open()

void SWC::Ranger::CellStore::Block::Read::load_open ( int  err)
private

Definition at line 235 of file CellStoreBlock.cc.

References cellstore, SWC::Env::FsInterface::fs(), SWC::Error::FS_PATH_NOT_FOUND, header, SWC::Env::FsInterface::interface(), load_finish(), load_read(), SWC::LOG_WARN, SWC::Ranger::CellStore::Block::Header::offset_data, SWC::Error::OK, operator=(), SWC::Env::Rgr::post(), print(), SWC::Error::print(), SWC::Error::SERVER_SHUTTING_DOWN, SWC::Ranger::CellStore::Block::Header::size_enc, SWC::Ranger::CellStore::Read::smartfd, SWC_CAN_INLINE, SWC_LOG_OSTREAM, and SWC_LOG_OUT.

Referenced by load(), and load_read().

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

◆ load_read()

void SWC::Ranger::CellStore::Block::Read::load_read ( int  err,
StaticBuffer &&  buffer 
)
private

Definition at line 292 of file CellStoreBlock.cc.

References SWC::Core::Buffer< T >::base, SWC::Ranger::CellStore::Block::Header::checksum_data, SWC::Core::checksum_i32_chk(), SWC::Error::CHECKSUM_MISMATCH, SWC::Core::Encoder::decode(), SWC::Ranger::CellStore::Block::Header::encoder, SWC::Error::FS_EOF, header, load_finish(), load_open(), m_buffer, SWC::Error::OK, SWC::Core::Buffer< T >::set(), SWC::Ranger::CellStore::Block::Header::size_enc, and SWC::Ranger::CellStore::Block::Header::size_plain.

Referenced by load_open().

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

◆ loaded() [1/2]

SWC_CAN_INLINE bool SWC::Ranger::CellStore::Block::Read::loaded ( ) const
noexcept

Definition at line 201 of file CellStoreBlock.cc.

References m_state.

Referenced by release().

+ Here is the caller graph for this function:

◆ loaded() [2/2]

SWC_CAN_INLINE bool SWC::Ranger::CellStore::Block::Read::loaded ( int &  err)
noexcept

Definition at line 206 of file CellStoreBlock.cc.

◆ operator=()

Read& SWC::Ranger::CellStore::Block::Read::operator= ( const Read )
delete

Referenced by load_open().

+ Here is the caller graph for this function:

◆ print()

void SWC::Ranger::CellStore::Block::Read::print ( std::ostream &  out)

Definition at line 221 of file CellStoreBlock.cc.

References header, SWC::Core::AtomicBase< T, OrderT >::load(), m_err, m_mutex, m_processing, m_queue, m_state, SWC::Ranger::CellStore::Block::Header::print(), SWC::Error::print(), and to_string().

Referenced by load_finish(), and load_open().

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

◆ processing()

SWC_CAN_INLINE bool SWC::Ranger::CellStore::Block::Read::processing ( )
noexcept

Definition at line 185 of file CellStoreBlock.cc.

References SWC::DB::Types::MngrColumn::LOADING, m_mutex, m_processing, m_queue, m_state, SWC::Core::MutexSptd::try_full_lock(), and SWC::Core::MutexSptd::unlock().

+ Here is the call graph for this function:

◆ processing_decrement()

SWC_CAN_INLINE void SWC::Ranger::CellStore::Block::Read::processing_decrement ( )
noexcept

Definition at line 160 of file CellStoreBlock.cc.

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

+ Here is the call graph for this function:

◆ release()

SWC_CAN_INLINE size_t SWC::Ranger::CellStore::Block::Read::release ( )

Definition at line 165 of file CellStoreBlock.cc.

References SWC::Ranger::CellStore::Block::Header::cells_count, SWC::Core::AtomicBase< T, OrderT >::compare_exchange_weak(), SWC::Core::Buffer< T >::free(), header, SWC::System::Resources::less_mem_releasable(), loaded(), m_buffer, m_cells_remain, m_mutex, m_processing, m_queue, m_state, SWC::Condition::NONE, SWC::Env::Rgr::res(), SWC::Ranger::CellStore::Block::Header::size_plain, SWC::Core::AtomicBase< T, OrderT >::store(), SWC::Core::MutexSptd::try_full_lock(), and SWC::Core::MutexSptd::unlock().

Referenced by load_cells().

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

◆ size_bytes()

SWC_CAN_INLINE size_t SWC::Ranger::CellStore::Block::Read::size_bytes ( bool  only_loaded = false) const
noexcept

Definition at line 212 of file CellStoreBlock.cc.

◆ size_bytes_enc()

SWC_CAN_INLINE size_t SWC::Ranger::CellStore::Block::Read::size_bytes_enc ( bool  only_loaded = false) const
noexcept

Definition at line 217 of file CellStoreBlock.cc.

◆ to_string()

const char * SWC::Ranger::CellStore::Block::Read::to_string ( const State  state)
staticnoexcept

Definition at line 14 of file CellStoreBlock.cc.

References SWC::DB::Types::MngrColumn::LOADING.

Referenced by print().

+ Here is the caller graph for this function:

Member Data Documentation

◆ cellstore

CellStore::Read* SWC::Ranger::CellStore::Block::Read::cellstore

Definition at line 50 of file CellStoreBlock.h.

Referenced by load_cells(), load_finish(), and load_open().

◆ header

const Header SWC::Ranger::CellStore::Block::Read::header

◆ m_buffer

StaticBuffer SWC::Ranger::CellStore::Block::Read::m_buffer
private

Definition at line 102 of file CellStoreBlock.h.

Referenced by load_cells(), load_finish(), load_read(), and release().

◆ m_cells_remain

Core::Atomic<uint32_t> SWC::Ranger::CellStore::Block::Read::m_cells_remain
private

Definition at line 100 of file CellStoreBlock.h.

Referenced by load_cells(), and release().

◆ m_err

int SWC::Ranger::CellStore::Block::Read::m_err
private

Definition at line 99 of file CellStoreBlock.h.

Referenced by load_finish(), and print().

◆ m_mutex

Core::MutexSptd SWC::Ranger::CellStore::Block::Read::m_mutex
private

Definition at line 97 of file CellStoreBlock.h.

Referenced by load(), load_finish(), print(), processing(), and release().

◆ m_processing

Core::Atomic<size_t> SWC::Ranger::CellStore::Block::Read::m_processing
private

Definition at line 101 of file CellStoreBlock.h.

Referenced by load(), load_cells(), print(), processing(), processing_decrement(), and release().

◆ m_queue

std::queue<BlockLoader*> SWC::Ranger::CellStore::Block::Read::m_queue
private

Definition at line 103 of file CellStoreBlock.h.

Referenced by load(), load_finish(), print(), processing(), and release().

◆ m_state

Core::Atomic<State> SWC::Ranger::CellStore::Block::Read::m_state
private

Definition at line 98 of file CellStoreBlock.h.

Referenced by load(), load_finish(), loaded(), print(), processing(), release(), and ~Read().


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