shared_ptr<CPSGS_Request> request,
53shared_ptr<CPSGS_Reply> reply,
99 static interror_rate =
NCBI_PARAM_TYPE(CASSANDRA_PROCESSOR, ERROR_RATE)::GetDefault();
101 static interror_counter = 0;
102 if( ++error_counter >= error_rate ) {
161 if(details->Canceled()) {
163 if(details->ReadFinished()) {
165details->GetLoader()->Wait();
183ret += details->Serialize() +
" ";
184 if(details->Canceled()) {
187 if(details->ReadFinished()) {
188ret +=
"Read has finished";
190ret +=
"Read has not finished";
194ret +=
"No more details available";
206 if(!details->Canceled()) {
207 if(!details->ReadFinished()) {
234 proc->ProcessEvent();
242 if(!loader->ReadFinished()) {
244loader->RemoveFromExcludeBlobCache();
281shared_ptr<CPSGS_Request> request)
const 294 boolenabled = app->Settings().m_CassandraProcessorsEnabled;
297 for(
const auto& dis_processor :
304 for(
const auto& en_processor :
320 const string& seq_id)
332 string msg=
"Unknown satellite number "+ to_string(blob_id.
m_Sat) +
333 " for bioseq info with seq_id '"+
335app->GetCounters().Increment(
this,
355 stringmsg_lower =
msg;
358 returnmsg_lower.find(
"timeout") != string::npos;
381 const string& message,
391 stringmessage_prefix;
392 if(fetch_details !=
nullptr) {
394message_prefix =
"Fetch context: "+ fetch_details->
Serialize() +
"\n";
399 boolis_error =
IsError(severity);
410 m_Reply->SendTrace(message_prefix +
411 "Error detected. Status: "+ to_string(status) +
412 " Code: "+ to_string(
code) +
414 " Message: "+ message,
420app->GetCounters().Increment(
this,
429 switch(fetch_type) {
431app->GetCounters().Increment(
this,
435app->GetCounters().Increment(
this,
439app->GetCounters().Increment(
this,
443app->GetCounters().Increment(
this,
447app->GetCounters().Increment(
this,
451app->GetCounters().Increment(
this,
455app->GetCounters().Increment(
this,
459app->GetCounters().Increment(
this,
463app->GetCounters().Increment(
this,
467app->GetCounters().Increment(
this,
471app->GetCounters().Increment(
this,
486app->GetCounters().Increment(
this,
520 boolnew_client =
m_Request->GetIncludeHUP().has_value();
522 if(!
m_Request->GetIncludeHUP().value()) {
540 boolneed_trace =
m_Request->NeedTrace();
547 autoerr_cache_ret = app->GetMyNCBIErrorCache()->GetError(cookie);
548 if(err_cache_ret.has_value()) {
554 m_Reply->SendTrace(
"MyNCBI cookie was found in the error cache: "+
555cookie +
". Call the error callback right away.",
558error_cb(cookie, err_cache_ret.value().m_Status,
559err_cache_ret.value().m_Code,
560err_cache_ret.value().m_Severity,
561err_cache_ret.value().m_Message);
566 autonot_found_cache_ret = app->GetMyNCBINotFoundCache()->IsNotFound(cookie);
567 if(not_found_cache_ret) {
573 m_Reply->SendTrace(
"MyNCBI cookie was found in the not found cache: "+
574cookie +
". Call the error callback right away.",
594 autouser_info = app->GetMyNCBIOKCache()->GetUserInfo(
this, cookie,
598 if(user_info.has_value()) {
602 m_Reply->SendTrace(
"MyNCBI user info found in OK cache " 603 "in Ready state for cookie: "+ cookie +
604 ". User name: "+ user_info.value().m_UserInfo.username,
608 m_UserName= user_info.value().m_UserInfo.username;
616 m_Reply->SendTrace(
"MyNCBI cookie found in OK cache " 617 "in InProgress state for cookie: "+ cookie +
618 ". We are in a wait list now.",
626uv_loop_t * loop = app->GetUVLoop();
629 m_Reply->SendTrace(
"Initiating MyNCBI request for cookie: "+ cookie,
634app->GetMyNCBIFactory()->CreateWhoAmI(loop, cookie,
644app->GetCounters().Increment(
this,
647 stringerr_msg =
GetName() +
" processor: ";
649err_msg +=
"HUP retrieval is allowed (explicitly set to 'yes') but auth token is missing";
651err_msg +=
"HUP retrieval is allowed (implicitly) but auth token is missing";
666app->GetCounters().Increment(
this,
669 stringerr_msg =
GetName() +
" processor: ";
671err_msg +=
"HUP retrieval is disallowed but auth token is present";
673err_msg +=
"HUP retrieval is disallowed and auth token is missing";
686 const string& my_ncbi_message)
689app->GetCounters().Increment(
this,
692 stringerr_msg =
GetName() +
" processor received an error from MyNCBI " 693 "while checking permissions for a Cassandra secure keyspace. Message: "+
707app->GetCounters().Increment(
this,
710 stringerr_msg =
GetName() +
" processor received a not found report from MyNCBI " 711 "while checking permissions for a Cassandra secure keyspace.";
724app->GetCounters().Increment(
this,
728 " processor failed to get a Cassandra connection because of an unknown reason.";
741app->GetCounters().Increment(
this,
745 " processor failed to get a Cassandra connection. Message: "+ message;
772app->GetMyNCBIOKCache()->ClearWaitingProcessor(
m_MyNCBICookie.value(),
776app->GetMyNCBIOKCache()->ClearInitiatedRequest(
m_MyNCBICookie.value());
784app->GetCounters().Increment(
this,
787 stringerr_msg =
GetName() +
" processor: user '"+ user_name +
788 "' is not authorized to access " 789 "Cassandra secure satellite.";
NCBI_PARAM_DECL(int, CASSANDRA_PROCESSOR, ERROR_RATE)
void call_on_data_cb(void *user_data)
void call_processor_process_event_cb(void *user_data)
NCBI_PARAM_DEF(int, CASSANDRA_PROCESSOR, ERROR_RATE, 0)
const string kCassandraProcessorEvent
virtual string Serialize(void) const =0
EPSGS_DbFetchType GetFetchType(void) const
@ ePSGS_FailureToGetCassConnectionCounter
@ ePSGS_BioseqInfoNotFound
@ ePSGS_AnnotationNotFound
@ ePSGS_MyNCBINotFoundCounter
@ ePSGS_SplitHistoryNotFound
@ ePSGS_IncludeHUPSetToNo
@ ePSGS_AnnotationBlobNotFound
@ ePSGS_ServerSatToSatNameError
@ ePSGS_IPGResolveNotFound
@ ePSGS_NoWebCubbyUserCookie
@ ePSGS_PublicCommentNotFound
@ ePSGS_SecureSatUnauthorizedCounter
@ ePSGS_CassQueryTimeoutError
@ ePSGS_MyNCBIErrorCounter
@ ePSGS_AccVerHistoryNotFound
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
CRequestStatus::ECode m_Status
bool IsError(EDiagSev severity) const
SCass_BlobId TranslateSatToKeyspace(CBioseqInfoRecord::TSat sat, CBioseqInfoRecord::TSatKey sat_key, const string &seq_id)
EPSGS_MyNCBILookupResult PopulateMyNCBIUser(TMyNCBIDataCB data_cb, TMyNCBIErrorCB error_cb)
void ReportSecureSatUnauthorized(const string &user_name)
virtual ~CPSGS_CassProcessorBase()
list< unique_ptr< CCassFetch > > m_FetchDetails
@ ePSGS_FoundInNotFoundCache
@ ePSGS_IncludeHUPSetToNo
@ ePSGS_FoundInErrorCache
string GetVerboseFetches(void) const
shared_ptr< CPSG_MyNCBIRequest_WhoAmI > m_WhoAmIRequest
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)
optional< string > m_MyNCBICookie
void ReportMyNCBINotFound(void)
void ReportMyNCBIError(CRequestStatus::ECode status, const string &my_ncbi_message)
void SignalFinishProcessing(void)
CPSGS_CassProcessorBase()
virtual void Cancel(void) override
The infrastructure request to cancel processing.
void ReportNoWebCubbyUser(void)
void EnforceWait(void) const
bool IsTimeoutError(const string &msg) const
optional< string > m_UserName
void ReportExplicitIncludeHUPSetToNo(void)
static CPubseqGatewayApp * GetInstance(void)
virtual string GetName(void) const =0
Tells the processor name (used in logging and tracing)
shared_ptr< CPSGS_Reply > m_Reply
EPSGS_Status
The GetStatus() method returns a processor current status.
void PostponeInvoke(CPSGS_UvLoopBinder::TProcessorCB cb, void *user_data)
The provided callback will be called from the libuv loop assigned to the processor.
void SignalFinishProcessing(void)
A processor should call this method when it decides that there is nothing else to be done.
shared_ptr< CPSGS_Request > m_Request
TProcessorPriority m_Priority
static const char * SeverityName(EDiagSev sev)
Get a common symbolic name for the severity levels.
EDiagSev
Severity level for the posted diagnostics.
@ eDiag_Error
Error message.
@ eDiag_Warning
Warning message.
@ eDiag_Fatal
Fatal error â guarantees exit(or abort)
@ eDiag_Critical
Critical error message.
@ e500_InternalServerError
#define NCBI_PARAM_TYPE(section, name)
Generate typename for a parameter from its {section, name} attributes.
static int CompareNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive compare of a substring with another string.
static string & ToLower(string &str)
Convert string to lower case â string& version.
function< void(const string &cookie, CPSG_MyNCBIRequest_WhoAmI::SUserInfo info)> TMyNCBIDataCB
function< void(const string &cookie, CRequestStatus::ECode status, int code, EDiagSev severity, const string &message)> TMyNCBIErrorCB
Defines NCBI C++ diagnostic APIs, classes, and macros.
#define PSG_ERROR(message)
#define PSG_NOTE(message)
#define PSG_WARNING(message)
@ ePSGS_BlobBySatSatKeyFetch
@ ePSGS_SplitHistoryFetch
@ ePSGS_AnnotationBlobFetch
@ ePSGS_PublicCommentFetch
@ ePSGS_AccVerHistoryFetch
@ ePSGS_NoWebCubbyUserCookieError
@ ePSGS_SecureSatUnauthorized
@ ePSGS_UnknownResolvedSatellite
@ ePSGS_CassConnectionError
Defines CRequestStatus class for NCBI C++ diagnostic API.
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
CBioseqInfoRecord::TSat m_Sat
bool MapSatToKeyspace(void)
vector< string > m_DisabledProcessors
vector< string > m_EnabledProcessors
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