NCBI C++ ToolKit
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
CCassQueryList Class Reference

Search Toolkit Book for CCassQueryList

#include <objtools/pubseq_gateway/impl/cassandra/cass_query_list.hpp>

+ Collaboration diagram for CCassQueryList:

Classes

class  CQryNotification
 
struct  SPendingSlot
 
struct  SQrySlot
 

Public Member Functions

virtual ~CCassQueryList ()
 
CCassQueryListSetMaxQueries (size_t max_queries)
 
CCassQueryListSetKeyspace (const string &keyspace)
 
CCassQueryListSetTickCB (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< CCassQueryExtract (size_t slot_index)
 

Static Public Member Functions

static shared_ptr< CCassQueryListCreate (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 ()
 
SQrySlotCheckSlots (bool discard, bool wait=true)
 
SQrySlotCheckSlot (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< CCassQueryListm_self_weak
 
shared_ptr< CCassConnectionm_cass_conn
 
vector< SQrySlotm_query_arr
 
mpmc_bounded_queue_w< size_t, kNotifyQueueLenm_ready
 
bool m_has_error
 
size_t m_max_queries
 
vector< SPendingSlotm_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...
 

Detailed Description

Definition at line 35 of file cass_query_list.hpp.

Member Enumeration Documentation

◆ SQrySlotState

Enumerator
ssAvailable 
ssAttached 
ssReadingRow 
ssReseting 
ssReleasing 
ssLast 

Definition at line 72 of file cass_query_list.hpp.

Constructor & Destructor Documentation

◆ ~CCassQueryList()

CCassQueryList::~CCassQueryList ( )
virtual

◆ CCassQueryList()

CCassQueryList::CCassQueryList ( )
inlineprotected

Definition at line 64 of file cass_query_list.hpp.

Member Function Documentation

◆ AttachSlot()

void CCassQueryList::AttachSlot ( SQrySlot slot,
SPendingSlot &&  pending_slot 
)
private

◆ Cancel() [1/2]

void CCassQueryList::Cancel ( const exception *  e = nullptr)

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().

◆ Cancel() [2/2]

void CCassQueryList::Cancel ( ICassQueryListConsumer consumer,
const exception *  e = nullptr 
)

◆ CheckAccess()

void CCassQueryList::CheckAccess ( )
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().

◆ CheckPending()

void CCassQueryList::CheckPending ( SQrySlot slot)
private

◆ CheckSlot()

CCassQueryList::SQrySlot * CCassQueryList::CheckSlot ( size_t  index,
bool  discard 
)
private

◆ CheckSlots()

CCassQueryList::SQrySlot * CCassQueryList::CheckSlots ( bool  discard,
bool  wait = true 
)
private

◆ Create()

shared_ptr< CCassQueryList > CCassQueryList::Create ( shared_ptr< CCassConnection cass_conn)
staticnoexcept

Definition at line 67 of file cass_query_list.cpp.

◆ DetachSlot()

void CCassQueryList::DetachSlot ( SQrySlot slot)
private

◆ Execute()

void CCassQueryList::Execute ( unique_ptr< ICassQueryListConsumer consumer,
int  retry_count,
bool  post_async = false 
)

◆ Extract()

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().

◆ Finalize()

void CCassQueryList::Finalize ( void  )

◆ GetKeyspace()

string CCassQueryList::GetKeyspace ( ) const

Definition at line 104 of file cass_query_list.cpp.

References m_keyspace.

◆ GetMaxQueries()

size_t CCassQueryList::GetMaxQueries ( ) const

Definition at line 118 of file cass_query_list.cpp.

References m_max_queries.

◆ HasEmptySlot()

bool CCassQueryList::HasEmptySlot ( )

Definition at line 193 of file cass_query_list.cpp.

References CheckSlots(), and m_query_arr.

◆ HasError()

bool CCassQueryList::HasError ( ) const

Definition at line 122 of file cass_query_list.cpp.

References m_has_error.

◆ NumberOfActiveQueries()

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().

◆ NumberOfBusySlots()

size_t CCassQueryList::NumberOfBusySlots ( ) const

Definition at line 140 of file cass_query_list.cpp.

References m_attached_slots.

Referenced by ~CCassQueryList().

◆ NumberOfPendingSlots()

size_t CCassQueryList::NumberOfPendingSlots ( ) const

Definition at line 144 of file cass_query_list.cpp.

References m_pending_arr.

Referenced by ~CCassQueryList().

◆ ReadRows()

void CCassQueryList::ReadRows ( SQrySlot slot)
private

◆ Release()

void CCassQueryList::Release ( SQrySlot slot)
private

◆ SetKeyspace()

CCassQueryList & CCassQueryList::SetKeyspace ( const string keyspace)

Definition at line 108 of file cass_query_list.cpp.

References m_keyspace.

◆ SetMaxQueries()

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().

◆ SetTickCB()

CCassQueryList & CCassQueryList::SetTickCB ( TCassQueryListTickCB  cb)

Definition at line 113 of file cass_query_list.cpp.

References m_tick_cb.

◆ Tick()

void CCassQueryList::Tick ( )
private

Definition at line 126 of file cass_query_list.cpp.

References m_tick_cb.

Referenced by AttachSlot(), Cancel(), Execute(), and Finalize().

◆ ToString()

string CCassQueryList::ToString ( void  ) const

◆ Yield()

void CCassQueryList::Yield ( bool  wait)

Member Data Documentation

◆ kDfltMaxQuery

constexpr const unsigned int CCassQueryList::kDfltMaxQuery = 128
staticconstexpr

Definition at line 37 of file cass_query_list.hpp.

◆ kNotifyQueueLen

constexpr const size_t CCassQueryList::kNotifyQueueLen = 2048
staticconstexpr

Definition at line 40 of file cass_query_list.hpp.

◆ kReadyPopWaitTimeout

constexpr const uint64_t CCassQueryList::kReadyPopWaitTimeout = 500
staticconstexpr

Definition at line 39 of file cass_query_list.hpp.

Referenced by Yield().

◆ kReadyPushWaitTimeout

constexpr const uint64_t CCassQueryList::kReadyPushWaitTimeout = 500000
staticconstexpr

Definition at line 38 of file cass_query_list.hpp.

Referenced by CCassQueryList::CQryNotification::OnData().

◆ kResetRelaxTime

constexpr const unsigned int CCassQueryList::kResetRelaxTime = 10
staticconstexpr

Definition at line 41 of file cass_query_list.hpp.

Referenced by CheckSlot().

◆ m_attached_slots

atomic_size_t CCassQueryList::m_attached_slots
private

Definition at line 122 of file cass_query_list.hpp.

Referenced by AttachSlot(), DetachSlot(), and NumberOfBusySlots().

◆ m_cass_conn

shared_ptr<CCassConnection> CCassQueryList::m_cass_conn
private

Definition at line 112 of file cass_query_list.hpp.

Referenced by AttachSlot().

◆ m_has_error

bool CCassQueryList::m_has_error
private

Definition at line 115 of file cass_query_list.hpp.

Referenced by Cancel(), CheckSlot(), and HasError().

◆ m_keyspace

string CCassQueryList::m_keyspace
private

Definition at line 121 of file cass_query_list.hpp.

Referenced by GetKeyspace(), and SetKeyspace().

◆ m_max_queries

size_t CCassQueryList::m_max_queries
private

Definition at line 116 of file cass_query_list.hpp.

Referenced by Execute(), GetMaxQueries(), and SetMaxQueries().

◆ m_notification_arr

vector<shared_ptr<CQryNotification> > CCassQueryList::m_notification_arr
private

Definition at line 118 of file cass_query_list.hpp.

Referenced by AttachSlot(), Execute(), SetMaxQueries(), and ~CCassQueryList().

◆ m_owning_thread

atomic<thread::id> CCassQueryList::m_owning_thread
private

Definition at line 123 of file cass_query_list.hpp.

Referenced by CheckAccess().

◆ m_pending_arr

vector<SPendingSlot> CCassQueryList::m_pending_arr
private

◆ m_query_arr

vector<SQrySlot> CCassQueryList::m_query_arr
private

◆ m_ready

mpmc_bounded_queue_w<size_t, kNotifyQueueLen> CCassQueryList::m_ready
private

Definition at line 114 of file cass_query_list.hpp.

Referenced by CheckSlots(), and Yield().

◆ m_self_weak

weak_ptr<CCassQueryList> CCassQueryList::m_self_weak
private

Definition at line 111 of file cass_query_list.hpp.

Referenced by SetMaxQueries().

◆ m_tick_cb

TCassQueryListTickCB CCassQueryList::m_tick_cb
private

Definition at line 119 of file cass_query_list.hpp.

Referenced by SetTickCB(), and Tick().

◆ m_yield_in_progress

atomic_bool CCassQueryList::m_yield_in_progress
private

Definition at line 120 of file cass_query_list.hpp.

Referenced by Yield().

◆ SQrySlotStateStr

string CCassQueryList::SQrySlotStateStr = {"ssAvailable", "ssAttached", "ssReadingRow", "ssReseting", "ssReleasing"}
staticprivate

CCassQueryList.

Definition at line 80 of file cass_query_list.hpp.

Referenced by ToString().


The documentation for this class was generated from the following files:
Modified on Fri Sep 20 14:57:37 2024 by modify_doxy.py rev. 669887