NCBI C++ ToolKit
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
IPSGS_Processor Class Referenceabstract

Search Toolkit Book for IPSGS_Processor

Interface class (and self-factory) for request processor objects that can retrieve data from a given data source. More...

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

+ Inheritance diagram for IPSGS_Processor:
+ Collaboration diagram for IPSGS_Processor:

Public Types

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...
 

Public Member Functions

 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 void Cancel (void)=0
 The infrastructure request to cancel processing. More...
 
virtual EPSGS_Status GetStatus (void)=0
 Tells the processor status (if it has finished or in progress) 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...
 

Static Public Member Functions

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 Member Functions

bool GetEffectiveSeqIdType (const objects::CSeq_id &parsed_seq_id, int request_seq_id_type, int16_t &eff_seq_id_type, bool need_trace)
 

Protected Attributes

shared_ptr< CPSGS_Requestm_Request
 
shared_ptr< CPSGS_Replym_Reply
 
TProcessorPriority m_Priority
 
bool m_FinishSignalled
 
uv_thread_t m_UVThreadId
 

Private Attributes

bool m_ProcessInvokeTimestampInitialized
 
psg_time_point_t m_ProcessInvokeTimestamp
 
bool m_SignalStartTimestampInitialized
 
psg_time_point_t m_SignalStartTimestamp
 
bool m_SignalFinishTimestampInitialized
 
psg_time_point_t m_SignalFinishTimestamp
 

Detailed Description

Interface class (and self-factory) for request processor objects that can retrieve data from a given data source.

The overal life cycle of the processors is as follows. There is a one-time processors registration stage. On this stage a default processor constructor will be used. Then at the time when a request comes, all the registred processors will receive the CreateProcessor(...) call. All not NULL processors will be considered as those which are able to process the request. Later the infrastructure will call the created processors Process() method in parallel and periodically will call GetStatus() method. When all processors finished it is considered as the end of the request processing.

There are a few agreements for the processors.

Definition at line 72 of file ipsgs_processor.hpp.

Member Enumeration Documentation

◆ EPSGS_StartProcessing

Tells wether to continue or not after a processor called SignalStartProcessing() method.

Enumerator
ePSGS_Proceed 
ePSGS_Cancel 

Definition at line 311 of file ipsgs_processor.hpp.

◆ EPSGS_Status

The GetStatus() method returns a processor current status.

The order is important: basing on it a worst (max) and best (min) status is calculated for a group of processors.

Enumerator
ePSGS_InProgress 
ePSGS_Done 
ePSGS_NotFound 
ePSGS_Canceled 
ePSGS_Timeout 
ePSGS_Error 
ePSGS_Unauthorized 

Definition at line 78 of file ipsgs_processor.hpp.

Constructor & Destructor Documentation

◆ IPSGS_Processor()

IPSGS_Processor::IPSGS_Processor ( )
inline

Definition at line 97 of file ipsgs_processor.hpp.

◆ ~IPSGS_Processor()

virtual IPSGS_Processor::~IPSGS_Processor ( )
inlinevirtual

Definition at line 104 of file ipsgs_processor.hpp.

Member Function Documentation

◆ Cancel()

virtual void IPSGS_Processor::Cancel ( void  )
pure virtual

◆ CanProcess()

virtual bool IPSGS_Processor::CanProcess ( shared_ptr< CPSGS_Request request,
shared_ptr< CPSGS_Reply reply 
) const
inlinevirtual

Tells if processor can process the given request.

Parameters
requestPSG request to retrieve the data for. It is guaranteed to be not null.
replyThe way to send reply chunks to the client. It is guaranteed to be not null.
Returns
true if the processor can process the request

Reimplemented in CPSGS_WGSProcessor, CPSGS_SNPProcessor, CPSGS_OSGProcessor, CPSGS_DummyProcessor, CPSGS_CDDProcessor, CPSGS_CassProcessorDispatcher, CPSGS_TSEChunkProcessor, CPSGS_ResolveProcessor, CPSGS_IPGResolveProcessor, CPSGS_GetBlobProcessor, CPSGS_GetProcessor, CPSGS_AnnotProcessor, and CPSGS_AccessionVersionHistoryProcessor.

Definition at line 116 of file ipsgs_processor.hpp.

◆ CreateProcessor()

virtual IPSGS_Processor* IPSGS_Processor::CreateProcessor ( shared_ptr< CPSGS_Request request,
shared_ptr< CPSGS_Reply reply,
TProcessorPriority  priority 
) const
pure virtual

Create processor to fulfil PSG request using the data source.

Parameters
requestPSG request to retrieve the data for. It is guaranteed to be not null.
replyThe way to send reply chunks to the client. It is guaranteed to be not null.
Returns
New processor object if this processor can theoretically fulfill (all or a part of) the request; else NULL.

Implemented in CPSGS_WGSProcessor, CPSGS_SNPProcessor, CPSGS_OSGProcessorBase, CPSGS_OSGProcessor, CPSGS_CDDProcessor, CPSGS_TSEChunkProcessor, CPSGS_ResolveProcessor, CPSGS_IPGResolveProcessor, CPSGS_GetBlobProcessor, CPSGS_GetProcessor, CPSGS_DummyProcessor, CPSGS_CassProcessorDispatcher, CPSGS_AnnotProcessor, and CPSGS_AccessionVersionHistoryProcessor.

◆ GetEffectiveSeqIdType()

bool IPSGS_Processor::GetEffectiveSeqIdType ( const objects::CSeq_id &  parsed_seq_id,
int  request_seq_id_type,
int16_t eff_seq_id_type,
bool  need_trace 
)
protected

◆ GetGroupName()

virtual string IPSGS_Processor::GetGroupName ( void  ) const
pure virtual

