1 #ifndef PUBSEQ_GATEWAY__HPP
2 #define PUBSEQ_GATEWAY__HPP
80 virtual void Init(
void);
165 virtual int Run(
void);
296 shared_ptr<CPSGS_Reply> reply,
298 const string & message,
303 shared_ptr<CPSGS_Reply> reply,
307 bool seq_id_is_optional=
false);
312 shared_ptr<CPSGS_Reply> reply,
316 vector<string> & enabled_processors,
317 vector<string> & disabled_processors,
318 bool & processor_events);
329 const string & name)
const;
331 shared_ptr<CPSGS_Reply> reply,
333 int & send_blob_if_small);
336 string & err_msg)
const;
340 string & err_msg)
const;
344 string & err_msg)
const;
348 string & err_msg)
const;
350 shared_ptr<CPSGS_Reply> reply,
354 shared_ptr<CPSGS_Reply> reply,
361 shared_ptr<CPSGS_Reply> reply,
365 shared_ptr<CPSGS_Reply> reply,
369 shared_ptr<CPSGS_Reply> reply,
373 shared_ptr<CPSGS_Reply> reply,
377 shared_ptr<CPSGS_Reply> reply,
381 shared_ptr<CPSGS_Reply> reply,
386 shared_ptr<CPSGS_Reply> reply,
390 shared_ptr<CPSGS_Reply> reply,
394 shared_ptr<CPSGS_Reply> reply,
396 bool & processor_events);
398 shared_ptr<CPSGS_Reply> reply,
400 optional<bool> & include_hup);
402 shared_ptr<CPSGS_Reply> reply,
406 shared_ptr<CPSGS_Reply> reply,
408 double & resend_timeout);
410 shared_ptr<CPSGS_Reply> reply,
412 bool & auto_blob_skipping);
414 shared_ptr<CPSGS_Reply> reply,
416 vector<string> & enabled_processors,
417 vector<string> & disabled_processors);
419 shared_ptr<CPSGS_Reply> reply,
421 vector<string> &
names);
423 shared_ptr<CPSGS_Reply> reply,
425 optional<string> & protein);
427 shared_ptr<CPSGS_Reply> reply,
431 shared_ptr<CPSGS_Reply> reply,
433 optional<string> & nucleotide);
435 shared_ptr<CPSGS_Reply> reply,
437 vector<pair<int, int>> & time_series);
439 shared_ptr<CPSGS_Reply> reply,
441 optional<CSeq_id::ESNPScaleLimit> & snp_scale_limit);
443 shared_ptr<CPSGS_Reply> reply,
447 shared_ptr<CPSGS_Reply> reply,
449 vector<string> & exclude_checks);
457 const string & err_msg);
460 const string & err_msg);
464 const string & err_msg);
469 shared_ptr<CPSGS_Request> request,
470 shared_ptr<CPSGS_Reply> reply);
475 shared_ptr<CPSGS_Reply> reply,
490 shared_ptr<CPSGS_Reply> reply);
494 const string & check_id,
496 const string & check_description,
498 const string & health_command,
503 const vector<string> & exclude_checks,
506 shared_ptr<CPSGS_Reply> reply,
507 const string & health_command);
509 shared_ptr<CPSGS_Reply> reply,
510 const string * payload);
Checksum and hash calculation classes.
Based on various attributes of the request: {{seq_id}}; NA name; {{blob_id}}; etc (or a combination t...
shared_ptr< void > TApiLock
Get an API lock.
unique_ptr< CExcludeBlobCache > m_ExcludeBlobCache
void x_Finish500(shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, EPSGS_PubseqGatewayErrorCode code, const string &err_msg)
bool x_GetAccessionSubstitutionOption(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, SPSGS_RequestBase::EPSGS_AccSubstitutioOption &acc_subst_option)
void x_InitialzeZEndPointData(void)
CPubseqGatewayCache * GetLookupCache(void)
int OnConfig(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)
void x_RegisterProcessors(void)
unique_ptr< CMyNCBIErrorCache > m_MyNCBIErrorCache
int OnGet(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)
CMyNCBINotFoundCache * GetMyNCBINotFoundCache(void)
void x_SendZEndPointReply(CRequestStatus::ECode http_status, shared_ptr< CPSGS_Reply > reply, const string *payload)
bool x_GetIPG(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, int64_t &ipg)
void NotifyRequestFinished(size_t request_id)
vector< SSatInfoEntry > GetBioseqNAKeyspaces(void) const
map< uv_thread_t, unique_ptr< CPSGS_UvLoopBinder > > m_ThreadToBinder
unsigned int GetCassandraMaxRetries(void) const
bool x_GetExcludeChecks(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, vector< string > &exclude_checks)
bool x_GetId2Info(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, string &id2_info)
bool x_IsBoolParamValid(const string ¶m_name, const CTempString ¶m_value, string &err_msg) const
IPSGS_Processor::EPSGS_StartProcessing SignalStartProcessing(IPSGS_Processor *processor)
int OnHealthz(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)
CNcbiLogFields m_LogFields
int OnShutdown(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)
void x_MalformedArguments(shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, const string &err_msg)
bool x_GetIntrospectionFormat(CHttpRequest &req, string &fmt, string &err_msg)
bool GetCDDProcessorsEnabled() const
void x_SelfZEndPointCheck(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const string &health_command)
int OnGetBlob(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)
bool GetCassandraProcessorsEnabled(void) const
bool x_GetLastModified(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, int64_t &last_modified)
bool x_GetHops(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, int &hops)
bool x_DispatchRequest(CRef< CRequestContext > context, shared_ptr< CPSGS_Request > request, shared_ptr< CPSGS_Reply > reply)
int OnReadyzCassandra(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)
bool x_GetIncludeHUPParameter(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, optional< bool > &include_hup)
CPSG_Queue::TApiLock m_PSGAPILock
int OnGetAlerts(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)
bool x_GetNames(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, vector< string > &names)
void UnregisterUVLoop(uv_thread_t uv_thread)
void x_PrintRequestStop(CRef< CRequestContext > context, CPSGS_Request::EPSGS_Type request_type, CRequestStatus::ECode status, size_t bytes_sent)
void x_InsufficientArguments(shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, const string &err_msg)
bool x_CheckAuthorization(const string &request_name, CRef< CRequestContext > context, CHttpRequest &http_req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now)
bool x_GetTSEOption(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, SPSGS_BlobRequestBase::EPSGS_TSEOption &tse_option)
uv_loop_t * GetUVLoop(void)
SPubseqGatewaySettings m_Settings
map< string, tuple< string, string > > GetIdToNameAndDescriptionMap(void) const
optional< SSatInfoEntry > SatToKeyspace(int32_t sat)
int OnReadyzWGS(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)
void RegisterDaemonUVLoop(uv_thread_t uv_thread, uv_loop_t *uv_loop)
void CreateMyNCBIFactory(void)
bool x_GetSeqIdResolveParameter(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, bool &auto_blob_skipping)
size_t GetHttpMaxRunning(void) const
void MaintainSplitInfoBlobCache(void)
int OnStatistics(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)
int OnTestIO(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)
CPSGSCounters & GetCounters(void)
void SignalConnectionCanceled(size_t request_id)
bool x_GetProcessorEventsParameter(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, bool &processor_events)
int OnAckAlert(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)
int OnGetNA(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)
unique_ptr< CHttpDaemon > m_TcpDaemon
bool x_NeedReadyZCheckPerform(const string &check_name, bool verbose, const vector< string > &exclude_checks, bool &is_critical)
unique_ptr< COperationTiming > m_Timing
bool x_GetNucleotide(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, optional< string > &nucleotide)
CMyNCBIErrorCache * GetMyNCBIErrorCache(void)
bool GetSNPProcessorsEnabled() const
string x_GetCmdLineArguments(void) const
bool x_GetSNPScaleLimit(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, optional< CSeq_id::ESNPScaleLimit > &snp_scale_limit)
unique_ptr< CMyNCBIOKCache > m_MyNCBIOKCache
shared_ptr< CSatInfoSchemaProvider > m_CassSchemaProvider
string GetSSLCertFile(void) const
void x_FixIntrospectionVersion(void)
void CancelAllProcessors(void)
bool x_ProcessCommonGetAndResolveParams(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, CTempString &seq_id, int &seq_id_type, SPSGS_RequestBase::EPSGS_CacheAndDbUse &use_cache, bool seq_id_is_optional=false)
bool x_GetResendTimeout(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, double &resend_timeout)
unique_ptr< CMyNCBINotFoundCache > m_MyNCBINotFoundCache
bool x_GetEnabledAndDisabledProcessors(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, vector< string > &enabled_processors, vector< string > &disabled_processors)
string GetSSLCiphers(void) const
void x_FixIntrospectionBuildDate(void)
int OnGetTSEChunk(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)
mutex m_ThreadToBinderGuard
unique_ptr< CPSGS_Dispatcher > m_RequestDispatcher
static CPubseqGatewayApp * sm_PubseqApp
optional< SSatInfoEntry > GetIPGKeyspace(void) const
int OnHealth(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)
int OnStatus(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)
void x_SendMessageAndCompletionChunks(shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, const string &message, CRequestStatus::ECode status, int code, EDiagSev severity)
void SignalFinishProcessing(IPSGS_Processor *processor, CPSGS_Dispatcher::EPSGS_SignalSource signal_source)
unsigned long GetSendBlobIfSmall(void) const
int OnReadyzLMDB(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)
CMyNCBIOKCache * GetMyNCBIOKCache(void)
bool x_GetResolveFlags(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, SPSGS_ResolveRequest::TPSGS_BioseqIncludeData &include_data_flags)
unique_ptr< CPSGSCounters > m_Counters
EPSGS_StartupDataState GetStartupDataState(void) const
size_t GetHttpMaxBacklog(void) const
unique_ptr< char[]> m_IOTestBuffer
int x_ReadyzHealthzImplementation(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)
bool x_GetCommonIDRequestParams(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, SPSGS_RequestBase::EPSGS_Trace &trace, int &hops, vector< string > &enabled_processors, vector< string > &disabled_processors, bool &processor_events)
void RegisterUVLoop(uv_thread_t uv_thread, uv_loop_t *uv_loop)
CExcludeBlobCache * GetExcludeBlobCache(void)
bool x_GetOutputFormat(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, SPSGS_ResolveRequest::EPSGS_OutputFormat &output_format)
bool x_ConvertIntParameter(const string ¶m_name, const CTempString ¶m_value, int &converted, string &err_msg) const
void CheckCassMapping(void)
COperationTiming & GetTiming(void)
shared_ptr< CPSGMessages > GetPublicCommentsMapping(void)
unsigned int GetCassandraTimeout(void) const
int OnDeepHealth(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)
bool x_IsShuttingDown(shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now)
int OnInfo(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)
CRequestStatus::ECode x_SelfZEndPointCheckImpl(CRef< CRequestContext > context, const string &check_id, const string &check_name, const string &check_description, bool verbose, const string &health_command, const CTimeout &health_timeout, CJsonNode &node)
static CPubseqGatewayApp * GetInstance(void)
shared_ptr< CPSG_MyNCBIFactory > m_MyNCBIFactory
SRequestParameter x_GetParam(CHttpRequest &req, const string &name) const
shared_ptr< CCassConnectionFactory > m_CassConnectionFactory
size_t GetShutdownIfTooManyOpenFD(void) const
vector< string > x_GetExcludeBlobs(CHttpRequest &req) const
bool x_GetTimeSeries(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, vector< pair< int, int >> &time_series)
map< uv_thread_t, uv_loop_t * > m_ThreadToUVLoop
bool x_GetId2Chunk(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, int64_t &id2_chunk)
int OnIPGResolve(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)
bool x_GetVerboseParameter(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, bool &verbose)
bool PopulateCassandraMapping(bool initialization)
EPSGS_StartupDataState m_StartupDataState
int GetPageSize(void) const
bool x_GetTraceParameter(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, SPSGS_RequestBase::EPSGS_Trace &trace)
CPSGS_Dispatcher * GetProcessorDispatcher(void)
CPSGAlerts & GetAlerts(void)
bool GetSSLEnable(void) const
shared_ptr< CCassConnection > m_CassConnection
shared_ptr< CPSG_MyNCBIFactory > GetMyNCBIFactory(void)
bool x_GetBlobId(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, SPSGS_BlobId &blob_id)
bool GetWGSProcessorsEnabled() const
int OnAccessionVersionHistory(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)
int OnReadyzSNP(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)
unique_ptr< CPubseqGatewayCache > m_LookupCache
bool x_ConvertDoubleParameter(const string ¶m_name, const CTempString ¶m_value, double &converted, string &err_msg) const
int OnResolve(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)
int OnReadyzCDD(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)
bool x_GetUseCacheParameter(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, SPSGS_RequestBase::EPSGS_CacheAndDbUse &use_cache)
size_t GetProcessorMaxConcurrency(const string &processor_id)
CSplitInfoCache * GetSplitInfoCache(void)
int OnLivez(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)
void MaintainMyNCBICaches(void)
bool x_GetProtein(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, optional< string > &protein)
CPSGS_UvLoopBinder & GetUvLoopBinder(uv_thread_t uv_thread_id)
int OnBadURL(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)
bool x_GetSendBlobIfSmallParameter(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, int &send_blob_if_small)
string GetSSLKeyFile(void) const
int OnReadyz(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)
int OnDispatcherStatus(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)
unique_ptr< CSplitInfoCache > m_SplitInfoCache
CRef< CRequestContext > x_CreateRequestContext(CHttpRequest &req)
SSatInfoEntry GetBioseqKeyspace(void) const
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
CTimeout – Timeout interval.
Interface class (and self-factory) for request processor objects that can retrieve data from a given ...
EPSGS_StartProcessing
Tells wether to continue or not after a processor called SignalStartProcessing() method.
static const struct name_t names[]
EDiagSev
Severity level for the posted diagnostics.
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
const long kMaxTestIOSize
EPSGS_PubseqGatewayErrorCode
psg_clock_t::time_point psg_time_point_t
static bool check_name(const char *name)
EPSGS_AccSubstitutioOption
int TPSGS_BioseqIncludeData
bool m_SNPProcessorsEnabled
map< string, tuple< string, string > > m_IdToNameAndDescription
size_t GetProcessorMaxConcurrency(const CNcbiRegistry ®istry, const string &processor_id)
bool m_CassandraProcessorsEnabled
unsigned int m_MaxRetries
size_t m_ShutdownIfTooManyOpenFD
bool m_CDDProcessorsEnabled
unsigned long m_SendBlobIfSmall
bool m_WGSProcessorsEnabled
static CS_CONTEXT * context