NCBI C++ ToolKit
Classes | Public Types | 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
CCassBlobTaskLoadBlob Class Reference

Search Toolkit Book for CCassBlobTaskLoadBlob

#include <objtools/pubseq_gateway/impl/cassandra/blob_task/load_blob.hpp>

+ Inheritance diagram for CCassBlobTaskLoadBlob:
+ Collaboration diagram for CCassBlobTaskLoadBlob:

Classes

struct  SFind_chunk_id
 

Public Types

enum  EBlobTaskMode { eBlobTaskFindID2Chunk , eBlobTaskModeDefault }
 
using TBlobPropsCallback = function< void(CBlobRecord const &blob, bool isFound)>
 
using TBlobChunkCallbackEx = function< void(CBlobRecord const &blob, const unsigned char *data, unsigned int size, int chunk_no)>
 
using TFindID2ChunkIDCallback = function< void(bool &found, int &chunk_id, bool &packed)>
 

Public Member Functions

 CCassBlobTaskLoadBlob (shared_ptr< CCassConnection > conn, const string &keyspace, CBlobRecord::TSatKey sat_key, bool load_chunks, TDataErrorCallback data_error_cb)
 
 CCassBlobTaskLoadBlob (shared_ptr< CCassConnection > conn, const string &keyspace, CBlobRecord::TSatKey sat_key, CBlobRecord::TTimestamp modified, bool load_chunks, TDataErrorCallback data_error_cb)
 
 CCassBlobTaskLoadBlob (shared_ptr< CCassConnection > conn, const string &keyspace, unique_ptr< CBlobRecord > blob_record, bool load_chunks, TDataErrorCallback data_error_cb)
 
 CCassBlobTaskLoadBlob (shared_ptr< CCassConnection > conn, const string &keyspace, CBlobRecord::TSatKey sat, CBlobRecord::TSatKey sat_key, CBlobRecord::TSatKey chunk, CBlobRecord::TSatKey need_old, TDataErrorCallback data_error_cb)
 
virtual ~CCassBlobTaskLoadBlob ()
 
CBlobRecord::TSatKey GetSatKey () const
 
CBlobRecord::TTimestamp GetModified () const
 
bool LoadChunks () const
 
bool BlobPropsProvided () const
 
unique_ptr< CBlobRecordConsumeBlobRecord ()
 
bool IsBlobPropsFound () const
 
void SetChunkCallback (TBlobChunkCallbackEx callback)
 
void SetPropsCallback (TBlobPropsCallback callback)
 
void SetDataReadyCB (shared_ptr< CCassDataCallbackReceiver > callback)
 
void SetFindID2ChunkIDCallback (TFindID2ChunkIDCallback callback)
 
void SetUsePrepared (bool value)
 
- Public Member Functions inherited from CCassBlobWaiter
CCassBlobWaiteroperator= (const CCassBlobWaiter &)=delete
 
 CCassBlobWaiter (CCassBlobWaiter &&)=delete
 
CCassBlobWaiteroperator= (CCassBlobWaiter &&)=delete
 
 CCassBlobWaiter (shared_ptr< CCassConnection > conn, const string &keyspace, int32_t key, bool async, TDataErrorCallback error_cb)
 
 CCassBlobWaiter (shared_ptr< CCassConnection > conn, const string &keyspace, bool async, TDataErrorCallback error_cb)
 
virtual void SetQueryTimeout (std::chrono::milliseconds value)
 Experimental!!! May conflict with CCassConnection::SetQueryTimeoutRetry() when query timed out and CCassQuery::RestartQuery() called to make another attempt Currently required to test PubSeqGateway Casandra timeouts handling for multi-stage operations (Resolution => Primary blob retrieval => ID2 split blob retrieval) when Cassandra timeout happens at later stages of operation. More...
 
virtual std::chrono::milliseconds GetQueryTimeout () const
 
virtual ~CCassBlobWaiter ()
 
bool Cancelled () const
 