Tells the processor group name.

For example, all the processors which retrieve data from Cassandra should return the same name in response to this call. This name is used to control the total number of simultaneously working processors retrieving from the same backend.

Returns
the processor group name

Implemented in CPSGS_WGSProcessor, CPSGS_SNPProcessor, CPSGS_OSGProcessor, CPSGS_CDDProcessor, CPSGS_TSEChunkProcessor, CPSGS_ResolveProcessor, CPSGS_IPGResolveProcessor, CPSGS_GetBlobProcessor, CPSGS_GetProcessor, CPSGS_DummyProcessor, CPSGS_CassProcessorDispatcher, CPSGS_AnnotProcessor, CPSGS_AccessionVersionHistoryProcessor, CPSGS_OSGGetBlobBySeqId, CPSGS_OSGResolve, CPSGS_OSGGetChunks, CPSGS_OSGGetBlob, and CPSGS_OSGAnnot.

Referenced by CPSGSCounters::Increment(), COperationTiming::Register(), COperationTiming::RegisterProcessorDone(), and COperationTiming::RegisterProcessorPerformance().

◆ GetName()

virtual string IPSGS_Processor::GetName ( void  ) const
pure virtual

Tells the processor name (used in logging and tracing)

Returns
the processor name

Implemented in CPSGS_WGSProcessor, CPSGS_SNPProcessor, CPSGS_OSGProcessor, CPSGS_CDDProcessor, CPSGS_TSEChunkProcessor, CPSGS_ResolveProcessor, CPSGS_IPGResolveProcessor, CPSGS_GetBlobProcessor, CPSGS_GetProcessor, CPSGS_DummyProcessor, CPSGS_CassProcessorDispatcher, CPSGS_AnnotProcessor, CPSGS_AccessionVersionHistoryProcessor, CPSGS_OSGGetBlobBySeqId, CPSGS_OSGResolve, CPSGS_OSGGetChunks, CPSGS_OSGGetBlob, and CPSGS_OSGAnnot.

Referenced by PostponeInvoke(), CPSGS_OSGGetBlobBase::ProcessBlobReply(), CPSGS_OSGResolveBase::ProcessResolveReply(), CPSGS_CassProcessorBase::ReportExplicitIncludeHUPSetToNo(), CPSGS_CassProcessorBase::ReportFailureToGetCassConnection(), CPSGS_CassProcessorBase::ReportMyNCBIError(), CPSGS_CassProcessorBase::ReportMyNCBINotFound(), CPSGS_CassProcessorBase::ReportNoWebCubbyUser(), CPSGS_CassProcessorBase::ReportSecureSatUnauthorized(), CPSGS_OSGGetBlobBase::SendBlob(), CPSGS_OSGProcessorBase::SendError(), CPSGS_OSGGetBlobBase::SendExcludedBlob(), CPSGS_OSGResolveBase::SendResult(), SetSocketCallback(), CPSGS_Dispatcher::SignalFinishProcessing(), CPSGS_Dispatcher::SignalStartProcessing(), CPSGS_CassProcessorBase::TranslateSatToKeyspace(), CPSGS_OSGGetBlobBase::x_SendBlobData(), CPSGS_OSGGetBlobBase::x_SendBlobProps(), CPSGS_OSGGetBlobBase::x_SendChunkBlobData(), CPSGS_OSGGetBlobBase::x_SendChunkBlobProps(), CPSGS_OSGGetBlobBase::x_SendForbiddenBlob(), and CPSGS_Dispatcher::x_SendProgressMessage().

◆ GetPriority()

TProcessorPriority IPSGS_Processor::GetPriority ( void  ) const
inline

◆ GetProcessInvokeTimestamp()

psg_time_point_t IPSGS_Processor::GetProcessInvokeTimestamp ( bool is_valid) const
inline

Provides the timestamp of when the Process() method was called.

Returns
Process() method invoke timestamp

Definition at line 279 of file ipsgs_processor.hpp.

References m_ProcessInvokeTimestamp, and m_ProcessInvokeTimestampInitialized.

Referenced by COperationTiming::RegisterProcessorPerformance().

◆ GetReply()

shared_ptr<CPSGS_Reply> IPSGS_Processor::GetReply ( void  ) const
inline

Provides the reply wrapper.

Returns
Reply wrapper which lets to send reply chunks to the user

Definition at line 200 of file ipsgs_processor.hpp.

References m_Reply.

