std::placeholders;
54shared_ptr<CPSGS_Request> request,
55shared_ptr<CPSGS_Reply> reply,
57shared_ptr<CPSGS_SatInfoChunksVerFlavorId2Info> sat_info_chunk_ver_id2info,
58shared_ptr<CPSGS_IdModifiedVerFlavorId2Info> id_mod_ver_id2info) :
64this, _1, _2, _3, _4, _5),
66this, _1, _2, _3, _4, _5)),
67m_SatInfoChunkVerId2Info(sat_info_chunk_ver_id2info),
68m_IdModVerId2Info(id_mod_ver_id2info)
84shared_ptr<CPSGS_Reply> reply)
const 97 if(tse_chunk_request->m_Id2Chunk == 0)
101shared_ptr<CPSGS_SatInfoChunksVerFlavorId2Info> sat_info_chunk_ver_id2info;
102shared_ptr<CPSGS_IdModifiedVerFlavorId2Info> id_mod_ver_id2info;
104sat_info_chunk_ver_id2info,
105id_mod_ver_id2info) ==
111 autostartup_data_state = app->GetStartupDataState();
113 if(request->NeedTrace()) {
115 " request because Cassandra DB is not available.\n"+
117request->GetStartTimestamp());
128shared_ptr<CPSGS_Reply> reply,
135shared_ptr<CPSGS_SatInfoChunksVerFlavorId2Info> sat_info_chunk_ver_id2info;
136shared_ptr<CPSGS_IdModifiedVerFlavorId2Info> id_mod_ver_id2info;
141sat_info_chunk_ver_id2info,
145sat_info_chunk_ver_id2info,
152 const string& id2_info,
153shared_ptr<CPSGS_SatInfoChunksVerFlavorId2Info> & sat_info_chunk_ver_id2info,
154shared_ptr<CPSGS_IdModifiedVerFlavorId2Info> & id_mod_ver_id2info)
const 158sat_info_chunk_ver_id2info.reset(
166id_mod_ver_id2info.reset(
177 const string&
info,
178unique_ptr<CPSGS_SatInfoChunksVerFlavorId2Info> & id2_info,
186}
catch(
constexception & exc) {
187err_msg =
"Error extracting id2 info for blob "+
188blob_id.
ToString() +
": "+ exc.what();
190err_msg =
"Unknown error while extracting id2 info for blob "+
195app->GetCounters().Increment(
this,
217app->GetCounters().Increment(
this,
219 string msg=
"Unknown TSE chunk satellite number "+
220to_string(blob_id.
m_Sat) +
221 " for the blob "+ blob_id.
ToString();
254 "Logic error: none of the id2_info options were initialized");
270app->GetCounters().Increment(
this,
275 " to a Cassandra keyspace";
302shared_ptr<CCassConnection> cass_connection;
305cass_connection =
m_IdModVerId2Info->GetTSEId().m_Keyspace->GetSecureConnection(
307 if(!cass_connection) {
318}
catch(
constexception & exc) {
336unique_ptr<CBlobRecord> blob_record(
new CBlobRecord);
342 autoblob_prop_cache_lookup_result =
345last_modified, *blob_record.get());
349 if(blob_record->GetId2Info().empty()) {
350app->GetCounters().Increment(
this,
353 " properties id2info is empty in cache");
358unique_ptr<CPSGS_SatInfoChunksVerFlavorId2Info> cache_id2_info;
364app->GetCounters().Increment(
this,
370 if(cache_id2_info->GetSplitVersion() !=
m_IdModVerId2Info->GetSplitVersion()) {
371app->GetCounters().Increment(
this,
374 " split version in cache does not match the requested one");
378app->GetCounters().Increment(
this,
383cache_id2_info->GetChunks(),
false)) {
392sat_key = cache_id2_info->GetInfo();
395sat_key = cache_id2_info->GetInfo() -
396cache_id2_info->GetChunks() - 1 +
399 SCass_BlobIdchunk_blob_id(cache_id2_info->GetSat(), sat_key);
406 autotse_blob_prop_cache_lookup_result = psg_cache.
LookupBlobProp(
409last_modified, *blob_record.get());
411err_msg =
"TSE chunk blob "+ chunk_blob_id.
ToString() +
412 " properties are not found in cache";
414err_msg +=
" due to LMDB error";
431vector<string>(), vector<string>(),
434unique_ptr<CCassBlobFetch> fetch_details;
435fetch_details.reset(
new CCassBlobFetch(chunk_request, chunk_blob_id));
439std::move(blob_record),
441fetch_details->SetLoader(load_task);
446 this, _1, _2, _3, _4, _5),
455fetch_details.get(),
false));
459 this, _1, _2, _3, _4, _5),
465 "Cassandra request: "+
477 " properties are not found in cache";
479err_msg +=
" due to LMDB error";
502unique_ptr<CCassSplitHistoryFetch> fetch_details;
512fetch_details->SetLoader(load_task);
518 this, _1, _2, _3, _4, _5),
519fetch_details.get()));
525fetch_details.get()));
529 "Cassandra request: "+
545 this, _1, _2, _3, _4, _5));
622shared_ptr<CCassConnection> cass_connection;
627 if(!cass_connection) {
638}
catch(
constexception & exc) {
658unique_ptr<CBlobRecord> blob_record(
new CBlobRecord);
659 autotse_blob_prop_cache_lookup_result =
661last_modified, *blob_record.get());
676vector<string>(), vector<string>(),
679unique_ptr<CCassBlobFetch> fetch_details;
693std::move(blob_record),
697fetch_details->SetLoader(load_task);
702 this, _1, _2, _3, _4, _5),
711fetch_details.get(),
false));
715 this, _1, _2, _3, _4, _5),
721 "Cassandra request: "+
756 "Blob prop callback; found: "+ to_string(is_found),
771app->GetCounters().Increment(
this,
774 autoblob_id = fetch_details->
GetBlobId();
775 stringmessage =
"Blob "+ blob_id.
ToString() +
" properties are not found";
798 const string& message)
814 boolis_error =
IsError(severity);
820message, status,
code, severity);
827message, status,
code, severity);
848 const unsigned char* chunk_data,
849 unsigned intdata_size,
872 "while the output has finished, ignoring");
881 "Blob chunk "+ to_string(chunk_no) +
" callback",
888chunk_data, data_size, chunk_no,
894 "Blob chunk no-more-data callback",
919 const string& message)
932 boolis_error =
IsError(severity);
954vector<SSplitHistoryRecord> &&
result)
979 "Split history callback; number of records: "+ to_string(
result.size()),
986app->GetCounters().Increment(
this,
989 stringmessage =
"Split history version "+
991 " is not found for the TSE id "+
1019unique_ptr<CPSGS_SatInfoChunksVerFlavorId2Info> id2_info;
1021id2_info, fetch_details->
GetTSEId(),
true))
1027id2_info->GetChunks(),
true))
1034sat_key = id2_info->GetInfo();
1036sat_key = id2_info->GetInfo() - id2_info->GetChunks() - 1 +
1039 SCass_BlobIdchunk_blob_id(id2_info->GetSat(), sat_key);
1043shared_ptr<CCassConnection> cass_connection;
1046cass_connection = chunk_blob_id.
m_Keyspace->GetSecureConnection(
1048 if(!cass_connection) {
1057cass_connection = chunk_blob_id.
m_Keyspace->GetConnection();
1059}
catch(
constexception & exc) {
1077unique_ptr<CBlobRecord> blob_record(
new CBlobRecord);
1083 autoblob_prop_cache_lookup_result =
1086last_modified, *blob_record.get());
1090 stringerr_msg =
"TSE chunk blob "+ chunk_blob_id.
ToString() +
1091 " properties are not found in cache";
1093err_msg +=
" due to LMDB error";
1111vector<string>(), vector<string>(),
1112psg_clock_t::now());
1113unique_ptr<CCassBlobFetch> cass_blob_fetch;
1114cass_blob_fetch.reset(
new CCassBlobFetch(chunk_request, chunk_blob_id));
1122std::move(blob_record),
1131cass_blob_fetch->SetLoader(load_task);
1138 this, _1, _2, _3, _4, _5),
1139cass_blob_fetch.get(),
1148cass_blob_fetch.get(),
1154 this, _1, _2, _3, _4, _5),
1155cass_blob_fetch.get(),
1160 "Cassandra request: "+
1166load_task->
Wait();
1208 if(requested_chunk > total_chunks) {
1209 string msg=
"Invalid chunk requested. " 1210 "The number of available chunks: "+
1211to_string(total_chunks) +
", requested number: "+
1212to_string(requested_chunk);
1215app->GetCounters().Increment(
this,
1237app->GetCounters().Increment(
this,
1240 string msg=
"Unknown TSE chunk satellite number "+
1241to_string(blob_id.
m_Sat) +
1242 " for the blob "+ blob_id.
ToString();
1303 if(details->InPeek()) {
1306details->SetInPeek(
true);
1307 x_Peek(details, need_wait);
1308details->SetInPeek(
false);
1328 if(!fetch_details->GetLoader())
1331 boolfinal_state =
false;
1333 if(!fetch_details->ReadFinished()) {
1334final_state = fetch_details->GetLoader()->Wait();
1338 if(fetch_details->GetLoader()->HasError() &&
1342 string error= fetch_details->GetLoader()->LastError();
1369fetch_details->GetLoader()->ClearError();
1370fetch_details->SetReadFinished();
1382 const string& message)
const string kCassandraProcessorGroupName
const string kCassandraProcessorEvent
CCassBlobTaskLoadBlob * GetLoader(void)
bool IsBlobPropStage(void) const
void SetDataReadyCB(shared_ptr< CCassDataCallbackReceiver > callback)
void SetConsumeCallback(TConsumeCallback callback)
void SetDataReadyCB(shared_ptr< CCassDataCallbackReceiver > callback)
void SetPropsCallback(TBlobPropsCallback callback)
void SetChunkCallback(TBlobChunkCallbackEx callback)
void SetErrorCB(TDataErrorCallback error_cb)
void SetReadFinished(void)
SCass_BlobId GetBlobId(void) const
CCassBlobTaskFetchSplitHistory * GetLoader(void)
SCass_BlobId GetTSEId(void) const
int64_t GetChunk(void) const
SPSGS_RequestBase::EPSGS_CacheAndDbUse GetUseCache(void) const
int64_t GetSplitVersion(void) const
EPSGS_CacheLookupResult LookupBlobProp(IPSGS_Processor *processor, int sat, int sat_key, int64_t &last_modified, CBlobRecord &blob_record)
bool IsAllowed(void) const
@ ePSGS_SplitHistoryNotFound
@ ePSGS_InvalidId2InfoError
@ ePSGS_ServerSatToSatNameError
@ ePSGS_TSEChunkSplitVersionCacheNotMatched
@ ePSGS_TSEChunkSplitVersionCacheMatched
@ ePSGS_BlobPropsNotFound
@ ePSGS_ClientSatToSatNameError
void Increment(IPSGS_Processor *processor, EPSGS_CounterType counter)
void ReportFailureToGetCassConnection(void)
CRequestStatus::ECode CountError(CCassFetch *fetch_details, CRequestStatus::ECode status, int code, EDiagSev severity, const string &message, EPSGS_LoggingFlag logging_flag, EPSGS_StatusUpdateFlag status_update_flag)
void UpdateOverallStatus(CRequestStatus::ECode status)
bool IsCassandraProcessorEnabled(shared_ptr< CPSGS_Request > request) const
bool IsError(EDiagSev severity) const
EPSGS_MyNCBILookupResult PopulateMyNCBIUser(TMyNCBIDataCB data_cb, TMyNCBIErrorCB error_cb)
void ReportSecureSatUnauthorized(const string &user_name)
list< unique_ptr< CCassFetch > > m_FetchDetails
@ ePSGS_FoundInNotFoundCache
@ ePSGS_IncludeHUPSetToNo
@ ePSGS_FoundInErrorCache
bool AreAllFinishedRead(void) const
bool IsMyNCBIFinished(void) const
void UnlockWaitingProcessor(void)
void CleanupMyNCBICache(void)
IPSGS_Processor::EPSGS_Status GetStatus(void) override
Tells the processor status (if it has finished or in progress)
void ReportMyNCBINotFound(void)
void ReportMyNCBIError(CRequestStatus::ECode status, const string &my_ncbi_message)
void SignalFinishProcessing(void)
optional< string > m_UserName
void x_SendProcessorError(const string &msg, CRequestStatus::ECode status, int code)
void OnGetBlobError(CCassBlobFetch *fetch_details, CRequestStatus::ECode status, int code, EDiagSev severity, const string &message)
CPSGS_TSEChunkProcessor()
void x_ProcessIdModVerId2InfoFinalStage(void)
virtual void ProcessEvent(void)
Called when an event happened which may require to have some processing.
void x_ProcessIdModVerId2Info(void)
shared_ptr< CPSGS_IdModifiedVerFlavorId2Info > m_IdModVerId2Info
bool x_GetMyNCBIUser(void)
EPSGSId2InfoFlavor x_DetectId2InfoFlavor(const string &id2_info, shared_ptr< CPSGS_SatInfoChunksVerFlavorId2Info > &sat_info_chunk_ver_id2info, shared_ptr< CPSGS_IdModifiedVerFlavorId2Info > &id_mod_ver_id2info) const
shared_ptr< CPSGS_SatInfoChunksVerFlavorId2Info > m_SatInfoChunkVerId2Info
void OnGetSplitHistoryError(CCassSplitHistoryFetch *fetch_details, CRequestStatus::ECode status, int code, EDiagSev severity, const string &message)
void OnGetSplitHistory(CCassSplitHistoryFetch *fetch_details, vector< SSplitHistoryRecord > &&result)
void OnGetBlobChunk(CCassBlobFetch *fetch_details, CBlobRecord const &blob, const unsigned char *chunk_data, unsigned int data_size, int chunk_no)
void x_OnMyNCBIError(const string &cookie, CRequestStatus::ECode status, int code, EDiagSev severity, const string &message)
bool x_ValidateTSEChunkNumber(int64_t requested_chunk, CPSGS_SatInfoChunksVerFlavorId2Info::TChunks total_chunks, bool need_finish)
virtual ~CPSGS_TSEChunkProcessor()
SCass_BlobId m_SatInfoChunkVerBlobId
void x_ProcessSatInfoChunkVerId2InfoFinalStage(void)
virtual EPSGS_Status GetStatus(void)
Tells the processor status (if it has finished or in progress)
virtual bool CanProcess(shared_ptr< CPSGS_Request > request, shared_ptr< CPSGS_Reply > reply) const
Tells if processor can process the given request.
virtual IPSGS_Processor * CreateProcessor(shared_ptr< CPSGS_Request > request, shared_ptr< CPSGS_Reply > reply, TProcessorPriority priority) const
Create processor to fulfil PSG request using the data source.
void x_ProcessSatInfoChunkVerId2Info(void)
bool x_TSEChunkSatToKeyspace(SCass_BlobId &blob_id)
void x_Peek(bool need_wait)
virtual string GetName(void) const
Tells the processor name (used in logging and tracing)
void x_OnMyNCBIData(const string &cookie, CPSG_MyNCBIRequest_WhoAmI::SUserInfo user_info)
virtual string GetGroupName(void) const
Tells the processor group name.
virtual void Process(void)
Main processing function.
void x_RequestTSEChunk(const SSplitHistoryRecord &split_record, CCassSplitHistoryFetch *fetch_details)
bool x_ParseTSEChunkId2Info(const string &info, unique_ptr< CPSGS_SatInfoChunksVerFlavorId2Info > &id2_info, const SCass_BlobId &blob_id, bool need_finish)
void OnGetBlobProp(CCassBlobFetch *fetch_details, CBlobRecord const &blob, bool is_found)
SPSGS_TSEChunkRequest * m_TSEChunkRequest
CPSGSCounters & GetCounters(void)
static CPubseqGatewayApp * GetInstance(void)
Interface class (and self-factory) for request processor objects that can retrieve data from a given ...
shared_ptr< CPSGS_Request > GetRequest(void) const
Provides the user request.
shared_ptr< CPSGS_Reply > m_Reply
EPSGS_Status
The GetStatus() method returns a processor current status.
EPSGS_StartProcessing SignalStartProcessing(void)
A processor should call the method when it decides that it successfully started processing the reques...
shared_ptr< CPSGS_Request > m_Request
EDiagSev
Severity level for the posted diagnostics.
@ eDiag_Error
Error message.
@ e422_UnprocessableEntity
@ e500_InternalServerError
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
const int64_t kSplitInfoChunk
@ ePSGS_UnknownId2InfoFlavor
@ ePSGS_IdModifiedVerId2InfoFlavor
@ ePSGS_SatInfoChunksVerId2InfoFlavor
string ToJsonString(const CBioseqInfoRecord &bioseq_info, SPSGS_ResolveRequest::TPSGS_BioseqIncludeData include_data_flags, const string &custom_blob_id)
#define PSG_ERROR(message)
#define PSG_WARNING(message)
@ ePSGS_MalformedParameter
@ ePSGS_UnknownResolvedSatellite
@ ePSGS_NoSplitHistoryError
string GetCassStartupDataStateMessage(EPSGS_StartupDataState state)
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
string ToString(void) const
CBioseqInfoRecord::TSat m_Sat
optional< SSatInfoEntry > m_Keyspace
optional< bool > m_IsSecureKeyspace
bool MapSatToKeyspace(void)
CBioseqInfoRecord::TSatKey m_SatKey
static const string kTSEChunkProcessorName
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4