bool Finished () const noexcept
 
int32_t GetStateDebug () const noexcept
 Get internal state for debug purposes. More...
 
virtual void Cancel ()
 
bool Wait ()
 
bool HasError () const
 
string LastError () const
 
void ClearError ()
 
string GetKeySpace () const
 
void SetKeySpace (string const &keyspace)
 
int32_t GetKey () const
 
void SetErrorCB (TDataErrorCallback error_cb)
 
void SetMaxRetries (int value)
 Set connection point parameters. More...
 
int GetMaxRetries () const
 
void SetDataReadyCB3 (shared_ptr< CCassDataCallbackReceiver > datareadycb3)
 
void SetReadConsistency (TCassConsistency value)
 
void SetWriteConsistency (TCassConsistency value)
 

Static Public Member Functions

static void InitBlobChunkDataQuery (CCassQuery *query, string const &keyspace, CBlobRecord const &blob, int32_t chunk_no)
 

Static Public Attributes

static const CBlobRecord::TTimestamp kAnyModified = -1
 

Protected Member Functions

void Wait1 () override
 
- Protected Member Functions inherited from CCassBlobWaiter
 CCassBlobWaiter (const CCassBlobWaiter &other)
 
void CloseAll (void)
 
void SetupQueryCB3 (shared_ptr< CCassQuery > &query)
 
bool IsDataReadyCallbackExpired () const
 
void Error (CRequestStatus::ECode status, int code, EDiagSev severity, const string &message)
 
bool CanRestart (shared_ptr< CCassQuery > query, unsigned int restart_count) const
 
shared_ptr< CCassQueryProduceQuery () const
 
bool CanRestart (SQueryRec &it) const
 
bool CheckReady (shared_ptr< CCassQuery > qry, unsigned int restart_counter, bool &need_repeat)
 
bool CheckReady (SQueryRec &it)
 
TCassConsistency GetReadConsistency () const
 
TCassConsistency GetWriteConsistency () const
 
bool CheckMaxActive ()
 CCassBlobWaiter. More...
 

Private Types

enum  EBlobInserterState {
  eInit = 0 , eWaitingForPropsFetch , eFinishedPropsFetch , eBeforeLoadingChunks ,
  eLoadingChunks , eFind_ID2_Chunk , eWaitingForID2ChunkID , eIsID2ChunkPacked ,
  eWaitingForID2ChunkPacked , eDone = CCassBlobWaiter::eDone , eError = CCassBlobWaiter::eError
}
 

Private Member Functions

bool x_AreAllChunksProcessed () const
 
void x_CheckChunksFinished (bool &need_repeat)
 
void x_RequestChunksAhead ()
 
void x_RequestChunk (CCassQuery &qry, int32_t chunk_no)
 
void x_FindID2ChunkID_Query ()
 
bool x_FindID2ChunkID_Wait ()
 
void x_IsID2ChunkPacked_Query ()
 
bool x_IsID2ChunkPacked_Wait ()
 

Private Attributes

TBlobChunkCallbackEx m_ChunkCallback {nullptr}
 
TBlobPropsCallback m_PropsCallback {nullptr}
 
TFindID2ChunkIDCallback m_FindID2ChunkIDCallback { nullptr}
 
unique_ptr< CBlobRecordm_Blob
 
CBlobRecord::TTimestamp m_Modified {-1}
 
bool m_LoadChunks {false}
 
bool m_PropsFound {false}
 
vector< boolm_ProcessedChunks
 
size_t m_ActiveQueries {0}
 
CBlobRecord::TSize m_RemainingSize {0}
 
bool m_ExplicitBlob {false}
 
bool m_UsePrepared {true}
 
EBlobTaskMode m_Mode
 
SFind_chunk_id m_FindChunk
 

Static Private Attributes

static const size_t kMaxChunksAhead = 4
 

Additional Inherited Members