Referenced by CPSGS_SNPProcessor::GetAnnotation(), CPSGS_CDDProcessor::GetBlobByBlobId(), CPSGS_SNPProcessor::GetBlobByBlobId(), CPSGS_WGSProcessor::GetBlobByBlobId(), CPSGS_CDDProcessor::GetBlobBySeqId(), CPSGS_WGSProcessor::GetBlobBySeqId(), CPSGS_CDDProcessor::GetBlobId(), CPSGS_SNPProcessor::GetChunk(), CPSGS_WGSProcessor::GetChunk(), CPSGS_SNPProcessor::OnGotAnnotation(), CPSGS_CDDProcessor::OnGotBlobByBlobId(), CPSGS_SNPProcessor::OnGotBlobByBlobId(), CPSGS_WGSProcessor::OnGotBlobByBlobId(), CPSGS_CDDProcessor::OnGotBlobBySeqId(), CPSGS_WGSProcessor::OnGotBlobBySeqId(), CPSGS_CDDProcessor::OnGotBlobId(), CPSGS_SNPProcessor::OnGotChunk(), CPSGS_WGSProcessor::OnGotChunk(), CPSGS_WGSProcessor::OnResolvedSeqId(), CMyNCBIDataCallback::operator()(), CMyNCBIErrorCallback::operator()(), CPSGS_WGSProcessor::ResolveSeqId(), CPSGS_OSGAnnot::SendReplies(), CPSGS_OSGResolveBase::SendResult(), CPSGS_Dispatcher::SignalFinishProcessing(), CPSGS_Dispatcher::SignalStartProcessing(), CPSGS_SNPProcessor::x_OnSeqIdResolveError(), CPSGS_SNPProcessor::x_OnSeqIdResolveFinished(), CPSGS_SNPProcessor::x_Peek(), CPSGS_SNPProcessor::x_ProcessAnnotationRequest(), CPSGS_WGSProcessor::x_ProcessBlobBySatSatKeyRequest(), CPSGS_WGSProcessor::x_ProcessBlobBySeqIdRequest(), CPSGS_WGSProcessor::x_ProcessResolveRequest(), CPSGS_WGSProcessor::x_ProcessTSEChunkRequest(), CPSGS_CDDProcessor::x_SendAnnot(), CPSGS_CDDProcessor::x_SendAnnotInfo(), CPSGS_SNPProcessor::x_SendAnnotInfo(), CPSGS_SNPProcessor::x_SendBlobData(), CPSGS_WGSProcessor::x_SendBlobData(), CPSGS_WGSProcessor::x_SendBlobForbidden(), CPSGS_SNPProcessor::x_SendBlobProps(), CPSGS_WGSProcessor::x_SendBlobProps(), CPSGS_SNPProcessor::x_SendChunkBlobData(), CPSGS_WGSProcessor::x_SendChunkBlobData(), CPSGS_SNPProcessor::x_SendChunkBlobProps(), CPSGS_WGSProcessor::x_SendChunkBlobProps(), CPSGS_CDDProcessor::x_SendError(), CPSGS_SNPProcessor::x_SendError(), CPSGS_WGSProcessor::x_SendExcluded(), CPSGS_WGSProcessor::x_SendResult(), and CPSGS_CDDProcessor::x_SignalStartProcessing().

◆ GetRequest()

shared_ptr<CPSGS_Request> IPSGS_Processor::GetRequest ( void  ) const
inline

Provides the user request.

Returns
User request

Definition at line 192 of file ipsgs_processor.hpp.

References m_Request.

Referenced by CPSGS_OSGProcessorBase::AddRequest(), CPSGS_OSGGetBlobBySeqId::BlobIsExcluded(), CPSGS_OSGProcessorBase::CallDoProcessCallback(), CPSGS_OSGProcessorBase::CallDoProcessRepliesCallback(), CPSGS_GetBlobProcessor::CreateProcessor(), CPSGS_TSEChunkProcessor::CreateProcessor(), CPSGS_OSGProcessor::CreateProcessor(), CPSGS_OSGAnnot::CreateRequests(), CPSGS_OSGGetBlob::CreateRequests(), CPSGS_OSGGetChunks::CreateRequests(), CPSGS_OSGResolve::CreateRequests(), CPSGS_OSGGetBlobBySeqId::CreateRequests(), CPSGS_SNPProcessor::GetAnnotation(), CPSGS_CDDProcessor::GetBlobByBlobId(), CPSGS_SNPProcessor::GetBlobByBlobId(), CPSGS_WGSProcessor::GetBlobByBlobId(), CPSGS_CDDProcessor::GetBlobBySeqId(), CPSGS_WGSProcessor::GetBlobBySeqId(), CPSGS_CDDProcessor::GetBlobId(), CPSGS_SNPProcessor::GetChunk(), CPSGS_WGSProcessor::GetChunk(), CPSGS_SNPProcessor::OnGotAnnotation(), CPSGS_CDDProcessor::OnGotBlobByBlobId(), CPSGS_SNPProcessor::OnGotBlobByBlobId(), CPSGS_WGSProcessor::OnGotBlobByBlobId(), CPSGS_CDDProcessor::OnGotBlobBySeqId(), CPSGS_WGSProcessor::OnGotBlobBySeqId(), CPSGS_CDDProcessor::OnGotBlobId(), CPSGS_SNPProcessor::OnGotChunk(), CPSGS_WGSProcessor::OnGotChunk(), CPSGS_WGSProcessor::OnResolvedSeqId(), CMyNCBIDataCallback::operator()(), CMyNCBIErrorCallback::operator()(), CPSGS_Dispatcher::PopulateStatus(), CPSGS_CDDProcessor::Process(), CPSGS_OSGProcessorBase::Process(), CPSGS_SNPProcessor::Process(), CPSGS_WGSProcessor::Process(), CPSGS_OSGAnnot::ProcessReplies(), CPSGS_OSGResolve::ProcessReplies(), CPSGS_OSGGetBlobBySeqId::ProcessReplies(), COperationTiming::Register(), CPSGS_OSGAnnot::RegisterProcessedName(), COperationTiming::RegisterProcessorPerformance(), CPSGS_WGSProcessor::ResolveSeqId(), CPSGS_OSGAnnot::SendReplies(), CPSGS_Dispatcher::SignalFinishProcessing(), CPSGS_Dispatcher::SignalStartProcessing(), CPSGS_OSGProcessorBase::WaitForCassandra(), CPSGS_SNPProcessor::x_OnResolutionGoodData(), CPSGS_SNPProcessor::x_OnSeqIdResolveError(), CPSGS_SNPProcessor::x_OnSeqIdResolveFinished(), CPSGS_SNPProcessor::x_ProcessAnnotationRequest(), CPSGS_SNPProcessor::x_ProcessBlobBySatSatKeyRequest(), CPSGS_WGSProcessor::x_ProcessBlobBySatSatKeyRequest(), CPSGS_WGSProcessor::x_ProcessBlobBySeqIdRequest(), CPSGS_CDDProcessor::x_ProcessGetBlobRequest(), CPSGS_CDDProcessor::x_ProcessResolveRequest(), CPSGS_WGSProcessor::x_ProcessResolveRequest(), CPSGS_SNPProcessor::x_ProcessTSEChunkRequest(), CPSGS_WGSProcessor::x_ProcessTSEChunkRequest(), CPSGS_CDDProcessor::x_ReportResultStatus(), CPSGS_SNPProcessor::x_ReportResultStatusForAllNA(), CPSGS_CDDProcessor::x_SendAnnotInfo(), CPSGS_SNPProcessor::x_SendAnnotInfo(), CPSGS_CDDProcessor::x_SignalStartProcessing(), CPSGS_SNPProcessor::x_SignalStartProcessing(), CPSGS_CDDProcessor::x_UnlockRequest(), CPSGS_SNPProcessor::x_UnlockRequest(), and CPSGS_WGSProcessor::x_WaitForOtherProcessors().

