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::client::Query::Update::Handlers::Common Class Reference

#include <swcdb/db/client/Query/Update/Handlers/Common.h>

+ Inheritance diagram for SWC::client::Query::Update::Handlers::Common:
+ Collaboration diagram for SWC::client::Query::Update::Handlers::Common:

Public Types

typedef std::shared_ptr< CommonPtr
 
typedef std::function< void(const Common::Ptr &)> Cb_t
 
- Public Types inherited from SWC::client::Query::Update::Handlers::BaseUnorderedMap
typedef std::shared_ptr< BaseUnorderedMapPtr
 
typedef std::unordered_map< cid_t, ColumnMutable::PtrMap
 
- Public Types inherited from SWC::client::Query::Update::Handlers::Base
typedef std::shared_ptr< BasePtr
 
typedef Core::Vector< Column * > Colms
 

Public Member Functions

 Common (const Clients::Ptr &clients, Cb_t &&cb, const Comm::IoContextPtr &io=nullptr, Clients::Flag executor=Clients::DEFAULT) noexcept
 
virtual ~Common () noexcept
 
virtual bool requires_commit () noexcept override
 
virtual bool valid () noexcept override
 
virtual void response (int err=Error::OK) override
 
void wait ()
 
bool wait_ahead_buffers (uint64_t from=0)
 
void commit_or_wait (Base::Column *colp=nullptr, uint64_t from=0)
 
void commit_if_need ()
 
virtual void error (cid_t cid, int err) noexcept=0
 
virtual int error () noexcept
 
virtual void error (int err) noexcept
 
- Public Member Functions inherited from SWC::client::Query::Update::Handlers::BaseUnorderedMap
SWC_CAN_INLINE BaseUnorderedMap (const Clients::Ptr &a_clients, Clients::Flag a_executor=Clients::DEFAULT) noexcept
 
virtual ~BaseUnorderedMap () noexcept
 
virtual bool empty () noexcept override
 
virtual size_t size_bytes () noexcept override
 
virtual void next (Base::Colms &cols) noexcept override
 
virtual Base::Columnnext (cid_t cid) noexcept override
 
virtual void error (cid_t cid, int err) noexcept override
 
SWC_CAN_INLINE ColumnMutable::Ptrcreate (const DB::Schema::Ptr &schema)
 
ColumnMutable::Ptrcreate (const cid_t cid, DB::Types::KeySeq seq, uint32_t versions, uint32_t ttl_secs, DB::Types::Column type)
 
bool exists (const cid_t cid) noexcept
 
void add (const cid_t cid, const DB::Cells::Cell &cell, bool finalized=false)
 
ColumnMutable::Ptr get (const cid_t cid) noexcept
 
Base::Columnget_base_ptr (cid_t cid) noexcept
 
size_t size () noexcept
 
- Public Member Functions inherited from SWC::client::Query::Update::Handlers::Base
SWC_CAN_INLINE Base (const Clients::Ptr &a_clients, Clients::Flag a_executor=Clients::Flag::DEFAULT) noexcept
 
 Base (Base &&)=delete
 
 Base (const Base &)=delete
 
Baseoperator= (const Base &)=delete
 
Baseoperator= (Base &&)=delete
 
virtual void error (int err) noexcept
 
SWC_CAN_INLINE void add_resend_count (size_t count) noexcept
 
SWC_CAN_INLINE size_t get_resend_count (bool reset=true) noexcept
 
void commit ()
 
SWC_CAN_INLINE void commit (const cid_t cid)
 
void commit (Column *colp)
 

Static Public Member Functions

static SWC_CAN_INLINE Ptr make (const Clients::Ptr &clients, Cb_t &&cb=nullptr, const Comm::IoContextPtr &io=nullptr, Clients::Flag executor=Clients::DEFAULT)
 

Public Attributes

Core::AtomicBool valid_state
 
- Public Attributes inherited from SWC::client::Query::Update::Handlers::Base
Clients::Ptr clients
 
Profiling profile
 
Core::Atomic< int > state_error
 
Core::CompletionCounter< uint64_t > completion
 
Core::Atomic< uint32_t > timeout
 
Core::Atomic< uint32_t > timeout_ratio
 
Core::Atomic< uint32_t > buff_sz
 
Core::Atomic< uint8_t > buff_ahead
 
const Clients::Flag executor
 

Private Attributes

const Cb_t m_cb
 
Comm::IoContextPtr m_dispatcher_io
 
std::mutex m_mutex
 
std::condition_variable m_cv
 

Additional Inherited Members

- Protected Member Functions inherited from SWC::client::Query::Update::Handlers::Base
virtual void _execute (Column *colp)
 
virtual ~Base () noexcept
 

Detailed Description

Definition at line 18 of file Common.h.

Member Typedef Documentation

◆ Cb_t

Definition at line 21 of file Common.h.

◆ Ptr

Definition at line 20 of file Common.h.

Constructor & Destructor Documentation

◆ Common()

SWC::client::Query::Update::Handlers::Common::Common ( const Clients::Ptr clients,
Cb_t &&  cb,
const Comm::IoContextPtr io = nullptr,
Clients::Flag  executor = Clients::DEFAULT 
)
noexcept

Definition at line 18 of file Common.cc.

Referenced by make().

+ Here is the caller graph for this function:

◆ ~Common()

virtual SWC::client::Query::Update::Handlers::Common::~Common ( )
inlinevirtualnoexcept

