NCBI C++ ToolKit
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
CPSGS_ResolveBase Class Reference

Search Toolkit Book for CPSGS_ResolveBase

#include "resolve_base.hpp"
(Private to src/app/pubseq_gateway/server.)

+ Inheritance diagram for CPSGS_ResolveBase:
+ Collaboration diagram for CPSGS_ResolveBase:

Public Member Functions

 CPSGS_ResolveBase ()
 
 CPSGS_ResolveBase (shared_ptr< CPSGS_Request > request, shared_ptr< CPSGS_Reply > reply, TSeqIdResolutionFinishedCB finished_cb, TSeqIdResolutionErrorCB error_cb, TSeqIdResolutionStartProcessingCB resolution_start_processing_cb)
 
virtual ~CPSGS_ResolveBase ()
 
SBioseqResolution ResolveTestInputSeqId (void)
 
- Public Member Functions inherited from CPSGS_AsyncResolveBase
 CPSGS_AsyncResolveBase ()
 
 CPSGS_AsyncResolveBase (shared_ptr< CPSGS_Request > request, shared_ptr< CPSGS_Reply > reply, TContinueResolveCB continue_resolve_cb, TSeqIdResolutionFinishedCB finished_cb, TSeqIdResolutionErrorCB error_cb, TSeqIdResolutionStartProcessingCB start_processing_cb)
 
virtual ~CPSGS_AsyncResolveBase ()
 
void Process (int16_t effective_version, int16_t effective_seq_id_type, list< string > &&secondary_id_list, string &&primary_seq_id, bool composed_ok, SBioseqResolution &&bioseq_resolution)
 
void x_OnBioseqInfo (vector< CBioseqInfoRecord > &&records)
 
void x_OnBioseqInfoWithoutSeqIdType (vector< CBioseqInfoRecord > &&records)
 
void x_OnBioseqInfoError (CRequestStatus::ECode status, int code, EDiagSev severity, const string &message)
 
void x_OnSi2csiRecord (vector< CSI2CSIRecord > &&records)
 
void x_OnSi2csiError (CRequestStatus::ECode status, int code, EDiagSev severity, const string &message)
 
- Public Member Functions inherited from CPSGS_CassProcessorBase
 CPSGS_CassProcessorBase ()
 
 CPSGS_CassProcessorBase (shared_ptr< CPSGS_Request > request, shared_ptr< CPSGS_Reply > reply, TProcessorPriority priority)
 
virtual ~CPSGS_CassProcessorBase ()
 
virtual void Cancel (void)
 The infrastructure request to cancel processing. More...
 
void SignalFinishProcessing (void)
 
void UnlockWaitingProcessor (void)
 
void CallOnData (void)
 
string GetVerboseFetches (void) const
 
void EnforceWait (void) const
 
- Public Member Functions inherited from IPSGS_Processor
 IPSGS_Processor ()
 
virtual ~IPSGS_Processor ()
 
virtual bool CanProcess (shared_ptr< CPSGS_Request > request, shared_ptr< CPSGS_Reply > reply) const
 Tells if processor can process the given request. More...
 
virtual vector< stringWhatCanProcess (shared_ptr< CPSGS_Request > request, shared_ptr< CPSGS_Reply > reply) const
 Needs to be implemented only for the ID/get_na requests. More...
 
virtual IPSGS_ProcessorCreateProcessor (shared_ptr< CPSGS_Request > request, shared_ptr< CPSGS_Reply > reply, TProcessorPriority priority) const =0
 Create processor to fulfil PSG request using the data source. More...
 
virtual void Process (void)=0
 Main processing function. More...
 
virtual string GetName (void) const =0
 Tells the processor name (used in logging and tracing) More...
 
virtual string GetGroupName (void) const =0
 Tells the processor group name. More...
 
virtual void ProcessEvent (void)
 Called when an event happened which may require to have some processing. More...
 
shared_ptr< CPSGS_RequestGetRequest (void) const
 Provides the user request. More...
 
shared_ptr< CPSGS_ReplyGetReply (void) const
 Provides the reply wrapper. More...
 
TProcessorPriority GetPriority (void) const
 Provides the processor priority. More...
 
void PostponeInvoke (CPSGS_UvLoopBinder::TProcessorCB cb, void *user_data)
 The provided callback will be called from the libuv loop assigned to the processor. More...
 