◆ GetSignalFinishTimestamp()

psg_time_point_t IPSGS_Processor::GetSignalFinishTimestamp ( bool is_valid) const
inline

Provides the timestamp of when the processor called SignalFinishProcessing() method.

Returns
SignalFinishProcessing() method invoke timestamp

Definition at line 299 of file ipsgs_processor.hpp.

References m_SignalFinishTimestamp, and m_SignalFinishTimestampInitialized.

◆ GetSignalStartTimestamp()

psg_time_point_t IPSGS_Processor::GetSignalStartTimestamp ( bool is_valid) const
inline

Provides the timestamp of when the processor called SignalStartProcessing() method.

Returns
SignalStartProcessing() method invoke timestamp

Definition at line 289 of file ipsgs_processor.hpp.

References m_SignalStartTimestamp, and m_SignalStartTimestampInitialized.

◆ GetStatus()

virtual EPSGS_Status IPSGS_Processor::GetStatus ( void  )
pure virtual

◆ GetUVThreadId()

uv_thread_t IPSGS_Processor::GetUVThreadId ( void  ) const
inline

Provides the libuv thread id which runs the processor.

Returns
The libuv worker thread id which runs the processor

Definition at line 261 of file ipsgs_processor.hpp.

References m_UVThreadId.

Referenced by CPSGS_Dispatcher::NotifyRequestFinished(), PostponeInvoke(), SetSocketCallback(), and CPSGS_Dispatcher::SignalFinishProcessing().

◆ IsUVThreadAssigned()

bool IPSGS_Processor::IsUVThreadAssigned ( void  ) const
inline

Tells if a libuv thread id has been assigned to the processor.

Basically the assignment of the libuv thread means that the processor has been started i.e. Process() was called before.

Returns
true if the libuv thread has been assigned

Definition at line 271 of file ipsgs_processor.hpp.

References m_UVThreadId.

Referenced by CPSGS_CDDProcessor::Cancel(), CPSGS_SNPProcessor::Cancel(), CPSGS_WGSProcessor::Cancel(), CPSGS_Dispatcher::NotifyRequestFinished(), CPSGS_Dispatcher::SignalFinishProcessing(), and CPSGS_OSGProcessorBase::x_SignalFinishProcessing().

◆ OnBeforeProcess()

void IPSGS_Processor::OnBeforeProcess ( void  )

Called just before the virtual Process() method is called.

Definition at line 350 of file ipsgs_processor.cpp.

References m_ProcessInvokeTimestamp, and m_ProcessInvokeTimestampInitialized.

◆ ParseInputSeqId()

EPSGS_SeqIdParsingResult IPSGS_Processor::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.

Parameters
seq_idDestination seq-id to place parsed value into.
request_seq_idInput string containing seq-id to parse.
request_seq_id_typeInput seq-id type
err_msgOptional string to receive error message if any.
Returns
ePSGS_ParsedOK on success, ePSGS_ParseFailed otherwise.

Definition at line 252 of file ipsgs_processor.cpp.

References CSeq_id::eFasta_AsTypeAndContent, ePSGS_ParsedOK, ePSGS_ParseFailed, GetEffectiveSeqIdType(), IsINSDCSeqIdType(), m_Reply, m_Request, CSeq_id::Set(), StripTrailingVerticalBars(), and CSeq_id_Base::Which().

Referenced by PSGSortSeqIds(), CPSGS_ResolveBase::ResolveTestInputSeqId(), CPSGS_SNPProcessor::x_OnSeqIdResolveFinished(), CPSGS_WGSProcessor::x_ProcessBlobBySeqIdRequest(), CPSGS_WGSProcessor::x_ProcessResolveRequest(), and CPSGS_ResolveBase::x_ResolveSeqId().

◆ PostponeInvoke()

void IPSGS_Processor::PostponeInvoke ( CPSGS_UvLoopBinder::TProcessorCB  cb,
void *  user_data 
)

◆ Process()

virtual void IPSGS_Processor::Process ( void  )
pure virtual

Main processing function.

It should avoid throwing exceptions. In case of errors it must make sure that:

  • the consequent GetStatus() calls return appropriate status
  • call SignalFinishProcessing() if there in no more processor activity If an exception is generated it is still a must for a processor to fulfill the obligations above. The dispatching code will log the message (and possibly trace) and continue in this case.

Implemented in CPSGS_WGSProcessor, CPSGS_SNPProcessor, CPSGS_OSGProcessorBase, CPSGS_OSGProcessor, CPSGS_CDDProcessor, CPSGS_TSEChunkProcessor, CPSGS_ResolveProcessor, CPSGS_IPGResolveProcessor, CPSGS_GetBlobProcessor, CPSGS_GetProcessor, CPSGS_DummyProcessor, CPSGS_CassProcessorDispatcher, CPSGS_AnnotProcessor, and CPSGS_AccessionVersionHistoryProcessor.

