;
51 return "ePSGS_NotFound";
53 return "ePSGS_Error";
55 return "ePSGS_Canceled";
57 return "ePSGS_Timeout";
59 return "ePSGS_Unauthorized";
63 return "unknown ("+ to_string(status) +
")";
85 return "unauthorized";
89 return "unknown ("+ to_string(status) +
")";
132 if(uv_thread_id == 0) {
135 string msg=
"Processor '"+
GetName() +
"' " 136 "tries to schedule a postponed callback before " 137 "a thread was assigned to the processor (request id: "+
138to_string(
m_Request->GetRequestId()) +
").";
144app->GetUvLoopBinder(uv_thread_id).PostponeInvoke(cb, user_data,
146}
catch(
constexception & exc) {
147 PSG_ERROR(
"Error scheduling a postponed callback by the processor '"+
148 GetName() +
"' (while serving request id: "+
149to_string(
m_Request->GetRequestId()) +
"): "+ exc.what());
152 PSG_ERROR(
"Unknown error scheduling a postponed callback by the processor '"+
153 GetName() +
"' (while serving request id: "+
154to_string(
m_Request->GetRequestId()) +
")");
171 if(uv_thread_id == 0) {
174 string msg=
"Processor '"+
GetName() +
"' " 175 "tries to schedule a socket callback before " 176 "a thread was assigned to the processor (request id: "+
177to_string(
m_Request->GetRequestId()) +
").";
183app->GetUvLoopBinder(uv_thread_id).SetSocketCallback(
184fd, event, timeout_millisec, user_data,
185event_cb, timeout_cb, error_cb,
187}
catch(
constexception & exc) {
188 PSG_ERROR(
"Error scheduling a socket callback by the processor '"+
189 GetName() +
"' (while serving request id: "+
190to_string(
m_Request->GetRequestId()) +
"): "+ exc.what());
193 PSG_ERROR(
"Unknown error scheduling a socket callback by the processor '"+
194 GetName() +
"' (while serving request id: "+
195to_string(
m_Request->GetRequestId()) +
")");
203 intrequest_seq_id_type,
207 autoparsed_seq_id_type = parsed_seq_id.
Which();
208 boolparsed_seq_id_type_found = (parsed_seq_id_type !=
211 if(!parsed_seq_id_type_found && request_seq_id_type < 0) {
212eff_seq_id_type = -1;
216 if(!parsed_seq_id_type_found) {
217eff_seq_id_type = request_seq_id_type;
221 if(request_seq_id_type < 0) {
222eff_seq_id_type = parsed_seq_id_type;
227 if(parsed_seq_id_type == request_seq_id_type) {
228eff_seq_id_type = request_seq_id_type;
237 "Seq id type mismatch. Parsed CSeq_id reports seq_id_type as "+
238to_string(parsed_seq_id_type) +
" while the URL reports "+
239to_string(request_seq_id_type) +
". They both belong to INSDC types so " 240 "CSeq_id provided type "+ to_string(parsed_seq_id_type) +
241 " is taken as an effective one",
244eff_seq_id_type = parsed_seq_id_type;
254 const string& request_seq_id,
255 intrequest_seq_id_type,
258 boolneed_trace =
m_Request->NeedTrace();
262 if(request_seq_id_type > 0) {
268 m_Reply->SendTrace(
"Parsing CSeq_id(eFasta_AsTypeAndContent, "+
269to_string(request_seq_id_type) +
270 ", '"+ stripped_seq_id +
"') succeeded.\n" 271 "Parsing CSeq_id finished OK (#1)",
277 m_Reply->SendTrace(
"Parsing CSeq_id(eFasta_AsTypeAndContent, "+
278to_string(request_seq_id_type) +
279 ", '"+ stripped_seq_id +
"') failed (exception)",
286seq_id.
Set(stripped_seq_id);
288 m_Reply->SendTrace(
"Parsing CSeq_id('"+ stripped_seq_id +
289 "') succeeded",
m_Request->GetStartTimestamp());
291 if(request_seq_id_type <= 0) {
293 m_Reply->SendTrace(
"Parsing CSeq_id finished OK (#2)",
302 m_Reply->SendTrace(
"Parsing CSeq_id finished OK (#3)",
311 m_Reply->SendTrace(
"CSeq_id provided type "+ to_string(seq_id_type) +
312 " and URL provided seq_id_type "+
313to_string(request_seq_id_type) +
" mismatch",
320 m_Reply->SendTrace(
"Both types belong to INSDC types.\n" 321 "Parsing CSeq_id finished OK (#4)",
329*err_msg =
"Seq_id '"+ request_seq_id +
330 "' possible type mismatch: the URL provides "+
331to_string(request_seq_id_type) +
332 " while the CSeq_Id detects it as "+
333to_string(
static_cast<int>(seq_id_type));
337 m_Reply->SendTrace(
"Parsing CSeq_id('"+ stripped_seq_id +
338 "') failed (exception)",
343 m_Reply->SendTrace(
"Parsing CSeq_id finished FAILED",
366 intrequest_seq_id_type)
368 autoparsed_seq_id_type = parsed_seq_id.
Which();
369 boolparsed_seq_id_type_found = (parsed_seq_id_type !=
372 if(!parsed_seq_id_type_found && request_seq_id_type < 0) {
376 if(!parsed_seq_id_type_found) {
380 if(request_seq_id_type < 0) {
385 if(parsed_seq_id_type == request_seq_id_type) {
function< EPSGS_PollContinue(void *user_data)> TEventCB
function< EPSGS_PollContinue(void *user_data)> TTimeoutCB
function< EPSGS_PollContinue(const string &message, void *user_data)> TErrorCB
function< void(void *user_data)> TProcessorCB
IPSGS_Processor::EPSGS_StartProcessing SignalStartProcessing(IPSGS_Processor *processor)
void SignalFinishProcessing(IPSGS_Processor *processor, CPSGS_Dispatcher::EPSGS_SignalSource signal_source)
static CPubseqGatewayApp * GetInstance(void)
virtual string GetName(void) const =0
Tells the processor name (used in logging and tracing)
static string StatusToString(EPSGS_Status status)
Converts the processor status to a string for tracing and logging purposes.
psg_time_point_t m_ProcessInvokeTimestamp
void OnBeforeProcess(void)
Called just before the virtual Process() method is called.
psg_time_point_t m_SignalStartTimestamp
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 correspo...
uv_thread_t GetUVThreadId(void) const
Provides the libuv thread id which runs the processor.
shared_ptr< CPSGS_Reply > m_Reply
EPSGS_StartProcessing
Tells wether to continue or not after a processor called SignalStartProcessing() method.
bool m_SignalStartTimestampInitialized
bool GetEffectiveSeqIdType(const objects::CSeq_id &parsed_seq_id, int request_seq_id_type, int16_t &eff_seq_id_type, bool need_trace)
psg_time_point_t m_SignalFinishTimestamp
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.
bool m_ProcessInvokeTimestampInitialized
void SignalFinishProcessing(void)
A processor should call this method when it decides that there is nothing else to be done.
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
bool m_SignalFinishTimestampInitialized
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.
static string StatusToProgressMessage(EPSGS_Status status)
Converts the processor status to a string for protocol message.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
CSeq_id & Set(const CTempString &the_id, TParseFlags flags=fParse_AnyRaw)
Reassign based on flat specifications; arguments interpreted as with constructors.
@ eFasta_AsTypeAndContent
E_Choice Which(void) const
Which variant is currently selected.
E_Choice
Choice variants.
@ e_not_set
No variant selected.
bool IsINSDCSeqIdType(CBioseqInfoRecord::TSeqIdType seq_id_type)
bool AreSeqIdTypesMatched(const CSeq_id &parsed_seq_id, int request_seq_id_type)
bool g_AllowProcessorTiming
string StripTrailingVerticalBars(const string &seq_id)
#define PSG_ERROR(message)
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
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