void SetSocketCallback (int fd, CPSGS_SocketIOCallback::EPSGS_Event event, uint64_t timeout_millisec, void *user_data, CPSGS_SocketIOCallback::TEventCB event_cb, CPSGS_SocketIOCallback::TTimeoutCB timeout_cb, CPSGS_SocketIOCallback::TErrorCB error_cb)
 The provided callbacks will be called from the libuv loop assigned to the processor when the corresponding event appeared on the provided socket. More...
 
void SetUVThreadId (uv_thread_t uv_thread_id)
 Saves the libuv worker thread id which runs the processor. More...
 
uv_thread_t GetUVThreadId (void) const
 Provides the libuv thread id which runs the processor. More...
 
bool IsUVThreadAssigned (void) const
 Tells if a libuv thread id has been assigned to the processor. More...
 
psg_time_point_t GetProcessInvokeTimestamp (bool &is_valid) const
 Provides the timestamp of when the Process() method was called. More...
 
psg_time_point_t GetSignalStartTimestamp (bool &is_valid) const
 Provides the timestamp of when the processor called SignalStartProcessing() method. More...
 
psg_time_point_t GetSignalFinishTimestamp (bool &is_valid) const
 Provides the timestamp of when the processor called SignalFinishProcessing() method. More...
 
void OnBeforeProcess (void)
 Called just before the virtual Process() method is called. More...
 
EPSGS_StartProcessing SignalStartProcessing (void)
 A processor should call the method when it decides that it successfully started processing the request. More...
 
void SignalFinishProcessing (void)
 A processor should call this method when it decides that there is nothing else to be done. More...
 
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. More...
 
- Public Member Functions inherited from CPSGS_AsyncBioseqInfoBase
 CPSGS_AsyncBioseqInfoBase ()
 
 CPSGS_AsyncBioseqInfoBase (shared_ptr< CPSGS_Request > request, shared_ptr< CPSGS_Reply > reply, TSeqIdResolutionFinishedCB finished_cb, TSeqIdResolutionErrorCB error_cb)
 
virtual ~CPSGS_AsyncBioseqInfoBase ()
 

Protected Member Functions

void ResolveInputSeqId (void)
 
void ResolveInputSeqId (const string &seq_id, int16_t seq_id_type)
 
- Protected Member Functions inherited from CPSGS_AsyncResolveBase
int16_t GetEffectiveVersion (const CTextseq_id *text_seq_id)
 
SPSGS_ResolveRequest::TPSGS_BioseqIncludeData GetBioseqInfoFields (void)
 
bool NonKeyBioseqInfoFieldsRequested (void)
 
bool CanSkipBioseqInfoRetrieval (const CBioseqInfoRecord &bioseq_info_record)
 
SPSGS_RequestBase::EPSGS_AccSubstitutioOption GetAccessionSubstitutionOption (void)
 
EPSGS_AccessionAdjustmentResult AdjustBioseqAccession (SBioseqResolution &bioseq_resolution)
 
void SetupSeqIdToResolve (void)
 
void SetupSeqIdToResolve (const string &seq_id, int16_t seq_id_type)
 
string GetCouldNotResolveMessage (void) const
 
psg_time_point_t GetAsyncResolutionStartTimestamp (void) const
 
void SetAsyncResolutionStartTimestamp (const psg_time_point_t &ts)
 
bool MoveToNextSeqId (void)
 
- Protected Member Functions inherited from CPSGS_CassProcessorBase
IPSGS_Processor::EPSGS_Status GetStatus (void) override
 Tells the processor status (if it has finished or in progress) More...
 
bool AreAllFinishedRead (void) const
 
bool IsMyNCBIFinished (void) const
 
void UpdateOverallStatus (CRequestStatus::ECode status)
 
bool IsCassandraProcessorEnabled (shared_ptr< CPSGS_Request > request) const
 
void CancelLoaders (void)
 
SCass_BlobId TranslateSatToKeyspace (CBioseqInfoRecord::TSat sat, CBioseqInfoRecord::TSatKey sat_key, const string &seq_id)
 
bool IsTimeoutError (const string &msg) const
 
bool IsTimeoutError (int code) const
 
bool IsError (EDiagSev severity) const
 
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)
 
EPSGS_MyNCBILookupResult PopulateMyNCBIUser (TMyNCBIDataCB data_cb, TMyNCBIErrorCB error_cb)
 
void ReportNoWebCubbyUser (void)
 
void ReportExplicitIncludeHUPSetToNo (void)
 
void ReportMyNCBIError (const string &my_ncbi_message)
 
void ReportMyNCBINotFound (void)
 
void ReportSecureSatUnauthorized (const string &user_name)
 