Referenced by CPSGS_ResolveBase::x_ResolveSeqId().

◆ ProcessEvent()

virtual void IPSGS_Processor::ProcessEvent ( void  )
inlinevirtual

Called when an event happened which may require to have some processing.

By default nothing should be done. This method can be called as well on a timer event.

Reimplemented in CPSGS_SNPProcessor, CPSGS_TSEChunkProcessor, CPSGS_ResolveProcessor, CPSGS_IPGResolveProcessor, CPSGS_GetBlobProcessor, CPSGS_GetProcessor, CPSGS_AnnotProcessor, and CPSGS_AccessionVersionHistoryProcessor.

Definition at line 186 of file ipsgs_processor.hpp.

◆ SetSocketCallback()

void IPSGS_Processor::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.

Parameters
fdThe socket to poll
eventThe event to wait for
timeout_millisecThe timeout of waiting for the event
user_dataThe data to be passed to the callback
event_cbThe event callback
timeout_cbThe timeout callback
error_cbThe error callback
Note
The processor must make sure the socket is valid

Definition at line 160 of file ipsgs_processor.cpp.

References CPubseqGatewayApp::GetInstance(), GetName(), GetUVThreadId(), m_Request, NCBI_THROW, and PSG_ERROR.

◆ SetUVThreadId()

void IPSGS_Processor::SetUVThreadId ( uv_thread_t  uv_thread_id)
inline

Saves the libuv worker thread id which runs the processor.

To be used by the server framework only.

Parameters
uv_thread_idThe libuv worker thread id which runs the processor

Definition at line 253 of file ipsgs_processor.hpp.

References m_UVThreadId.

◆ SignalFinishProcessing()

void IPSGS_Processor::SignalFinishProcessing ( void  )

◆ SignalStartProcessing()

IPSGS_Processor::EPSGS_StartProcessing IPSGS_Processor::SignalStartProcessing ( void  )

◆ StatusToProgressMessage()

string IPSGS_Processor::StatusToProgressMessage ( IPSGS_Processor::EPSGS_Status  status)
static

Converts the processor status to a string for protocol message.

Definition at line 68 of file ipsgs_processor.cpp.

References ePSGS_Canceled, ePSGS_Done, ePSGS_Error, ePSGS_InProgress, ePSGS_NotFound, ePSGS_Timeout, and ePSGS_Unauthorized.

Referenced by CPSGS_Dispatcher::x_SendProgressMessage().

◆ StatusToString()

string IPSGS_Processor::StatusToString ( IPSGS_Processor::EPSGS_Status  status)
static

Converts the processor status to a string for tracing and logging purposes.

Definition at line 43 of file ipsgs_processor.cpp.

References ePSGS_Canceled, ePSGS_Done, ePSGS_Error, ePSGS_InProgress, ePSGS_NotFound, ePSGS_Timeout, and ePSGS_Unauthorized.

Referenced by CPSGS_Dispatcher::PopulateStatus(), and CPSGS_Dispatcher::SignalFinishProcessing().

◆ WhatCanProcess()

virtual vector<string> IPSGS_Processor::WhatCanProcess ( shared_ptr< CPSGS_Request request,
shared_ptr< CPSGS_Reply reply 
) const
inlinevirtual

Needs to be implemented only for the ID/get_na requests.

It returns a list of named annotations which a processor recognizes as suitable for processing.

Parameters
requestPSG request to retrieve the data for. It is guaranteed to be not null.
replyThe way to send reply chunks to the client. It is guaranteed to be not null.
Returns
a list of annotations which can be processed

Reimplemented in CPSGS_SNPProcessor, CPSGS_OSGProcessor, CPSGS_CDDProcessor, CPSGS_CassProcessorDispatcher, and CPSGS_AnnotProcessor.

Definition at line 132 of file ipsgs_processor.hpp.

Member Data Documentation

◆ m_FinishSignalled

bool IPSGS_Processor::m_FinishSignalled
protected

◆ m_Priority

TProcessorPriority IPSGS_Processor::m_Priority
protected

◆ m_ProcessInvokeTimestamp

psg_time_point_t IPSGS_Processor::m_ProcessInvokeTimestamp
private

Definition at line 363 of file ipsgs_processor.hpp.

Referenced by GetProcessInvokeTimestamp(), and OnBeforeProcess().

◆ m_ProcessInvokeTimestampInitialized

bool IPSGS_Processor::m_ProcessInvokeTimestampInitialized
private

Definition at line 362 of file ipsgs_processor.hpp.

Referenced by GetProcessInvokeTimestamp(), and OnBeforeProcess().

◆ m_Reply

shared_ptr<CPSGS_Reply> IPSGS_Processor::m_Reply
protected

Definition at line 354 of file ipsgs_processor.hpp.

