52 using namespace std::placeholders;
60 shared_ptr<CPSGS_Reply> reply,
70 this, _1, _2, _3, _4, _5),
77 this, _1, _2, _3, _4, _5)),
78 m_FinalFinishedCB(finished_cb),
79 m_FinalErrorCB(error_cb),
80 m_FinalStartProcessingCB(resolution_start_processing_cb),
107 "Not handled request type " +
108 to_string(
static_cast<int>(
m_Request->GetRequestType())));
114 int16_t & effective_seq_id_type,
115 list<string> & secondary_id_list,
118 bool need_trace =
m_Request->NeedTrace();
122 effective_seq_id_type, need_trace)) {
124 m_Reply->SendTrace(
"OSLT has not been tried due to mismatch "
125 "between the parsed CSeq_id seq_id_type and "
126 "the URL provided one",
133 primary_id = parsed_seq_id.
ComposeOSLT(&secondary_id_list,
137 m_Reply->SendTrace(
"OSLT call failure (exception)",
144 string trace_msg(
"OSLT succeeded");
145 trace_msg +=
"\nOSLT primary id: " + primary_id;
147 if (secondary_id_list.empty()) {
148 trace_msg +=
"\nOSLT secondary id list is empty";
150 for (
const auto & item : secondary_id_list) {
151 trace_msg +=
"\nOSLT secondary id: " + item;
163 const string & primary_id,
170 if (!primary_id.empty()) {
181 this, bioseq_resolution);
187 bioseq_resolution.
Reset();
189 return bioseq_cache_lookup_result;
195 const string & secondary_id,
206 auto si2csi_cache_lookup_result =
213 bioseq_resolution.
Reset();
230 upper_seq_id, seq_id_type,
234 bioseq_resolution.
Reset();
239 return cache_lookup_result;
247 const list<string> & secondary_id_list,
248 const string & primary_id,
253 bool cache_failure =
false;
255 if (!primary_id.empty()) {
256 auto cache_lookup_result =
258 effective_seq_id_type,
263 cache_failure =
true;
266 for (
const auto & secondary_id : secondary_id_list) {
267 auto cache_lookup_result =
269 effective_seq_id_type,
274 cache_failure =
true;
288 if (primary_id != upper_seq_id)
294 cache_failure =
true;
296 bioseq_resolution.
Reset();
329 string parse_err_msg;
337 list<string> secondary_id_list;
339 bool composed_ok =
false;
341 composed_ok =
x_ComposeOSLT(oslt_seq_id, effective_seq_id_type,
342 secondary_id_list, primary_id);
350 secondary_id_list, primary_id,
355 if (bioseq_resolution.
IsValid()) {
357 bool continue_with_cassandra =
false;
364 auto bioseq_cache_lookup_result =
369 continue_with_cassandra =
true;
370 bioseq_resolution.
Reset();
378 continue_with_cassandra =
true;
379 bioseq_resolution.
Reset();
389 continue_with_cassandra =
true;
390 bioseq_resolution.
Reset();
394 if (!continue_with_cassandra) {
405 if (! parse_err_msg.empty() &&
415 effective_seq_id_type,
416 std::move(secondary_id_list),
417 std::move(primary_id),
419 std::move(bioseq_resolution));
429 app->GetCounters().Increment(
this,
435 }
else if (!parse_err_msg.empty()) {
461 string parse_err_msg;
469 list<string> secondary_id_list;
471 bool composed_ok =
false;
473 composed_ok =
x_ComposeOSLT(oslt_seq_id, effective_seq_id_type,
474 secondary_id_list, primary_id);
480 secondary_id_list, primary_id,
486 if (!bioseq_resolution.
IsValid()) {
488 if (!parse_err_msg.empty()) {
494 return bioseq_resolution;
503 const string & message,
531 const string & message,
534 if (!message.empty()) {
566 auto cache_lookup_result =
577 if (bioseq_resolution.m_CassQueryCount == 0) {
584 std::move(bioseq_resolution));
589 "Data inconsistency: the bioseq key info was "
591 " but the bioseq info is not found",
function< void(SBioseqResolution &&async_bioseq_resolution)> TSeqIdResolutionFinishedCB
function< void(void)> TSeqIdResolutionStartProcessingCB
function< void(CRequestStatus::ECode status, int code, EDiagSev severity, const string &message, EPSGS_LoggingFlag logging_flag)> TSeqIdResolutionErrorCB
CBioseqInfoRecord & SetSeqIdType(TSeqIdType value)
CBioseqInfoRecord & SetVersion(TVersion value)
CBioseqInfoRecord & SetAccession(const TAccession &value)
EPSGS_CacheLookupResult LookupBioseqInfo(IPSGS_Processor *processor, SBioseqResolution &bioseq_resolution)
EPSGS_CacheLookupResult LookupSi2csi(IPSGS_Processor *processor, SBioseqResolution &bioseq_resolution)
@ ePSGS_InputSeqIdNotResolved
CRequestStatus::ECode GetCombinedErrorCode(void) const
void AppendError(const string &msg, CRequestStatus::ECode code)
string GetCombinedErrorMessage(const list< SPSGSeqId > &seq_id_to_resolve) const
void MakeRequest(SBioseqResolution &&bioseq_resolution)
string GetCouldNotResolveMessage(void) const
bool MoveToNextSeqId(void)
list< SPSGSeqId > m_SeqIdsToResolve
psg_time_point_t GetAsyncResolutionStartTimestamp(void) const
void SetAsyncResolutionStartTimestamp(const psg_time_point_t &ts)
void SetupSeqIdToResolve(void)
bool CanSkipBioseqInfoRetrieval(const CBioseqInfoRecord &bioseq_info_record)
CPSGSResolveErrors m_ResolveErrors
list< SPSGSeqId >::const_iterator m_CurrentSeqIdToResolve
EPSGS_AccessionAdjustmentResult AdjustBioseqAccession(SBioseqResolution &bioseq_resolution)
int16_t GetEffectiveVersion(const CTextseq_id *text_seq_id)
@ ePSGS_AnnotationRequest
@ ePSGS_IPGResolveRequest
@ ePSGS_AccessionVersionHistoryRequest
@ ePSGS_BlobBySeqIdRequest
void x_ResolveViaComposeOSLTInCache(CSeq_id &parsed_seq_id, int16_t effective_seq_id_type, const list< string > &secondary_id_list, const string &primary_id, SBioseqResolution &bioseq_resolution)
void x_ResolveSeqId(void)
void x_OnAsyncBioseqInfoResolveError(CRequestStatus::ECode status, int code, EDiagSev severity, const string &message, EPSGS_LoggingFlag loging_flag=ePSGS_NeedLogging)
void x_OnResolutionGoodData(void)
virtual ~CPSGS_ResolveBase()
EPSGS_CacheLookupResult x_ResolveSecondaryOSLTInCache(const string &secondary_id, int16_t effective_seq_id_type, SBioseqResolution &bioseq_resolution)
void x_OnSeqIdResolveError(CRequestStatus::ECode status, int code, EDiagSev severity, const string &message, EPSGS_LoggingFlag loging_flag=ePSGS_NeedLogging)
SBioseqResolution ResolveTestInputSeqId(void)
void ResolveInputSeqId(void)
TSeqIdResolutionErrorCB m_FinalErrorCB
EPSGS_CacheLookupResult x_ResolvePrimaryOSLTInCache(const string &primary_id, int16_t effective_version, int16_t effective_seq_id_type, SBioseqResolution &bioseq_resolution)
EPSGS_CacheLookupResult x_ResolveAsIsInCache(SBioseqResolution &bioseq_resolution)
TSeqIdResolutionFinishedCB m_FinalFinishedCB
bool x_ComposeOSLT(CSeq_id &parsed_seq_id, int16_t &effective_seq_id_type, list< string > &secondary_id_list, string &primary_id)
void x_OnSeqIdResolveFinished(SBioseqResolution &&bioseq_resolution)
TSeqIdResolutionStartProcessingCB m_FinalStartProcessingCB
void x_RegisterSuccessTiming(const SBioseqResolution &bioseq_resolution)
SPSGS_RequestBase::EPSGS_CacheAndDbUse x_GetRequestUseCache(void)
static CPubseqGatewayApp * GetInstance(void)
virtual void Process(void)=0
Main processing function.
shared_ptr< CPSGS_Reply > m_Reply
bool GetEffectiveSeqIdType(const objects::CSeq_id &parsed_seq_id, int request_seq_id_type, int16_t &eff_seq_id_type, bool need_trace)
shared_ptr< CPSGS_Request > m_Request
EPSGS_SeqIdParsingResult ParseInputSeqId(objects::CSeq_id &seq_id, const string &request_seq_id, int request_seq_id_type, string *err_msg=nullptr)
Parse seq-id from a string and type representation.
EDiagSev
Severity level for the posted diagnostics.
@ eDiag_Error
Error message.
@ 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.
string ComposeOSLT(list< string > *secondary_ids=nullptr, TComposeOSLTFlags parse_flags=0) const
JIRA ID-5188 : Compose OSLT string for the primary id, as well as OSLT strings for the secondary ids,...
const CTextseq_id * GetTextseq_Id(void) const
Return embedded CTextseq_id, if any.
@ fGpipeAddSecondary
Add "ACC.VER(=1)" for a 2ndary id.
static string & ToUpper(string &str)
Convert string to upper case – string& version.
Defines NCBI C++ diagnostic APIs, classes, and macros.
Defines CRequestStatus class for NCBI C++ diagnostic API.
EPSGS_ResolutionResult m_ResolutionResult
CBioseqInfoRecord & GetBioseqInfo(void)
void SetBioseqInfo(const CBioseqInfoRecord &record)
SResolveInputSeqIdError m_Error
@ eResolutionFoundInCassandra