void ReportFailureToGetCassConnection (const string &message)
 
void ReportFailureToGetCassConnection (void)
 
void CleanupMyNCBICache (void)
 
- Protected Member Functions inherited from IPSGS_Processor
bool GetEffectiveSeqIdType (const objects::CSeq_id &parsed_seq_id, int request_seq_id_type, int16_t &eff_seq_id_type, bool need_trace)
 
- Protected Member Functions inherited from CPSGS_AsyncBioseqInfoBase
void MakeRequest (SBioseqResolution &&bioseq_resolution)
 

Private Member Functions

SPSGS_RequestBase::EPSGS_CacheAndDbUse x_GetRequestUseCache (void)
 
bool x_ComposeOSLT (CSeq_id &parsed_seq_id, int16_t &effective_seq_id_type, list< string > &secondary_id_list, string &primary_id)
 
EPSGS_CacheLookupResult x_ResolvePrimaryOSLTInCache (const string &primary_id, int16_t effective_version, int16_t effective_seq_id_type, SBioseqResolution &bioseq_resolution)
 
EPSGS_CacheLookupResult x_ResolveSecondaryOSLTInCache (const string &secondary_id, int16_t effective_seq_id_type, SBioseqResolution &bioseq_resolution)
 
EPSGS_CacheLookupResult x_ResolveAsIsInCache (SBioseqResolution &bioseq_resolution)
 
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_OnResolutionGoodData (void)
 
void x_OnSeqIdResolveError (CRequestStatus::ECode status, int code, EDiagSev severity, const string &message, EPSGS_LoggingFlag loging_flag=ePSGS_NeedLogging)
 
void x_OnAsyncBioseqInfoResolveError (CRequestStatus::ECode status, int code, EDiagSev severity, const string &message, EPSGS_LoggingFlag loging_flag=ePSGS_NeedLogging)
 
void x_OnSeqIdResolveFinished (SBioseqResolution &&bioseq_resolution)
 
void x_RegisterSuccessTiming (const SBioseqResolution &bioseq_resolution)
 

Private Attributes

TSeqIdResolutionFinishedCB m_FinalFinishedCB
 
TSeqIdResolutionErrorCB m_FinalErrorCB
 
TSeqIdResolutionStartProcessingCB m_FinalStartProcessingCB
 
bool m_AsyncStarted
 

Additional Inherited Members

- Public Types inherited from IPSGS_Processor
enum  EPSGS_Status {
  ePSGS_InProgress , ePSGS_Done , ePSGS_NotFound , ePSGS_Canceled ,
  ePSGS_Timeout , ePSGS_Error , ePSGS_Unauthorized
}
 The GetStatus() method returns a processor current status. More...
 
enum  EPSGS_StartProcessing { ePSGS_Proceed , ePSGS_Cancel }
 Tells wether to continue or not after a processor called SignalStartProcessing() method. More...
 
- Static Public Member Functions inherited from IPSGS_Processor
static string StatusToString (EPSGS_Status status)
 Converts the processor status to a string for tracing and logging purposes. More...
 
static string StatusToProgressMessage (EPSGS_Status status)
 Converts the processor status to a string for protocol message. More...
 
- Protected Types inherited from CPSGS_CassProcessorBase
enum  EPSGS_MyNCBILookupResult {
  ePSGS_IncludeHUPSetToNo , ePSGS_FoundInOKCache , ePSGS_FoundInErrorCache , ePSGS_FoundInNotFoundCache ,
  ePSGS_CookieNotPresent , ePSGS_RequestInitiated , ePSGS_AddedToWaitlist
}
 
- Protected Attributes inherited from CPSGS_AsyncResolveBase
TContinueResolveCB m_ContinueResolveCB
 
TSeqIdResolutionFinishedCB m_FinishedCB
 
TSeqIdResolutionErrorCB m_ErrorCB
 
TSeqIdResolutionStartProcessingCB m_StartProcessingCB
 
EPSGS_ResolveStage m_ResolveStage
 
bool m_ComposedOk
 
string m_PrimarySeqId
 
int16_t m_EffectiveVersion
 
int16_t m_EffectiveSeqIdType
 
size_t m_SecondaryIndex
 
list< stringm_SecondaryIdList
 
SBioseqResolution m_BioseqResolution
 
CCassFetchm_CurrentFetch
 
CCassFetchm_NoSeqIdTypeFetch
 
CBioseqInfoRecord::TAccession m_BioseqInfoRequestedAccession
 