Referenced by CPSGS_AsyncResolveBase::AdjustBioseqAccession(), CPSGS_CassProcessorBase::CallOnData(), CPSGS_CassProcessorBase::CountError(), CPSGS_CassProcessorBase::CPSGS_CassProcessorBase(), CPSGS_DummyProcessor::CPSGS_DummyProcessor(), CPSGS_OSGProcessorBase::CPSGS_OSGProcessorBase(), CPSGS_SNPProcessor::CPSGS_SNPProcessor(), CPSGS_WGSProcessor::CPSGS_WGSProcessor(), GetEffectiveSeqIdType(), GetReply(), CPSGS_AsyncResolveBase::MoveToNextSeqId(), CPSGS_AnnotProcessor::OnAnnotBlobProp(), CPSGS_CassBlobBase::OnGetBlobChunk(), CPSGS_AnnotProcessor::OnGetBlobChunk(), CPSGS_GetProcessor::OnGetBlobChunk(), CPSGS_GetBlobProcessor::OnGetBlobChunk(), CPSGS_TSEChunkProcessor::OnGetBlobChunk(), CPSGS_AnnotProcessor::OnGetBlobError(), CPSGS_GetProcessor::OnGetBlobError(), CPSGS_GetBlobProcessor::OnGetBlobError(), CPSGS_TSEChunkProcessor::OnGetBlobError(), CPSGS_AnnotProcessor::OnGetBlobProp(), CPSGS_CassBlobBase::OnGetBlobProp(), CPSGS_GetProcessor::OnGetBlobProp(), CPSGS_GetBlobProcessor::OnGetBlobProp(), CPSGS_TSEChunkProcessor::OnGetBlobProp(), CPSGS_TSEChunkProcessor::OnGetSplitHistory(), CPSGS_TSEChunkProcessor::OnGetSplitHistoryError(), CPSGS_CassBlobBase::OnPublicComment(), CPSGS_CassBlobBase::OnPublicCommentError(), ParseInputSeqId(), CPSGS_CassProcessorBase::PopulateMyNCBIUser(), CPSGS_GetBlobProcessor::Process(), CPSGS_CassProcessorBase::ReportExplicitIncludeHUPSetToNo(), CPSGS_CassProcessorBase::ReportFailureToGetCassConnection(), CPSGS_CassProcessorBase::ReportMyNCBIError(), CPSGS_CassProcessorBase::ReportMyNCBINotFound(), CPSGS_CassProcessorBase::ReportNoWebCubbyUser(), CPSGS_CassProcessorBase::ReportSecureSatUnauthorized(), CPSGS_OSGProcessorBase::SendError(), CPSGS_OSGGetBlobBase::SendExcludedBlob(), CPSGS_OSGProcessorBase::SendTrace(), CPSGS_AsyncResolveBase::SetupSeqIdToResolve(), CPSGS_CassProcessorBase::TranslateSatToKeyspace(), CPSGS_CassBlobBase::x_BlobChunkCallback(), CPSGS_CassBlobBase::x_BlobErrorCallback(), CPSGS_CassBlobBase::x_BlobPropsCallback(), CPSGS_CassBlobBase::x_CheckId2Info(), CPSGS_ResolveBase::x_ComposeOSLT(), CPSGS_CassBlobBase::x_DecideToRequestMoreChunksForSmartTSE(), CPSGS_CassBlobBase::x_DeserializeSplitInfo(), CPSGS_IPGResolveProcessor::x_DetectSeqIdTypes(), CPSGS_IPGResolveProcessor::x_FormSeqId(), CPSGS_GetProcessor::x_GetBlob(), CPSGS_GetProcessor::x_GetBlobFinalStage(), CPSGS_TSEChunkProcessor::x_GetMyNCBIUser(), CPSGS_IPGResolveProcessor::x_InitiateIPGFetch(), CPSGS_IPGResolveProcessor::x_InitiateResolve(), CPSGS_CassBlobBase::x_IsAuthorized(), CPSGS_AsyncBioseqInfoBase::x_MakeRequest(), CPSGS_AccessionVersionHistoryProcessor::x_OnAccVerHistData(), CPSGS_AccessionVersionHistoryProcessor::x_OnAccVerHistError(), CPSGS_AsyncBioseqInfoBase::x_OnBioseqInfo(), CPSGS_AsyncResolveBase::x_OnBioseqInfo(), CPSGS_AsyncBioseqInfoBase::x_OnBioseqInfoWithoutSeqIdType(), CPSGS_AsyncResolveBase::x_OnBioseqInfoWithoutSeqIdType(), CPSGS_IPGResolveProcessor::x_OnIPGResolveData(), CPSGS_IPGResolveProcessor::x_OnIPGResolveError(), CPSGS_GetProcessor::x_OnMyNCBIError(), CPSGS_GetBlobProcessor::x_OnMyNCBIError(), CPSGS_TSEChunkProcessor::x_OnMyNCBIError(), CPSGS_AnnotProcessor::x_OnNamedAnnotData(), CPSGS_AnnotProcessor::x_OnNamedAnnotError(), CPSGS_AccessionVersionHistoryProcessor::x_OnSeqIdResolveError(), CPSGS_AnnotProcessor::x_OnSeqIdResolveError(), CPSGS_GetProcessor::x_OnSeqIdResolveError(), CPSGS_IPGResolveProcessor::x_OnSeqIdResolveError(), CPSGS_ResolveProcessor::x_OnSeqIdResolveError(), CPSGS_AccessionVersionHistoryProcessor::x_OnSeqIdResolveFinished(), CPSGS_AnnotProcessor::x_OnSeqIdResolveFinished(), CPSGS_ResolveBase::x_OnSeqIdResolveFinished(), CPSGS_AsyncResolveBase::x_OnSi2csiRecord(), CPSGS_AccessionVersionHistoryProcessor::x_Peek(), CPSGS_AnnotProcessor::x_Peek(), CPSGS_GetProcessor::x_Peek(), CPSGS_GetBlobProcessor::x_Peek(), CPSGS_IPGResolveProcessor::x_Peek(), CPSGS_ResolveProcessor::x_Peek(), CPSGS_TSEChunkProcessor::x_Peek(), CPSGS_CassBlobBase::x_PrepareBlobCompletion(), CPSGS_CassBlobBase::x_PrepareBlobData(), CPSGS_CassBlobBase::x_PrepareBlobExcluded(), CPSGS_CassBlobBase::x_PrepareBlobMessage(), CPSGS_CassBlobBase::x_PrepareBlobPropCompletion(), CPSGS_CassBlobBase::x_PrepareBlobPropData(), CPSGS_CassBlobBase::x_PrepareBlobPropMessage(), CPSGS_AsyncResolveBase::x_PreparePrimaryBioseqInfoQuery(), CPSGS_IPGResolveProcessor::x_PrepareRequestOnOriginalValues(), CPSGS_IPGResolveProcessor::x_PrepareRequestOnResolvedlValues(), CPSGS_AsyncResolveBase::x_PrepareSi2csiQuery(), CPSGS_GetBlobProcessor::x_Process(), CPSGS_TSEChunkProcessor::x_ProcessIdModVerId2Info(), CPSGS_TSEChunkProcessor::x_ProcessIdModVerId2InfoFinalStage(), CPSGS_TSEChunkProcessor::x_ProcessSatInfoChunkVerId2InfoFinalStage(), CPSGS_AnnotProcessor::x_RequestBlobProp(), CPSGS_CassBlobBase::x_RequestID2BlobChunks(), CPSGS_CassBlobBase::x_RequestId2SplitBlobs(), CPSGS_CassBlobBase::x_RequestMoreChunksForSmartTSE(), CPSGS_CassBlobBase::x_RequestOriginalBlobChunks(), CPSGS_TSEChunkProcessor::x_RequestTSEChunk(), CPSGS_ResolveBase::x_ResolvePrimaryOSLTInCache(), CPSGS_ResolveBase::x_ResolveSecondaryOSLTInCache(), CPSGS_ResolveBase::x_ResolveSeqId(), CPSGS_AnnotProcessor::x_SendAnnotDataToClient(), CPSGS_AccessionVersionHistoryProcessor::x_SendBioseqInfo(), CPSGS_AnnotProcessor::x_SendBioseqInfo(), CPSGS_GetProcessor::x_SendBioseqInfo(), CPSGS_ResolveProcessor::x_SendBioseqInfo(), CPSGS_OSGGetBlobBase::x_SendBlobData(), CPSGS_OSGGetBlobBase::x_SendBlobProps(), CPSGS_OSGGetBlobBase::x_SendChunkBlobData(), CPSGS_OSGGetBlobBase::x_SendChunkBlobProps(), CPSGS_WGSProcessor::x_SendError(), CPSGS_OSGGetBlobBase::x_SendForbiddenBlob(), and CPSGS_TSEChunkProcessor::x_SendProcessorError().