Definition at line 38 of file Common.h.

Member Function Documentation

◆ commit_if_need()

void SWC::client::Query::Update::Handlers::Common::commit_if_need ( )

Definition at line 112 of file Common.cc.

References SWC::client::Query::Update::Handlers::Base::commit(), SWC::client::Query::Update::Handlers::Base::completion, SWC::Core::CompletionCounter< CountT >::count(), and SWC::client::Query::Update::Handlers::BaseUnorderedMap::size_bytes().

+ Here is the call graph for this function:

◆ commit_or_wait()

void SWC::client::Query::Update::Handlers::Common::commit_or_wait ( Base::Column colp = nullptr,
uint64_t  from = 0 
)

Definition at line 107 of file Common.cc.

References SWC::client::Query::Update::Handlers::Base::commit(), SWC::Condition::from(), and wait_ahead_buffers().

+ Here is the call graph for this function:

◆ error() [1/3]

virtual int SWC::client::Query::Update::Handlers::Base::error
inlinevirtualnoexcept

◆ error() [2/3]

virtual void SWC::client::Query::Update::Handlers::Base::error
virtualnoexcept

Reimplemented from SWC::client::Query::Update::Handlers::Base.

Referenced by response().

+ Here is the caller graph for this function:

◆ error() [3/3]

virtual void SWC::client::Query::Update::Handlers::Base::error
inlinevirtualnoexcept

Reimplemented from SWC::client::Query::Update::Handlers::Base.

Definition at line 163 of file Base.h.

References SWC::Core::AtomicBase< T, OrderT >::compare_exchange_weak(), SWC::Error::OK, and SWC::client::Query::Update::Handlers::Base::state_error.

+ Here is the call graph for this function:

◆ make()

static SWC_CAN_INLINE Ptr SWC::client::Query::Update::Handlers::Common::make ( const Clients::Ptr clients,
Cb_t &&  cb = nullptr,
const Comm::IoContextPtr io = nullptr,
Clients::Flag  executor = Clients::DEFAULT 
)
inlinestatic

Definition at line 24 of file Common.h.

References SWC::client::Query::Update::Handlers::Base::clients, Common(), and SWC::client::Query::Update::Handlers::Base::executor.

Referenced by SWC::Manager::ColumnHealthCheck::ColumnMerger::RangesMerger::handle(), SWC::DB::RgrData::remove(), SWC::ThriftBroker::AppHandler::sql_update(), SWC::ThriftBroker::AppHandler::update_by_types(), SWC::ThriftBroker::AppHandler::update_counter(), SWC::Utils::LoadGenerator::update_data(), SWC::ThriftBroker::AppHandler::update_plain(), SWC::ThriftBroker::AppHandler::update_serial(), and SWC::ThriftBroker::AppHandler::updater_create().

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

◆ requires_commit()

bool SWC::client::Query::Update::Handlers::Common::requires_commit ( )
overridevirtualnoexcept

Reimplemented from SWC::client::Query::Update::Handlers::BaseUnorderedMap.

Definition at line 27 of file Common.cc.

References SWC::client::Query::Update::Handlers::BaseUnorderedMap::requires_commit(), and valid().

Referenced by response().

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

◆ response()

◆ valid()

bool SWC::client::Query::Update::Handlers::Common::valid ( )
overridevirtualnoexcept

Implements SWC::client::Query::Update::Handlers::Base.

Definition at line 31 of file Common.cc.

References valid_state.

Referenced by requires_commit().

+ Here is the caller graph for this function:

◆ wait()

void SWC::client::Query::Update::Handlers::Common::wait ( )

Definition at line 81 of file Common.cc.

References SWC::client::Query::Update::Handlers::Base::completion, SWC::Core::CompletionCounter< CountT >::count(), m_cv, and m_mutex.

+ Here is the call graph for this function:

◆ wait_ahead_buffers()

bool SWC::client::Query::Update::Handlers::Common::wait_ahead_buffers ( uint64_t  from = 0)

Definition at line 88 of file Common.cc.

References SWC::client::Query::Update::Handlers::Base::buff_ahead, SWC::client::Query::Update::Handlers::Base::buff_sz, SWC::client::Query::Update::Handlers::Base::completion, SWC::Core::CompletionCounter< CountT >::count(), SWC::Condition::from(), m_cv, m_mutex, and SWC::client::Query::Update::Handlers::BaseUnorderedMap::size_bytes().

Referenced by commit_or_wait().

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

Member Data Documentation

◆ m_cb

const Cb_t SWC::client::Query::Update::Handlers::Common::m_cb
private

Definition at line 57 of file Common.h.

Referenced by response().

◆ m_cv

std::condition_variable SWC::client::Query::Update::Handlers::Common::m_cv
private

Definition at line 60 of file Common.h.

Referenced by response(), wait(), and wait_ahead_buffers().

◆ m_dispatcher_io

Comm::IoContextPtr SWC::client::Query::Update::Handlers::Common::m_dispatcher_io
private

Definition at line 58 of file Common.h.

Referenced by response().

◆ m_mutex

std::mutex SWC::client::Query::Update::Handlers::Common::m_mutex
private

Definition at line 59 of file Common.h.

Referenced by response(), wait(), and wait_ahead_buffers().

◆ valid_state

Core::AtomicBool SWC::client::Query::Update::Handlers::Common::valid_state

Definition at line 32 of file Common.h.

Referenced by valid().


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