CBioseqInfoRecord::TVersion m_BioseqInfoRequestedVersion
 
CBioseqInfoRecord::TSeqIdType m_BioseqInfoRequestedSeqIdType
 
CBioseqInfoRecord::TGI m_BioseqInfoRequestedGI
 
psg_time_point_t m_BioseqInfoStart
 
psg_time_point_t m_Si2csiStart
 
psg_time_point_t m_AsyncCassResolutionStart
 
bool m_StartProcessingCalled
 
list< SPSGSeqIdm_SeqIdsToResolve
 
list< SPSGSeqId >::const_iterator m_CurrentSeqIdToResolve
 
CPSGSResolveErrors m_ResolveErrors
 
- Protected Attributes inherited from CPSGS_CassProcessorBase
list< unique_ptr< CCassFetch > > m_FetchDetails
 
bool m_Canceled
 
bool m_Unlocked
 
CRequestStatus::ECode m_Status
 
optional< stringm_UserName
 
shared_ptr< CPSG_MyNCBIRequest_WhoAmIm_WhoAmIRequest
 
optional< stringm_MyNCBICookie
 
- Protected Attributes inherited from IPSGS_Processor
shared_ptr< CPSGS_Requestm_Request
 
shared_ptr< CPSGS_Replym_Reply
 
TProcessorPriority m_Priority
 
bool m_FinishSignalled
 
uv_thread_t m_UVThreadId
 

Detailed Description

Definition at line 56 of file resolve_base.hpp.

Constructor & Destructor Documentation

◆ CPSGS_ResolveBase() [1/2]

CPSGS_ResolveBase::CPSGS_ResolveBase ( )

Definition at line 55 of file resolve_base.cpp.

◆ CPSGS_ResolveBase() [2/2]

CPSGS_ResolveBase::CPSGS_ResolveBase ( shared_ptr< CPSGS_Request request,
shared_ptr< CPSGS_Reply reply,
TSeqIdResolutionFinishedCB  finished_cb,
TSeqIdResolutionErrorCB  error_cb,
TSeqIdResolutionStartProcessingCB  resolution_start_processing_cb 
)

Definition at line 59 of file resolve_base.cpp.

◆ ~CPSGS_ResolveBase()

CPSGS_ResolveBase::~CPSGS_ResolveBase ( )
virtual

Definition at line 85 of file resolve_base.cpp.

Member Function Documentation

◆ ResolveInputSeqId() [1/2]

void CPSGS_ResolveBase::ResolveInputSeqId ( const string seq_id,
int16_t  seq_id_type 
)
protected

◆ ResolveInputSeqId() [2/2]

void CPSGS_ResolveBase::ResolveInputSeqId ( void  )
protected

◆ ResolveTestInputSeqId()

SBioseqResolution CPSGS_ResolveBase::ResolveTestInputSeqId ( void  )

◆ x_ComposeOSLT()

bool CPSGS_ResolveBase::x_ComposeOSLT ( CSeq_id parsed_seq_id,
int16_t effective_seq_id_type,
list< string > &  secondary_id_list,
string primary_id 
)
private

◆ x_GetRequestUseCache()

SPSGS_RequestBase::EPSGS_CacheAndDbUse CPSGS_ResolveBase::x_GetRequestUseCache ( void  )
private

◆ x_OnAsyncBioseqInfoResolveError()

void CPSGS_ResolveBase::x_OnAsyncBioseqInfoResolveError ( CRequestStatus::ECode  status,
int  code,
EDiagSev  severity,
const string message,
EPSGS_LoggingFlag  loging_flag = ePSGS_NeedLogging 
)
private

◆ x_OnResolutionGoodData()

void CPSGS_ResolveBase::x_OnResolutionGoodData ( void  )
private

Definition at line 646 of file resolve_base.cpp.

References m_FinalStartProcessingCB.

Referenced by x_OnSeqIdResolveFinished().

◆ x_OnSeqIdResolveError()

void CPSGS_ResolveBase::x_OnSeqIdResolveError ( CRequestStatus::ECode  status,
int  code,
EDiagSev  severity,
const string message,
EPSGS_LoggingFlag  loging_flag = ePSGS_NeedLogging 
)
private

◆ x_OnSeqIdResolveFinished()

void CPSGS_ResolveBase::x_OnSeqIdResolveFinished ( SBioseqResolution &&  bioseq_resolution)
private

◆ x_RegisterSuccessTiming()

void CPSGS_ResolveBase::x_RegisterSuccessTiming ( const SBioseqResolution bioseq_resolution)
private