- Protected Types inherited from CCassBlobWaiter
enum  EBlobWaiterState { eInit = 0 , eDone = 10000 , eError = -1 }
 
- Protected Attributes inherited from CCassBlobWaiter
TDataErrorCallback m_ErrorCb
 
weak_ptr< CCassDataCallbackReceiverm_DataReadyCb3
 
shared_ptr< CCassConnectionm_Conn
 
std::chrono::milliseconds m_QueryTimeout {0}
 
atomic< int32_tm_State {eInit}
 
string m_LastError
 
bool m_Async {true}
 
atomic_bool m_Cancelled {false}
 
vector< SQueryRecm_QueryArr
 

Detailed Description

Definition at line 49 of file load_blob.hpp.

Member Typedef Documentation

◆ TBlobChunkCallbackEx

using CCassBlobTaskLoadBlob::TBlobChunkCallbackEx = function< void( CBlobRecord const & blob, const unsigned char * data, unsigned int size, int chunk_no)>

Definition at line 94 of file load_blob.hpp.

◆ TBlobPropsCallback

using CCassBlobTaskLoadBlob::TBlobPropsCallback = function< void( CBlobRecord const & blob, bool isFound)>

Definition at line 93 of file load_blob.hpp.

◆ TFindID2ChunkIDCallback

using CCassBlobTaskLoadBlob::TFindID2ChunkIDCallback = function< void( bool& found, int& chunk_id, bool& packed)>

Definition at line 96 of file load_blob.hpp.

Member Enumeration Documentation

◆ EBlobInserterState

Enumerator
eInit 
eWaitingForPropsFetch 
eFinishedPropsFetch 
eBeforeLoadingChunks 
eLoadingChunks 
eFind_ID2_Chunk 
eWaitingForID2ChunkID 
eIsID2ChunkPacked 
eWaitingForID2ChunkPacked 
eDone 
eError 

Definition at line 53 of file load_blob.hpp.

◆ EBlobTaskMode

Enumerator
eBlobTaskFindID2Chunk 
eBlobTaskModeDefault 

Definition at line 84 of file load_blob.hpp.

Constructor & Destructor Documentation

◆ CCassBlobTaskLoadBlob() [1/4]

CCassBlobTaskLoadBlob::CCassBlobTaskLoadBlob ( shared_ptr< CCassConnection conn,
const string keyspace,
CBlobRecord::TSatKey  sat_key,
bool  load_chunks,
TDataErrorCallback  data_error_cb 
)

Definition at line 67 of file load_blob.cpp.

◆ CCassBlobTaskLoadBlob() [2/4]

CCassBlobTaskLoadBlob::CCassBlobTaskLoadBlob ( shared_ptr< CCassConnection conn,
const string keyspace,
CBlobRecord::TSatKey  sat_key,
CBlobRecord::TTimestamp  modified,
bool  load_chunks,
TDataErrorCallback  data_error_cb 
)

Definition at line 85 of file load_blob.cpp.

References m_Blob.

◆ CCassBlobTaskLoadBlob() [3/4]

CCassBlobTaskLoadBlob::CCassBlobTaskLoadBlob ( shared_ptr< CCassConnection conn,
const string keyspace,
unique_ptr< CBlobRecord blob_record,
bool  load_chunks,
TDataErrorCallback  data_error_cb 
)

Definition at line 102 of file load_blob.cpp.

◆ CCassBlobTaskLoadBlob() [4/4]

CCassBlobTaskLoadBlob::CCassBlobTaskLoadBlob ( shared_ptr< CCassConnection conn,
const string keyspace,
CBlobRecord::TSatKey  sat,
CBlobRecord::TSatKey  sat_key,
CBlobRecord::TSatKey  chunk,
CBlobRecord::TSatKey  need_old,
TDataErrorCallback  data_error_cb 
)

◆ ~CCassBlobTaskLoadBlob()

virtual CCassBlobTaskLoadBlob::~CCassBlobTaskLoadBlob ( )
inlinevirtual

