NCBI C++ ToolKit
|
Search Toolkit Book for CCassQueryList
#include <objtools/pubseq_gateway/impl/cassandra/cass_query_list.hpp>
Classes | |
class | CQryNotification |
struct | SPendingSlot |
struct | SQrySlot |
Public Member Functions | |
virtual | ~CCassQueryList () |
CCassQueryList & | SetMaxQueries (size_t max_queries) |
CCassQueryList & | SetKeyspace (const string &keyspace) |
CCassQueryList & | SetTickCB (TCassQueryListTickCB cb) |
string | GetKeyspace () const |
size_t | GetMaxQueries () const |
bool | HasError () const |
size_t | NumberOfActiveQueries () const |
size_t | NumberOfBusySlots () const |
size_t | NumberOfPendingSlots () const |
string | ToString () const |
void | Finalize () |
void | Cancel (const exception *e=nullptr) |
void | Cancel (ICassQueryListConsumer *consumer, const exception *e=nullptr) |
void | Execute (unique_ptr< ICassQueryListConsumer > consumer, int retry_count, bool post_async=false) |
bool | HasEmptySlot () |
void | Yield (bool wait) |
shared_ptr< CCassQuery > | Extract (size_t slot_index) |
Static Public Member Functions | |
static shared_ptr< CCassQueryList > | Create (shared_ptr< CCassConnection > cass_conn) noexcept |
Static Public Attributes | |
static constexpr const unsigned int | kDfltMaxQuery = 128 |
static constexpr const uint64_t | kReadyPushWaitTimeout = 500000 |
static constexpr const uint64_t | kReadyPopWaitTimeout = 500 |
static constexpr const size_t | kNotifyQueueLen = 2048 |
static constexpr const unsigned int | kResetRelaxTime = 10 |
Protected Member Functions | |
CCassQueryList () | |
Private Types | |
enum | SQrySlotState { ssAvailable , ssAttached , ssReadingRow , ssReseting , ssReleasing , ssLast = ssReleasing + 1 } |
Private Member Functions | |
void | Tick () |
SQrySlot * | CheckSlots (bool discard, bool wait=true) |
SQrySlot * | CheckSlot (size_t index, bool discard) |
void | CheckPending (SQrySlot *slot) |
void | AttachSlot (SQrySlot *slot, SPendingSlot &&pending_slot) |
void | DetachSlot (SQrySlot *slot) |
void | ReadRows (SQrySlot *slot) |
void | Release (SQrySlot *slot) |
void | CheckAccess () |
Private Attributes | |
weak_ptr< CCassQueryList > | m_self_weak |
shared_ptr< CCassConnection > | m_cass_conn |
vector< SQrySlot > | m_query_arr |
mpmc_bounded_queue_w< size_t, kNotifyQueueLen > | m_ready |
bool | m_has_error |
size_t | m_max_queries |
vector< SPendingSlot > | m_pending_arr |
vector< shared_ptr< CQryNotification > > | m_notification_arr |
TCassQueryListTickCB | m_tick_cb |
atomic_bool | m_yield_in_progress |
string | m_keyspace |
atomic_size_t | m_attached_slots |
atomic< thread::id > | m_owning_thread |
Static Private Attributes | |
static string | SQrySlotStateStr [ssLast] = {"ssAvailable", "ssAttached", "ssReadingRow", "ssReseting", "ssReleasing"} |
CCassQueryList. More... | |
Definition at line 35 of file cass_query_list.hpp.
|
private |
Enumerator | |
---|---|
ssAvailable | |
ssAttached | |
ssReadingRow | |
ssReseting | |
ssReleasing | |
ssLast |
Definition at line 72 of file cass_query_list.hpp.
|
virtual |
Definition at line 76 of file cass_query_list.cpp.
References Cancel(), ERR_POST, Error(), m_notification_arr, m_pending_arr, m_query_arr, NumberOfActiveQueries(), NumberOfBusySlots(), and NumberOfPendingSlots().
|
inlineprotected |
Definition at line 64 of file cass_query_list.hpp.
|
private |
Definition at line 238 of file cass_query_list.cpp.
References assert, b, CheckPending(), DetachSlot(), ERR_POST, Info(), m_attached_slots, m_cass_conn, CCassQueryList::SQrySlot::m_consumer, CCassQueryList::SQrySlot::m_index, m_notification_arr, CCassQueryList::SQrySlot::m_qry, CCassQueryList::SQrySlot::m_retry_count, CCassQueryList::SQrySlot::m_state, ssAttached, ssAvailable, and Tick().
Referenced by CheckPending(), and Execute().
Definition at line 390 of file cass_query_list.cpp.
References CheckAccess(), DetachSlot(), i, m_has_error, m_pending_arr, m_query_arr, ssAvailable, and Tick().
Referenced by ~CCassQueryList().
void CCassQueryList::Cancel | ( | ICassQueryListConsumer * | consumer, |
const exception * | e = nullptr |
||
) |
Definition at line 361 of file cass_query_list.cpp.
References CheckAccess(), DetachSlot(), i, m_has_error, m_pending_arr, m_query_arr, ssAvailable, and Tick().
|
private |
Definition at line 157 of file cass_query_list.cpp.
References m_owning_thread, and NCBI_THROW.
Referenced by Cancel(), Execute(), Finalize(), and Yield().
|
private |
Definition at line 268 of file cass_query_list.cpp.
References assert, AttachSlot(), m_pending_arr, CCassQueryList::SQrySlot::m_state, and ssAvailable.
Referenced by AttachSlot(), Finalize(), Release(), and Yield().
|
private |
Definition at line 468 of file cass_query_list.cpp.
References ar_dataready, ar_done, assert, DetachSlot(), CCassandraException::eQueryFailedRestartable, CCassandraException::eQueryTimeout, ERR_POST, Error(), CException::GetErrCode(), kResetRelaxTime, CCassQueryList::SQrySlot::m_consumer, m_has_error, CCassQueryList::SQrySlot::m_index, CCassQueryList::SQrySlot::m_qry, m_query_arr, CCassQueryList::SQrySlot::m_retry_count, CCassQueryList::SQrySlot::m_state, NCBI_THROW, ReadRows(), Release(), SSignalHandler::s_CtrlCPressed(), ssAttached, ssAvailable, ssReleasing, ssReseting, Warning(), and CException::what().
Referenced by CheckSlots(), and Yield().
|
private |
Definition at line 437 of file cass_query_list.cpp.
References CheckSlot(), m_query_arr, m_ready, CCassQueryList::SQrySlot::m_state, mpmc_bounded_queue_w< T, SZ >::pop_wait(), ssAvailable, and Yield().
Referenced by Execute(), Finalize(), HasEmptySlot(), and Yield().
|
staticnoexcept |
Definition at line 67 of file cass_query_list.cpp.
|
private |
Definition at line 226 of file cass_query_list.cpp.
References assert, m_attached_slots, CCassQueryList::SQrySlot::m_consumer, CCassQueryList::SQrySlot::m_qry, CCassQueryList::SQrySlot::m_state, and ssAvailable.
Referenced by AttachSlot(), Cancel(), CheckSlot(), and Release().
void CCassQueryList::Execute | ( | unique_ptr< ICassQueryListConsumer > | consumer, |
int | retry_count, | ||
bool | post_async = false |
||
) |
Definition at line 166 of file cass_query_list.cpp.
References AttachSlot(), CheckAccess(), CheckSlots(), m_max_queries, m_notification_arr, m_pending_arr, m_query_arr, SetMaxQueries(), ssAvailable, and Tick().
shared_ptr< CCassQuery > CCassQueryList::Extract | ( | size_t | slot_index | ) |
Definition at line 350 of file cass_query_list.cpp.
References m_query_arr, and Release().
void CCassQueryList::Finalize | ( | void | ) |
Definition at line 409 of file cass_query_list.cpp.
References CheckAccess(), CheckPending(), CheckSlots(), m_pending_arr, m_query_arr, NCBI_THROW, SSignalHandler::s_CtrlCPressed(), and Tick().
string CCassQueryList::GetKeyspace | ( | ) | const |
Definition at line 104 of file cass_query_list.cpp.
References m_keyspace.
size_t CCassQueryList::GetMaxQueries | ( | ) | const |
Definition at line 118 of file cass_query_list.cpp.
References m_max_queries.
bool CCassQueryList::HasEmptySlot | ( | ) |
Definition at line 193 of file cass_query_list.cpp.
References CheckSlots(), and m_query_arr.
bool CCassQueryList::HasError | ( | ) | const |
Definition at line 122 of file cass_query_list.cpp.
References m_has_error.
size_t CCassQueryList::NumberOfActiveQueries | ( | ) | const |
Definition at line 131 of file cass_query_list.cpp.
References m_query_arr, ssAvailable, and ssReleasing.
Referenced by ~CCassQueryList().
size_t CCassQueryList::NumberOfBusySlots | ( | ) | const |
Definition at line 140 of file cass_query_list.cpp.
References m_attached_slots.
Referenced by ~CCassQueryList().
size_t CCassQueryList::NumberOfPendingSlots | ( | ) | const |
Definition at line 144 of file cass_query_list.cpp.
References m_pending_arr.
Referenced by ~CCassQueryList().
|
private |
Definition at line 298 of file cass_query_list.cpp.
References ar_dataready, ar_done, ar_wait, assert, CCassQueryList::SQrySlot::m_consumer, CCassQueryList::SQrySlot::m_index, CCassQueryList::SQrySlot::m_qry, CCassQueryList::SQrySlot::m_state, NCBI_THROW, Release(), ssAttached, ssAvailable, ssReadingRow, and ssReleasing.
Referenced by CheckSlot().
|
private |
Definition at line 277 of file cass_query_list.cpp.
References assert, CheckPending(), DetachSlot(), CCassQueryList::SQrySlot::m_consumer, CCassQueryList::SQrySlot::m_index, CCassQueryList::SQrySlot::m_qry, CCassQueryList::SQrySlot::m_state, ssAttached, ssAvailable, and ssReleasing.
Referenced by CheckSlot(), Extract(), and ReadRows().
CCassQueryList & CCassQueryList::SetKeyspace | ( | const string & | keyspace | ) |
Definition at line 108 of file cass_query_list.cpp.
References m_keyspace.
CCassQueryList & CCassQueryList::SetMaxQueries | ( | size_t | max_queries | ) |
Definition at line 92 of file cass_query_list.cpp.
References m_max_queries, m_notification_arr, and m_self_weak.
Referenced by Execute().
CCassQueryList & CCassQueryList::SetTickCB | ( | TCassQueryListTickCB | cb | ) |
Definition at line 113 of file cass_query_list.cpp.
References m_tick_cb.
|
private |
Definition at line 126 of file cass_query_list.cpp.
References m_tick_cb.
Referenced by AttachSlot(), Cancel(), Execute(), and Finalize().
string CCassQueryList::ToString | ( | void | ) | const |
Definition at line 148 of file cass_query_list.cpp.
References i, CCassQueryList::SQrySlot::m_qry, m_query_arr, CCassQueryList::SQrySlot::m_state, SQrySlotStateStr, and ssLast.
void CCassQueryList::Yield | ( | bool | wait | ) |
Definition at line 200 of file cass_query_list.cpp.
References CheckAccess(), CheckPending(), CheckSlot(), CheckSlots(), expected, kReadyPopWaitTimeout, m_pending_arr, m_ready, m_yield_in_progress, max(), and mpmc_bounded_queue_w< T, SZ >::pop_wait().
Referenced by CheckSlots().
Definition at line 37 of file cass_query_list.hpp.
|
staticconstexpr |
Definition at line 40 of file cass_query_list.hpp.
Definition at line 39 of file cass_query_list.hpp.
Referenced by Yield().
Definition at line 38 of file cass_query_list.hpp.
Referenced by CCassQueryList::CQryNotification::OnData().
Definition at line 41 of file cass_query_list.hpp.
Referenced by CheckSlot().
|
private |
Definition at line 122 of file cass_query_list.hpp.
Referenced by AttachSlot(), DetachSlot(), and NumberOfBusySlots().
|
private |
Definition at line 112 of file cass_query_list.hpp.
Referenced by AttachSlot().
|
private |
Definition at line 115 of file cass_query_list.hpp.
Referenced by Cancel(), CheckSlot(), and HasError().
|
private |
Definition at line 121 of file cass_query_list.hpp.
Referenced by GetKeyspace(), and SetKeyspace().
|
private |
Definition at line 116 of file cass_query_list.hpp.
Referenced by Execute(), GetMaxQueries(), and SetMaxQueries().
|
private |
Definition at line 118 of file cass_query_list.hpp.
Referenced by AttachSlot(), Execute(), SetMaxQueries(), and ~CCassQueryList().
|
private |
Definition at line 123 of file cass_query_list.hpp.
Referenced by CheckAccess().
|
private |
Definition at line 117 of file cass_query_list.hpp.
Referenced by Cancel(), CheckPending(), Execute(), Finalize(), NumberOfPendingSlots(), Yield(), and ~CCassQueryList().
|
private |
Definition at line 113 of file cass_query_list.hpp.
Referenced by Cancel(), CheckSlot(), CheckSlots(), Execute(), Extract(), Finalize(), HasEmptySlot(), NumberOfActiveQueries(), ToString(), and ~CCassQueryList().
|
private |
Definition at line 114 of file cass_query_list.hpp.
Referenced by CheckSlots(), and Yield().
|
private |
Definition at line 111 of file cass_query_list.hpp.
Referenced by SetMaxQueries().
|
private |
Definition at line 119 of file cass_query_list.hpp.
Referenced by SetTickCB(), and Tick().
|
private |
Definition at line 120 of file cass_query_list.hpp.
Referenced by Yield().
|
staticprivate |