◆ x_ResolveAsIsInCache()

EPSGS_CacheLookupResult CPSGS_ResolveBase::x_ResolveAsIsInCache ( SBioseqResolution bioseq_resolution)
private

◆ x_ResolvePrimaryOSLTInCache()

EPSGS_CacheLookupResult CPSGS_ResolveBase::x_ResolvePrimaryOSLTInCache ( const string primary_id,
int16_t  effective_version,
int16_t  effective_seq_id_type,
SBioseqResolution bioseq_resolution 
)
private

◆ x_ResolveSecondaryOSLTInCache()

EPSGS_CacheLookupResult CPSGS_ResolveBase::x_ResolveSecondaryOSLTInCache ( const string secondary_id,
int16_t  effective_seq_id_type,
SBioseqResolution bioseq_resolution 
)
private

◆ x_ResolveSeqId()

void CPSGS_ResolveBase::x_ResolveSeqId ( void  )
private

Definition at line 325 of file resolve_base.cpp.

References CPSGS_AsyncResolveBase::AdjustBioseqAccession(), CPSGSResolveErrors::AppendError(), CPSGS_AsyncResolveBase::CanSkipBioseqInfoRetrieval(), CRequestStatus::e404_NotFound, eDiag_Error, ePSGS_BioseqCache, ePSGS_CacheHit, SPSGS_RequestBase::ePSGS_CacheOnly, SPSGS_RequestBase::ePSGS_DbOnly, CPSGSCounters::ePSGS_InputSeqIdNotResolved, ePSGS_LogicError, ePSGS_ParsedOK, ePSGS_SeqIdsEmpty, ePSGS_Si2csiCache, ePSGS_SkipLogging, ePSGS_UnresolvedSeqId, SBioseqResolution::GetBioseqInfo(), CPSGSResolveErrors::GetCombinedErrorCode(), CPSGSResolveErrors::GetCombinedErrorMessage(), CPSGS_AsyncResolveBase::GetCouldNotResolveMessage(), CPSGS_AsyncResolveBase::GetEffectiveVersion(), CPubseqGatewayApp::GetInstance(), CSeq_id::GetTextseq_Id(), SResolveInputSeqIdError::HasError(), SBioseqResolution::IsValid(), CPSGCache::LookupBioseqInfo(), m_AsyncStarted, CPSGS_AsyncResolveBase::m_CurrentSeqIdToResolve, SBioseqResolution::m_Error, SResolveInputSeqIdError::m_ErrorCode, SResolveInputSeqIdError::m_ErrorMessage, IPSGS_Processor::m_Reply, IPSGS_Processor::m_Request, SBioseqResolution::m_ResolutionResult, CPSGS_AsyncResolveBase::m_ResolveErrors, CPSGS_AsyncResolveBase::m_SeqIdsToResolve, CPSGS_AsyncResolveBase::MoveToNextSeqId(), IPSGS_Processor::ParseInputSeqId(), IPSGS_Processor::Process(), SBioseqResolution::Reset(), x_ComposeOSLT(), x_GetRequestUseCache(), x_OnSeqIdResolveError(), x_OnSeqIdResolveFinished(), x_ResolveAsIsInCache(), and x_ResolveViaComposeOSLTInCache().

Referenced by ResolveInputSeqId(), x_OnAsyncBioseqInfoResolveError(), and x_OnSeqIdResolveFinished().

◆ x_ResolveViaComposeOSLTInCache()

void CPSGS_ResolveBase::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 
)
private

Member Data Documentation

◆ m_AsyncStarted

bool CPSGS_ResolveBase::m_AsyncStarted
private

◆ m_FinalErrorCB

TSeqIdResolutionErrorCB CPSGS_ResolveBase::m_FinalErrorCB
private

Definition at line 122 of file resolve_base.hpp.

Referenced by x_OnSeqIdResolveError().

◆ m_FinalFinishedCB

TSeqIdResolutionFinishedCB CPSGS_ResolveBase::m_FinalFinishedCB
private

Definition at line 121 of file resolve_base.hpp.

Referenced by x_OnSeqIdResolveFinished().

◆ m_FinalStartProcessingCB

TSeqIdResolutionStartProcessingCB CPSGS_ResolveBase::m_FinalStartProcessingCB
private

Definition at line 123 of file resolve_base.hpp.

Referenced by x_OnResolutionGoodData().


The documentation for this class was generated from the following files:
Modified on Wed May 15 15:08:29 2024 by modify_doxy.py rev. 669887