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::Comm::IoContext Class Referencefinal

#include <swcdb/core/comm/IoContext.h>

+ Inheritance diagram for SWC::Comm::IoContext:
+ Collaboration diagram for SWC::Comm::IoContext:

Public Types

typedef asio::thread_pool::executor_type Executor
 
typedef asio::executor_work_guard< ExecutorExecutorWorkGuard
 

Public Member Functions

 IoContext (std::string &&_name, int32_t size)
 
 ~IoContext () noexcept
 
SWC_CAN_INLINE int32_t get_size () const noexcept
 
SWC_CAN_INLINE Executor executor () noexcept
 
template<typename T_Handler >
SWC_CAN_INLINE void post (T_Handler &&handler)
 
void set_signals ()
 
void set_periodic_timer (const Config::Property::Value_int32_g::Ptr ms, PeriodicTimer::Call_t &&call)
 
void stop ()
 

Static Public Member Functions

static IoContextPtr make (std::string &&_name, int32_t size)
 
static SWC_CAN_INLINE uint32_t get_number_of_threads (bool relative, int32_t size) noexcept
 
static IoContextPtr make (std::string &&_name, bool relative, int32_t size)
 

Public Attributes

Core::AtomicBool running
 
const std::string name
 
asio::thread_pool pool
 
std::unique_ptr< asio::signal_set > signals
 

Private Attributes

int32_t m_size
 
PeriodicTimers m_periodic_timers
 

Detailed Description

Definition at line 35 of file IoContext.h.

Member Typedef Documentation

◆ Executor

typedef asio::thread_pool::executor_type SWC::Comm::IoContext::Executor

Definition at line 38 of file IoContext.h.

◆ ExecutorWorkGuard

typedef asio::executor_work_guard<Executor> SWC::Comm::IoContext::ExecutorWorkGuard

Definition at line 39 of file IoContext.h.

Constructor & Destructor Documentation

◆ IoContext()

SWC::Comm::IoContext::IoContext ( std::string &&  _name,
int32_t  size 
)

Definition at line 12 of file IoContext.cc.

References SWC::LOG_DEBUG, m_size, name, SWC_ASSERT, and SWC_LOGF.

Referenced by make().

+ Here is the caller graph for this function:

◆ ~IoContext()

SWC::Comm::IoContext::~IoContext ( )
inlinenoexcept

Definition at line 72 of file IoContext.h.

Member Function Documentation

◆ executor()

SWC_CAN_INLINE Executor SWC::Comm::IoContext::executor ( )
inlinenoexcept

Definition at line 80 of file IoContext.h.

References pool.

Referenced by set_signals(), and stop().

+ Here is the caller graph for this function:

◆ get_number_of_threads()

static SWC_CAN_INLINE uint32_t SWC::Comm::IoContext::get_number_of_threads ( bool  relative,
int32_t  size 
)
inlinestaticnoexcept

Definition at line 47 of file IoContext.h.

References size.

Referenced by SWC::FS::FileSystemHadoop::initialize(), and make().

+ Here is the caller graph for this function:

◆ get_size()

SWC_CAN_INLINE int32_t SWC::Comm::IoContext::get_size ( ) const
inlinenoexcept

Definition at line 75 of file IoContext.h.

References m_size.

◆ make() [1/2]

static IoContextPtr SWC::Comm::IoContext::make ( std::string &&  _name,
bool  relative,
int32_t  size 
)
inlinestatic

Definition at line 55 of file IoContext.h.

References get_number_of_threads(), IoContext(), and size.

+ Here is the call graph for this function:

◆ make() [2/2]

static IoContextPtr SWC::Comm::IoContext::make ( std::string &&  _name,
int32_t  size 
)
inlinestatic

Definition at line 41 of file IoContext.h.

References IoContext(), and size.

Referenced by SWC::Manager::AppContext::AppContext(), SWC::Broker::AppContext::make(), SWC::Ranger::AppContext::make(), run(), and SWC::Comm::server::SerializedServer::SerializedServer().

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

◆ post()

template<typename T_Handler >
SWC_CAN_INLINE void SWC::Comm::IoContext::post ( T_Handler &&  handler)
inline

Definition at line 89 of file IoContext.h.

References pool.

◆ set_periodic_timer()

void SWC::Comm::IoContext::set_periodic_timer ( const Config::Property::Value_int32_g::Ptr  ms,
PeriodicTimer::Call_t &&  call 
)

Definition at line 24 of file IoContext.cc.

References m_periodic_timers, and SWC::Comm::PeriodicTimers::set().

+ Here is the call graph for this function:

◆ set_signals()

void SWC::Comm::IoContext::set_signals ( )

Definition at line 20 of file IoContext.cc.

References executor(), and signals.

+ Here is the call graph for this function:

◆ stop()

void SWC::Comm::IoContext::stop ( )

Definition at line 30 of file IoContext.cc.

References executor(), SWC::LOG_DEBUG, m_periodic_timers, name, pool, running, SWC::Comm::PeriodicTimers::stop(), SWC::Core::AtomicBase< T, OrderT >::store(), and SWC_LOGF.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_periodic_timers

PeriodicTimers SWC::Comm::IoContext::m_periodic_timers
private

Definition at line 103 of file IoContext.h.

Referenced by set_periodic_timer(), and stop().

◆ m_size

int32_t SWC::Comm::IoContext::m_size
private

Definition at line 102 of file IoContext.h.

Referenced by get_size(), and IoContext().

◆ name

const std::string SWC::Comm::IoContext::name

Definition at line 65 of file IoContext.h.

Referenced by IoContext(), and stop().

◆ pool

asio::thread_pool SWC::Comm::IoContext::pool

Definition at line 66 of file IoContext.h.

Referenced by executor(), post(), and stop().

◆ running

Core::AtomicBool SWC::Comm::IoContext::running

Definition at line 64 of file IoContext.h.

Referenced by stop().

◆ signals

std::unique_ptr<asio::signal_set> SWC::Comm::IoContext::signals

Definition at line 67 of file IoContext.h.

Referenced by set_signals().


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