◆ m_Request

shared_ptr<CPSGS_Request> IPSGS_Processor::m_Request
protected

Definition at line 353 of file ipsgs_processor.hpp.

Referenced by CPSGS_AsyncResolveBase::AdjustBioseqAccession(), CPSGS_AsyncResolveBase::CanSkipBioseqInfoRetrieval(), CPSGS_CassProcessorBase::CountError(), CPSGS_CassProcessorBase::CPSGS_CassProcessorBase(), CPSGS_DummyProcessor::CPSGS_DummyProcessor(), CPSGS_OSGProcessorBase::CPSGS_OSGProcessorBase(), CPSGS_SNPProcessor::CPSGS_SNPProcessor(), CPSGS_WGSProcessor::CPSGS_WGSProcessor(), CPSGS_AsyncResolveBase::GetAccessionSubstitutionOption(), CPSGS_AsyncResolveBase::GetBioseqInfoFields(), GetEffectiveSeqIdType(), GetRequest(), CPSGS_AsyncResolveBase::MoveToNextSeqId(), CPSGS_CassBlobBase::NeedToAddId2CunkId2Info(), CPSGS_AnnotProcessor::OnAnnotBlobProp(), CPSGS_CassBlobBase::OnGetBlobChunk(), CPSGS_TSEChunkProcessor::OnGetBlobChunk(), CPSGS_CassBlobBase::OnGetBlobError(), CPSGS_TSEChunkProcessor::OnGetBlobError(), CPSGS_CassBlobBase::OnGetBlobProp(), CPSGS_TSEChunkProcessor::OnGetBlobProp(), CPSGS_TSEChunkProcessor::OnGetSplitHistory(), CPSGS_TSEChunkProcessor::OnGetSplitHistoryError(), CPSGS_CassBlobBase::OnPublicComment(), CPSGS_CassBlobBase::OnPublicCommentError(), ParseInputSeqId(), CPSGS_CassProcessorBase::PopulateMyNCBIUser(), PostponeInvoke(), CPSGS_AccessionVersionHistoryProcessor::Process(), CPSGS_AnnotProcessor::Process(), CPSGS_GetProcessor::Process(), CPSGS_GetBlobProcessor::Process(), CPSGS_ResolveProcessor::Process(), CPSGS_TSEChunkProcessor::Process(), CPSGS_WGSProcessor::Process(), CPSGS_CassProcessorBase::ReportExplicitIncludeHUPSetToNo(), CPSGS_CassProcessorBase::ReportNoWebCubbyUser(), CPSGS_OSGProcessorBase::SendTrace(), SetSocketCallback(), CPSGS_AsyncResolveBase::SetupSeqIdToResolve(), CPSGS_CassProcessorBase::UnlockWaitingProcessor(), CPSGS_CassBlobBase::x_BlobChunkCallback(), CPSGS_CassBlobBase::x_BlobErrorCallback(), CPSGS_CassBlobBase::x_BlobPropsCallback(), CPSGS_CassBlobBase::x_CheckExcludeBlobCache(), CPSGS_ResolveBase::x_ComposeOSLT(), CPSGS_CassBlobBase::x_DecideToRequestMoreChunksForSmartTSE(), CPSGS_CassBlobBase::x_DeserializeSplitInfo(), CPSGS_IPGResolveProcessor::x_DetectSeqIdTypes(), CPSGS_IPGResolveProcessor::x_FormSeqId(), CPSGS_GetProcessor::x_GetBlobFinalStage(), CPSGS_AsyncResolveBase::x_GetRequestSeqId(), CPSGS_AsyncResolveBase::x_GetRequestSeqIdType(), CPSGS_ResolveBase::x_GetRequestUseCache(), CPSGS_IPGResolveProcessor::x_InitiateIPGFetch(), CPSGS_IPGResolveProcessor::x_InitiateResolve(), CPSGS_CassBlobBase::x_IsAuthorized(), CPSGS_AsyncBioseqInfoBase::x_MakeRequest(), CPSGS_AccessionVersionHistoryProcessor::x_OnAccVerHistData(), CPSGS_AccessionVersionHistoryProcessor::x_OnAccVerHistError(), CPSGS_AsyncBioseqInfoBase::x_OnBioseqInfo(), CPSGS_AsyncResolveBase::x_OnBioseqInfo(), CPSGS_AsyncBioseqInfoBase::x_OnBioseqInfoWithoutSeqIdType(), CPSGS_AsyncResolveBase::x_OnBioseqInfoWithoutSeqIdType(), CPSGS_CassBlobBase::x_OnBlobPropSlimTSE(), CPSGS_CassBlobBase::x_OnBlobPropSmartTSE(), CPSGS_IPGResolveProcessor::x_OnIPGResolveData(), CPSGS_IPGResolveProcessor::x_OnIPGResolveError(), CPSGS_AnnotProcessor::x_OnNamedAnnotData(), CPSGS_AnnotProcessor::x_OnNamedAnnotError(), CPSGS_AccessionVersionHistoryProcessor::x_OnSeqIdResolveError(), CPSGS_AnnotProcessor::x_OnSeqIdResolveError(), CPSGS_GetProcessor::x_OnSeqIdResolveError(), CPSGS_IPGResolveProcessor::x_OnSeqIdResolveError(), CPSGS_ResolveProcessor::x_OnSeqIdResolveError(), CPSGS_ResolveBase::x_OnSeqIdResolveError(), CPSGS_AccessionVersionHistoryProcessor::x_OnSeqIdResolveFinished(), CPSGS_AnnotProcessor::x_OnSeqIdResolveFinished(), CPSGS_GetProcessor::x_OnSeqIdResolveFinished(), CPSGS_IPGResolveProcessor::x_OnSeqIdResolveFinished(), CPSGS_ResolveBase::x_OnSeqIdResolveFinished(), CPSGS_ResolveProcessor::x_OnSeqIdResolveFinished(), CPSGS_AsyncResolveBase::x_OnSi2csiRecord(), CPSGS_CassBlobBase::x_PrepareBlobPropData(), CPSGS_AsyncResolveBase::x_PreparePrimaryBioseqInfoQuery(), CPSGS_IPGResolveProcessor::x_PrepareRequestOnOriginalValues(), CPSGS_IPGResolveProcessor::x_PrepareRequestOnResolvedlValues(), CPSGS_AsyncResolveBase::x_PrepareSi2csiQuery(), CPSGS_GetBlobProcessor::x_Process(), CPSGS_TSEChunkProcessor::x_ProcessIdModVerId2Info(), CPSGS_TSEChunkProcessor::x_ProcessIdModVerId2InfoFinalStage(), CPSGS_TSEChunkProcessor::x_ProcessSatInfoChunkVerId2InfoFinalStage(), CPSGS_ResolveBase::x_RegisterSuccessTiming(), CPSGS_AnnotProcessor::x_RequestBlobProp(), CPSGS_CassBlobBase::x_RequestID2BlobChunks(), CPSGS_CassBlobBase::x_RequestId2SplitBlobs(), CPSGS_CassBlobBase::x_RequestMoreChunksForSmartTSE(), CPSGS_CassBlobBase::x_RequestOriginalBlobChunks(), CPSGS_TSEChunkProcessor::x_RequestTSEChunk(), CPSGS_ResolveBase::x_ResolvePrimaryOSLTInCache(), CPSGS_ResolveBase::x_ResolveSecondaryOSLTInCache(), CPSGS_ResolveBase::x_ResolveSeqId(), CPSGS_AnnotProcessor::x_SendAnnotDataToClient(), CPSGS_AnnotProcessor::x_SendBioseqInfo(), CPSGS_TSEChunkProcessor::x_SendProcessorError(), and CPSGS_WGSProcessor::x_UnlockRequest().