Definition at line 136 of file load_blob.hpp.

References CCassBlobWaiter::m_QueryArr.

Member Function Documentation

◆ BlobPropsProvided()

bool CCassBlobTaskLoadBlob::BlobPropsProvided ( ) const
inline

Definition at line 161 of file load_blob.hpp.

References m_ExplicitBlob.

Referenced by ToJsonString().

◆ ConsumeBlobRecord()

unique_ptr< CBlobRecord > CCassBlobTaskLoadBlob::ConsumeBlobRecord ( )

Definition at line 596 of file load_blob.cpp.

References CCassBlobWaiter::GetKey(), m_Blob, m_PropsFound, swap(), and tmp.

◆ GetModified()

CBlobRecord::TTimestamp CCassBlobTaskLoadBlob::GetModified ( ) const
inline

Definition at line 151 of file load_blob.hpp.

References m_Modified.

Referenced by ToJsonString(), and CPSGS_CassBlobBase::x_OnBlobPropNotFound().

◆ GetSatKey()

CBlobRecord::TSatKey CCassBlobTaskLoadBlob::GetSatKey ( void  ) const
inline

Definition at line 146 of file load_blob.hpp.

References m_Blob.

Referenced by ToJsonString().

◆ InitBlobChunkDataQuery()

void CCassBlobTaskLoadBlob::InitBlobChunkDataQuery ( CCassQuery query,
string const keyspace,
CBlobRecord const blob,
int32_t  chunk_no 
)
static

◆ IsBlobPropsFound()

bool CCassBlobTaskLoadBlob::IsBlobPropsFound ( ) const

Definition at line 141 of file load_blob.cpp.

References m_PropsFound.

◆ LoadChunks()

bool CCassBlobTaskLoadBlob::LoadChunks ( ) const
inline

Definition at line 156 of file load_blob.hpp.

References m_LoadChunks.

Referenced by ToJsonString().

◆ SetChunkCallback()

void CCassBlobTaskLoadBlob::SetChunkCallback ( TBlobChunkCallbackEx  callback)

◆ SetDataReadyCB()

void CCassBlobTaskLoadBlob::SetDataReadyCB ( shared_ptr< CCassDataCallbackReceiver callback)

◆ SetFindID2ChunkIDCallback()

void CCassBlobTaskLoadBlob::SetFindID2ChunkIDCallback ( TFindID2ChunkIDCallback  callback)

Definition at line 156 of file load_blob.cpp.

References m_FindID2ChunkIDCallback.

◆ SetPropsCallback()

void CCassBlobTaskLoadBlob::SetPropsCallback ( TBlobPropsCallback  callback)

◆ SetUsePrepared()

void CCassBlobTaskLoadBlob::SetUsePrepared ( bool  value)
inline

Definition at line 175 of file load_blob.hpp.

References m_UsePrepared, and rapidjson::value.

◆ Wait1()

void CCassBlobTaskLoadBlob::Wait1 ( )
overrideprotectedvirtual

◆ x_AreAllChunksProcessed()

bool CCassBlobTaskLoadBlob::x_AreAllChunksProcessed ( ) const
private

Definition at line 401 of file load_blob.cpp.

References m_ProcessedChunks.

Referenced by Wait1().

◆ x_CheckChunksFinished()

void CCassBlobTaskLoadBlob::x_CheckChunksFinished ( bool need_repeat)
private

◆ x_FindID2ChunkID_Query()

void CCassBlobTaskLoadBlob::x_FindID2ChunkID_Query ( )
private

◆ x_FindID2ChunkID_Wait()

bool CCassBlobTaskLoadBlob::x_FindID2ChunkID_Wait ( )
private

◆ x_IsID2ChunkPacked_Query()

void CCassBlobTaskLoadBlob::x_IsID2ChunkPacked_Query ( )
private

◆ x_IsID2ChunkPacked_Wait()

bool CCassBlobTaskLoadBlob::x_IsID2ChunkPacked_Wait ( )
private

