42 using namespace std::placeholders;
53 shared_ptr<CPSGS_Request> request,
54 shared_ptr<CPSGS_Reply> reply,
62 this, _1, _2, _3, _4, _5),
64 this, _1, _2, _3, _4, _5))
82 shared_ptr<CPSGS_Reply> reply)
const
92 if (!blob_id.IsValid())
96 auto startup_data_state = app->GetStartupDataState();
98 if (request->NeedTrace()) {
100 "request because Cassandra DB is not available.\n" +
102 request->GetStartTimestamp());
113 shared_ptr<CPSGS_Reply> reply,
130 app->GetCounters().Increment(
this,
135 " to a Cassandra keyspace";
160 this, _1, _2, _3, _4, _5));
161 switch (populate_result) {
194 shared_ptr<CCassConnection> cass_connection;
199 if (!cass_connection) {
210 }
catch (
const exception & exc) {
226 unique_ptr<CCassBlobFetch> fetch_details;
229 unique_ptr<CBlobRecord> blob_record(
new CBlobRecord);
248 std::move(blob_record),
250 fetch_details->SetLoader(load_task);
259 "Blob properties are not found",
266 "Blob properties are not found due to a cache lookup error",
272 fetch_details->RemoveFromExcludeBlobCache();
285 fetch_details->SetLoader(load_task);
292 fetch_details->SetLoader(load_task);
300 this, _1, _2, _3, _4, _5),
301 fetch_details.get()));
313 "Cassandra request: " +
359 const string & message)
376 const unsigned char * chunk_data,
377 unsigned int data_size,
381 chunk_data, data_size, chunk_no);
436 if (details->InPeek()) {
439 details->SetInPeek(
true);
440 x_Peek(details, need_wait);
441 details->SetInPeek(
false);
458 details->SetExcludeBlobCacheCompleted();
469 if (!fetch_details->GetLoader())
472 bool final_state =
false;
474 if (!fetch_details->ReadFinished())
475 final_state = fetch_details->GetLoader()->Wait();
477 if (fetch_details->GetLoader()->HasError() &&
481 string error = fetch_details->GetLoader()->LastError();
484 app->GetCounters().Increment(
this,
493 fetch_details->GetLoader()->ClearError();
494 fetch_details->SetReadFinished();
506 const string & message)
const string kCassandraProcessorGroupName
const string kCassandraProcessorEvent
void SetDataReadyCB(shared_ptr< CCassDataCallbackReceiver > callback)
void SetPropsCallback(TBlobPropsCallback callback)
void SetErrorCB(TDataErrorCallback error_cb)
EPSGS_CacheLookupResult LookupBlobProp(IPSGS_Processor *processor, int sat, int sat_key, int64_t &last_modified, CBlobRecord &blob_record)
@ ePSGS_ClientSatToSatNameError
void OnGetBlobChunk(bool cancelled, CCassBlobFetch *fetch_details, const unsigned char *chunk_data, unsigned int data_size, int chunk_no)
void OnGetBlobProp(CCassBlobFetch *fetch_details, CBlobRecord const &blob, bool is_found)
void PrepareServerErrorMessage(CCassBlobFetch *fetch_details, int code, EDiagSev severity, const string &message)
void OnGetBlobError(CCassBlobFetch *fetch_details, CRequestStatus::ECode status, int code, EDiagSev severity, const string &message)
void ReportFailureToGetCassConnection(void)
void UpdateOverallStatus(CRequestStatus::ECode status)
bool IsCassandraProcessorEnabled(shared_ptr< CPSGS_Request > request) 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
virtual string GetGroupName(void) const
Tells the processor group name.
virtual void Process(void)
Main processing function.
SPSGS_BlobBySatSatKeyRequest * m_BlobRequest
void x_OnMyNCBIError(const string &cookie, CRequestStatus::ECode status, int code, EDiagSev severity, const string &message)
virtual EPSGS_Status GetStatus(void)
Tells the processor status (if it has finished or in progress)
void OnGetBlobChunk(CCassBlobFetch *fetch_details, CBlobRecord const &blob, const unsigned char *chunk_data, unsigned int data_size, int chunk_no)
virtual void ProcessEvent(void)
Called when an event happened which may require to have some processing.
void x_Peek(bool need_wait)
void x_OnMyNCBIData(const string &cookie, CPSG_MyNCBIRequest_WhoAmI::SUserInfo info)
void OnGetBlobProp(CCassBlobFetch *fetch_details, CBlobRecord const &blob, bool is_found)
void OnGetBlobError(CCassBlobFetch *fetch_details, CRequestStatus::ECode status, int code, EDiagSev severity, const string &message)
virtual string GetName(void) const
Tells the processor name (used in logging and tracing)
virtual ~CPSGS_GetBlobProcessor()
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.
virtual bool CanProcess(shared_ptr< CPSGS_Request > request, shared_ptr< CPSGS_Reply > reply) const
Tells if processor can process the given request.
@ ePSGS_BlobBySatSatKeyRequest
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
static const string kGetblobProcessorName
EDiagSev
Severity level for the posted diagnostics.
@ eDiag_Error
Error message.
@ e500_InternalServerError
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_UnknownResolvedSatellite
string GetCassStartupDataStateMessage(EPSGS_StartupDataState state)
CBioseqInfoRecord::TSat m_Sat
optional< SSatInfoEntry > m_Keyspace
optional< bool > m_IsSecureKeyspace
bool MapSatToKeyspace(void)
CBioseqInfoRecord::TSatKey m_SatKey
CBlobRecord::TTimestamp m_LastModified
EPSGS_CacheAndDbUse m_UseCache