◆ m_SignalFinishTimestamp

psg_time_point_t IPSGS_Processor::m_SignalFinishTimestamp
private

Definition at line 369 of file ipsgs_processor.hpp.

Referenced by GetSignalFinishTimestamp(), and SignalFinishProcessing().

◆ m_SignalFinishTimestampInitialized

bool IPSGS_Processor::m_SignalFinishTimestampInitialized
private

Definition at line 368 of file ipsgs_processor.hpp.

Referenced by GetSignalFinishTimestamp(), and SignalFinishProcessing().

◆ m_SignalStartTimestamp

psg_time_point_t IPSGS_Processor::m_SignalStartTimestamp
private

Definition at line 366 of file ipsgs_processor.hpp.

Referenced by GetSignalStartTimestamp(), and SignalStartProcessing().

◆ m_SignalStartTimestampInitialized

bool IPSGS_Processor::m_SignalStartTimestampInitialized
private

Definition at line 365 of file ipsgs_processor.hpp.

Referenced by GetSignalStartTimestamp(), and SignalStartProcessing().

◆ m_UVThreadId

uv_thread_t IPSGS_Processor::m_UVThreadId
protected

Definition at line 359 of file ipsgs_processor.hpp.

Referenced by GetUVThreadId(), IsUVThreadAssigned(), and SetUVThreadId().


The documentation for this class was generated from the following files:
Modified on Thu Feb 29 12:19:18 2024 by modify_doxy.py rev. 669887