◆ x_RequestChunk()

void CCassBlobTaskLoadBlob::x_RequestChunk ( CCassQuery qry,
int32_t  chunk_no 
)
private

◆ x_RequestChunksAhead()

void CCassBlobTaskLoadBlob::x_RequestChunksAhead ( )
private

Member Data Documentation

◆ kAnyModified

const CBlobRecord::TTimestamp CCassBlobTaskLoadBlob::kAnyModified = -1
static

Definition at line 91 of file load_blob.hpp.

Referenced by ToJsonString(), and Wait1().

◆ kMaxChunksAhead

const size_t CCassBlobTaskLoadBlob::kMaxChunksAhead = 4
staticprivate

Definition at line 52 of file load_blob.hpp.

Referenced by x_RequestChunksAhead().

◆ m_ActiveQueries

size_t CCassBlobTaskLoadBlob::m_ActiveQueries {0}
private

Definition at line 202 of file load_blob.hpp.

Referenced by x_CheckChunksFinished(), and x_RequestChunksAhead().

◆ m_Blob

unique_ptr<CBlobRecord> CCassBlobTaskLoadBlob::m_Blob
private

◆ m_ChunkCallback

TBlobChunkCallbackEx CCassBlobTaskLoadBlob::m_ChunkCallback {nullptr}
private

Definition at line 193 of file load_blob.hpp.

Referenced by SetChunkCallback(), Wait1(), and x_CheckChunksFinished().

◆ m_ExplicitBlob

bool CCassBlobTaskLoadBlob::m_ExplicitBlob {false}
private

Definition at line 204 of file load_blob.hpp.

Referenced by BlobPropsProvided(), and Wait1().

◆ m_FindChunk

SFind_chunk_id CCassBlobTaskLoadBlob::m_FindChunk
private

◆ m_FindID2ChunkIDCallback

TFindID2ChunkIDCallback CCassBlobTaskLoadBlob::m_FindID2ChunkIDCallback { nullptr}
private

Definition at line 195 of file load_blob.hpp.

Referenced by SetFindID2ChunkIDCallback(), and x_IsID2ChunkPacked_Wait().

◆ m_LoadChunks

bool CCassBlobTaskLoadBlob::m_LoadChunks {false}
private

Definition at line 199 of file load_blob.hpp.

Referenced by LoadChunks(), and Wait1().

◆ m_Mode

EBlobTaskMode CCassBlobTaskLoadBlob::m_Mode
private

Definition at line 206 of file load_blob.hpp.

Referenced by CCassBlobTaskLoadBlob(), and Wait1().

◆ m_Modified

CBlobRecord::TTimestamp CCassBlobTaskLoadBlob::m_Modified {-1}
private

Definition at line 198 of file load_blob.hpp.

Referenced by GetModified().

◆ m_ProcessedChunks

vector<bool> CCassBlobTaskLoadBlob::m_ProcessedChunks
private

◆ m_PropsCallback

TBlobPropsCallback CCassBlobTaskLoadBlob::m_PropsCallback {nullptr}
private

Definition at line 194 of file load_blob.hpp.

Referenced by SetPropsCallback(), and Wait1().

◆ m_PropsFound

bool CCassBlobTaskLoadBlob::m_PropsFound {false}
private

Definition at line 200 of file load_blob.hpp.

Referenced by ConsumeBlobRecord(), IsBlobPropsFound(), and Wait1().

◆ m_RemainingSize

CBlobRecord::TSize CCassBlobTaskLoadBlob::m_RemainingSize {0}
private

Definition at line 203 of file load_blob.hpp.

Referenced by Wait1(), and x_CheckChunksFinished().

◆ m_UsePrepared

bool CCassBlobTaskLoadBlob::m_UsePrepared {true}
private

The documentation for this class was generated from the following files:
Modified on Mon May 27 04:35:02 2024 by modify_doxy.py rev. 669887