NCBI C++ ToolKit
pubseq_gateway.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef PUBSEQ_GATEWAY__HPP
2 #define PUBSEQ_GATEWAY__HPP
3 
4 /* $Id: pubseq_gateway.hpp 103042 2024-08-27 13:27:46Z satskyse $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Authors: Dmitri Dmitrienko
30  *
31  * File Description:
32  *
33  */
34 #include <string>
35 #include <functional>
36 
37 #include <corelib/ncbiapp.hpp>
38 #include <corelib/ncbi_system.hpp>
39 #include <util/checksum.hpp>
40 
48 
50 
51 #include "pending_operation.hpp"
52 #include "http_daemon.hpp"
54 #include "pubseq_gateway_stat.hpp"
55 #include "pubseq_gateway_utils.hpp"
56 #include "pubseq_gateway_types.hpp"
57 #include "exclude_blob_cache.hpp"
58 #include "split_info_cache.hpp"
59 #include "my_ncbi_cache.hpp"
60 #include "alerts.hpp"
61 #include "timing.hpp"
62 #include "psgs_dispatcher.hpp"
63 #include "psgs_uv_loop_binder.hpp"
64 #include "settings.hpp"
65 
66 
69 
70 
71 const long kMaxTestIOSize = 1000000000;
72 
73 
75 {
76 public:
79 
80  virtual void Init(void);
81  void ParseArgs(void);
82  void OpenCache(void);
83  bool OpenCass(void);
84  void CreateMyNCBIFactory(void);
85  bool PopulateCassandraMapping(bool initialization);
86  void CheckCassMapping(void);
87  void CloseCass(void);
88  optional<SSatInfoEntry> SatToKeyspace(int32_t sat)
89  { return m_CassSchemaProvider->GetBlobKeyspace(sat); }
90 
92  if (m_SplitInfoCache)
93  m_SplitInfoCache->Maintain();
94  }
95  void MaintainMyNCBICaches(void) {
96  if (m_MyNCBIOKCache)
97  m_MyNCBIOKCache->Maintain();
99  m_MyNCBINotFoundCache->Maintain();
100  if (m_MyNCBIErrorCache)
101  m_MyNCBIErrorCache->Maintain();
102  }
103 
105  { return m_CassSchemaProvider->GetResolverKeyspace(); }
106 
107  optional<SSatInfoEntry> GetIPGKeyspace(void) const
108  { return m_CassSchemaProvider->GetIPGKeyspace(); }
109 
110  vector<SSatInfoEntry> GetBioseqNAKeyspaces(void) const
111  { return m_CassSchemaProvider->GetNAKeyspaces(); }
112 
114  { return m_LookupCache.get(); }
115 
117  { return m_ExcludeBlobCache.get(); }
118 
120  { return m_SplitInfoCache.get(); }
121 
123  { return m_MyNCBIOKCache.get(); }
124 
126  { return m_MyNCBINotFoundCache.get(); }
127 
129  { return m_MyNCBIErrorCache.get(); }
130 
131  shared_ptr<CPSGMessages> GetPublicCommentsMapping(void)
132  { return m_CassSchemaProvider->GetMessages(); }
133 
134  unsigned long GetSendBlobIfSmall(void) const
135  { return m_Settings.m_SendBlobIfSmall; }
136 
137  int OnBadURL(CHttpRequest & req, shared_ptr<CPSGS_Reply> reply);
138  int OnGet(CHttpRequest & req, shared_ptr<CPSGS_Reply> reply);
139  int OnGetBlob(CHttpRequest & req, shared_ptr<CPSGS_Reply> reply);
140  int OnResolve(CHttpRequest & req, shared_ptr<CPSGS_Reply> reply);
141  int OnGetTSEChunk(CHttpRequest & req, shared_ptr<CPSGS_Reply> reply);
142  int OnGetNA(CHttpRequest & req, shared_ptr<CPSGS_Reply> reply);
143  int OnAccessionVersionHistory(CHttpRequest & req, shared_ptr<CPSGS_Reply> reply);
144  int OnIPGResolve(CHttpRequest & req, shared_ptr<CPSGS_Reply> reply);
145  int OnReadyz(CHttpRequest & req, shared_ptr<CPSGS_Reply> reply);
146  int OnReadyzCassandra(CHttpRequest & req, shared_ptr<CPSGS_Reply> reply);
147  int OnReadyzLMDB(CHttpRequest & req, shared_ptr<CPSGS_Reply> reply);
148  int OnReadyzWGS(CHttpRequest & req, shared_ptr<CPSGS_Reply> reply);
149  int OnReadyzCDD(CHttpRequest & req, shared_ptr<CPSGS_Reply> reply);
150  int OnReadyzSNP(CHttpRequest & req, shared_ptr<CPSGS_Reply> reply);
151  int OnLivez(CHttpRequest & req, shared_ptr<CPSGS_Reply> reply);
152  int OnHealthz(CHttpRequest & req, shared_ptr<CPSGS_Reply> reply);
153  int OnHealth(CHttpRequest & req, shared_ptr<CPSGS_Reply> reply);
154  int OnDeepHealth(CHttpRequest & req, shared_ptr<CPSGS_Reply> reply);
155  int OnConfig(CHttpRequest & req, shared_ptr<CPSGS_Reply> reply);
156  int OnInfo(CHttpRequest & req, shared_ptr<CPSGS_Reply> reply);
157  int OnStatus(CHttpRequest & req, shared_ptr<CPSGS_Reply> reply);
158  int OnShutdown(CHttpRequest & req, shared_ptr<CPSGS_Reply> reply);
159  int OnGetAlerts(CHttpRequest & req, shared_ptr<CPSGS_Reply> reply);
160  int OnAckAlert(CHttpRequest & req, shared_ptr<CPSGS_Reply> reply);
161  int OnStatistics(CHttpRequest & req, shared_ptr<CPSGS_Reply> reply);
162  int OnDispatcherStatus(CHttpRequest & req, shared_ptr<CPSGS_Reply> reply);
163  int OnTestIO(CHttpRequest & req, shared_ptr<CPSGS_Reply> reply);
164 
165  virtual int Run(void);
166 
167  static CPubseqGatewayApp * GetInstance(void);
168 
169  void NotifyRequestFinished(size_t request_id)
170  { m_RequestDispatcher->NotifyRequestFinished(request_id); }
171 
173  { return *m_Timing.get(); }
174 
176  { return m_StartupDataState; }
177 
178  map<string, tuple<string, string>> GetIdToNameAndDescriptionMap(void) const
180 
181  unsigned int GetCassandraTimeout(void) const
182  { return m_Settings.m_TimeoutMs; }
183 
184  unsigned int GetCassandraMaxRetries(void) const
185  { return m_Settings.m_MaxRetries; }
186 
189 
192 
195 
198 
201  { return m_RequestDispatcher->SignalStartProcessing(processor); }
202 
203  size_t GetProcessorMaxConcurrency(const string & processor_id)
204  { return m_Settings.GetProcessorMaxConcurrency(GetConfig(), processor_id); }
205 
208  { m_RequestDispatcher->SignalFinishProcessing(processor, signal_source); }
209 
210  void SignalConnectionCanceled(size_t request_id)
211  { m_RequestDispatcher->SignalConnectionCanceled(request_id); }
212 
213  bool GetSSLEnable(void) const
214  { return m_Settings.m_SSLEnable; }
215 
216  string GetSSLCertFile(void) const
217  { return m_Settings.m_SSLCertFile; }
218 
219  string GetSSLKeyFile(void) const
220  { return m_Settings.m_SSLKeyFile; }
221 
222  string GetSSLCiphers(void) const
223  { return m_Settings.m_SSLCiphers; }
224 
225  size_t GetShutdownIfTooManyOpenFD(void) const
227 
228  int GetPageSize(void) const
229  { return m_Settings.m_IPGPageSize; }
230 
231  size_t GetHttpMaxBacklog(void) const
232  { return m_Settings.m_HttpMaxBacklog; }
233 
234  size_t GetHttpMaxRunning(void) const
235  { return m_Settings.m_HttpMaxRunning; }
236 
238  { return m_Alerts; }
239 
241  { return * m_Counters.get(); }
242 
243  void RegisterUVLoop(uv_thread_t uv_thread, uv_loop_t * uv_loop)
244  {
245  lock_guard<mutex> guard(m_ThreadToBinderGuard);
246 
247  m_ThreadToUVLoop[uv_thread] = uv_loop;
248  m_ThreadToBinder[uv_thread] =
249  unique_ptr<CPSGS_UvLoopBinder>(new CPSGS_UvLoopBinder(uv_loop));
250  }
251 
252  void UnregisterUVLoop(uv_thread_t uv_thread)
253  {
254  lock_guard<mutex> guard(m_ThreadToBinderGuard);
255  m_ThreadToBinder[uv_thread]->x_Unregister();
256  }
257 
258  void RegisterDaemonUVLoop(uv_thread_t uv_thread, uv_loop_t * uv_loop)
259  {
260  lock_guard<mutex> guard(m_ThreadToBinderGuard);
261 
262  m_ThreadToUVLoop[uv_thread] = uv_loop;
263  }
264 
265  uv_loop_t * GetUVLoop(void)
266  {
267  auto it = m_ThreadToUVLoop.find(uv_thread_self());
268  if (it == m_ThreadToUVLoop.end()) {
269  return nullptr;
270  }
271  return it->second;
272  }
273 
275  { m_RequestDispatcher->CancelAll(); }
276 
278  { return m_RequestDispatcher.get(); }
279 
280  CPSGS_UvLoopBinder & GetUvLoopBinder(uv_thread_t uv_thread_id);
281 
282  shared_ptr<CPSG_MyNCBIFactory> GetMyNCBIFactory(void)
283  { return m_MyNCBIFactory; }
284 
285 private:
287  {
288  bool m_Found;
290 
292  {}
293  };
294 
296  shared_ptr<CPSGS_Reply> reply,
297  const psg_time_point_t & now,
298  const string & message,
299  CRequestStatus::ECode status, int code, EDiagSev severity);
300 
302  CHttpRequest & req,
303  shared_ptr<CPSGS_Reply> reply,
304  const psg_time_point_t & now,
305  CTempString & seq_id, int & seq_id_type,
307  bool seq_id_is_optional=false);
308 
309  // Common URL parameters for all ../ID/.. requests
311  CHttpRequest & req,
312  shared_ptr<CPSGS_Reply> reply,
313  const psg_time_point_t & now,
315  int & hops,
316  vector<string> & enabled_processors,
317  vector<string> & disabled_processors,
318  bool & processor_events);
319 
320 private:
321  string x_GetCmdLineArguments(void) const;
324  CPSGS_Request::EPSGS_Type request_type,
325  CRequestStatus::ECode status,
326  size_t bytes_sent);
327 
328  SRequestParameter x_GetParam(CHttpRequest & req,
329  const string & name) const;
331  shared_ptr<CPSGS_Reply> reply,
332  const psg_time_point_t & now,
333  int & send_blob_if_small);
334  bool x_IsBoolParamValid(const string & param_name,
335  const CTempString & param_value,
336  string & err_msg) const;
337  bool x_ConvertIntParameter(const string & param_name,
338  const CTempString & param_value,
339  int & converted,
340  string & err_msg) const;
341  bool x_ConvertIntParameter(const string & param_name,
342  const CTempString & param_value,
343  int64_t & converted,
344  string & err_msg) const;
345  bool x_ConvertDoubleParameter(const string & param_name,
346  const CTempString & param_value,
347  double & converted,
348  string & err_msg) const;
350  shared_ptr<CPSGS_Reply> reply,
351  const psg_time_point_t & now,
353  bool x_GetOutputFormat(CHttpRequest & req,
354  shared_ptr<CPSGS_Reply> reply,
355  const psg_time_point_t & now,
358  string & fmt,
359  string & err_msg);
360  bool x_GetTSEOption(CHttpRequest & req,
361  shared_ptr<CPSGS_Reply> reply,
362  const psg_time_point_t & now,
364  bool x_GetLastModified(CHttpRequest & req,
365  shared_ptr<CPSGS_Reply> reply,
366  const psg_time_point_t & now,
367  int64_t & last_modified);
368  bool x_GetBlobId(CHttpRequest & req,
369  shared_ptr<CPSGS_Reply> reply,
370  const psg_time_point_t & now,
371  SPSGS_BlobId & blob_id);
372  bool x_GetResolveFlags(CHttpRequest & req,
373  shared_ptr<CPSGS_Reply> reply,
374  const psg_time_point_t & now,
375  SPSGS_ResolveRequest::TPSGS_BioseqIncludeData & include_data_flags);
376  bool x_GetId2Chunk(CHttpRequest & req,
377  shared_ptr<CPSGS_Reply> reply,
378  const psg_time_point_t & now,
379  int64_t & id2_chunk);
380  bool x_GetId2Info(CHttpRequest & req,
381  shared_ptr<CPSGS_Reply> reply,
382  const psg_time_point_t & now,
383  string & id2_info);
384  vector<string> x_GetExcludeBlobs(CHttpRequest & req) const;
386  shared_ptr<CPSGS_Reply> reply,
387  const psg_time_point_t & now,
390  shared_ptr<CPSGS_Reply> reply,
391  const psg_time_point_t & now,
394  shared_ptr<CPSGS_Reply> reply,
395  const psg_time_point_t & now,
396  bool & processor_events);
398  shared_ptr<CPSGS_Reply> reply,
399  const psg_time_point_t & now,
400  optional<bool> & include_hup);
401  bool x_GetHops(CHttpRequest & req,
402  shared_ptr<CPSGS_Reply> reply,
403  const psg_time_point_t & now,
404  int & hops);
405  bool x_GetResendTimeout(CHttpRequest & req,
406  shared_ptr<CPSGS_Reply> reply,
407  const psg_time_point_t & now,
408  double & resend_timeout);
410  shared_ptr<CPSGS_Reply> reply,
411  const psg_time_point_t & now,
412  bool & auto_blob_skipping);
414  shared_ptr<CPSGS_Reply> reply,
415  const psg_time_point_t & now,
416  vector<string> & enabled_processors,
417  vector<string> & disabled_processors);
418  bool x_GetNames(CHttpRequest & req,
419  shared_ptr<CPSGS_Reply> reply,
420  const psg_time_point_t & now,
421  vector<string> & names);
422  bool x_GetProtein(CHttpRequest & req,
423  shared_ptr<CPSGS_Reply> reply,
424  const psg_time_point_t & now,
425  optional<string> & protein);
426  bool x_GetIPG(CHttpRequest & req,
427  shared_ptr<CPSGS_Reply> reply,
428  const psg_time_point_t & now,
429  int64_t & ipg);
430  bool x_GetNucleotide(CHttpRequest & req,
431  shared_ptr<CPSGS_Reply> reply,
432  const psg_time_point_t & now,
433  optional<string> & nucleotide);
434  bool x_GetTimeSeries(CHttpRequest & req,
435  shared_ptr<CPSGS_Reply> reply,
436  const psg_time_point_t & now,
437  vector<pair<int, int>> & time_series);
438  bool x_GetSNPScaleLimit(CHttpRequest & req,
439  shared_ptr<CPSGS_Reply> reply,
440  const psg_time_point_t & now,
441  optional<CSeq_id::ESNPScaleLimit> & snp_scale_limit);
443  shared_ptr<CPSGS_Reply> reply,
444  const psg_time_point_t & now,
445  bool & verbose);
446  bool x_GetExcludeChecks(CHttpRequest & req,
447  shared_ptr<CPSGS_Reply> reply,
448  const psg_time_point_t & now,
449  vector<string> & exclude_checks);
450 
451 private:
452  void x_FixIntrospectionVersion(void);
453  void x_FixIntrospectionBuildDate(void);
454 
455  void x_InsufficientArguments(shared_ptr<CPSGS_Reply> reply,
456  const psg_time_point_t & now,
457  const string & err_msg);
458  void x_MalformedArguments(shared_ptr<CPSGS_Reply> reply,
459  const psg_time_point_t & now,
460  const string & err_msg);
461  void x_Finish500(shared_ptr<CPSGS_Reply> reply,
462  const psg_time_point_t & now,
464  const string & err_msg);
465  bool x_IsShuttingDown(shared_ptr<CPSGS_Reply> reply,
466  const psg_time_point_t & now);
467  void x_RegisterProcessors(void);
469  shared_ptr<CPSGS_Request> request,
470  shared_ptr<CPSGS_Reply> reply);
471  void x_InitSSL(void);
472  bool x_CheckAuthorization(const string & request_name,
474  CHttpRequest & http_req,
475  shared_ptr<CPSGS_Reply> reply,
476  const psg_time_point_t & now);
477 
478 private:
479  // z end point support
480 
481  // Pubseq gateway API lock to make it cheap to create CPSG_Queue instances.
482  // It is taken at the initialization and kept till the end of the app life.
484 
485  void x_InitialzeZEndPointData(void);
486 
487  // At the moment /readyz and healthz match. The only difference is what
488  // request counter to increment
490  shared_ptr<CPSGS_Reply> reply);
491 
494  const string & check_id,
495  const string & check_name,
496  const string & check_description,
497  bool verbose,
498  const string & health_command,
499  const CTimeout & health_timeout,
500  CJsonNode & node);
501  bool x_NeedReadyZCheckPerform(const string & check_name,
502  bool verbose,
503  const vector<string> & exclude_checks,
504  bool & is_critical);
506  shared_ptr<CPSGS_Reply> reply,
507  const string & health_command);
509  shared_ptr<CPSGS_Reply> reply,
510  const string * payload);
511 
512 private:
514 
515  shared_ptr<CCassConnection> m_CassConnection;
516  shared_ptr<CCassConnectionFactory> m_CassConnectionFactory;
517  shared_ptr<CSatInfoSchemaProvider> m_CassSchemaProvider;
518  shared_ptr<CPSG_MyNCBIFactory> m_MyNCBIFactory;
519 
521 
522  unique_ptr<char []> m_IOTestBuffer;
523 
524  unique_ptr<CPubseqGatewayCache> m_LookupCache;
525  unique_ptr<CHttpDaemon> m_TcpDaemon;
526 
527  unique_ptr<CExcludeBlobCache> m_ExcludeBlobCache;
528  unique_ptr<CSplitInfoCache> m_SplitInfoCache;
529  unique_ptr<CMyNCBIOKCache> m_MyNCBIOKCache;
530  unique_ptr<CMyNCBINotFoundCache> m_MyNCBINotFoundCache;
531  unique_ptr<CMyNCBIErrorCache> m_MyNCBIErrorCache;
532 
534  unique_ptr<COperationTiming> m_Timing;
535  unique_ptr<CPSGSCounters> m_Counters;
536 
539 
540  // Serialized JSON introspection message
543 
544  // Requests dispatcher
545  unique_ptr<CPSGS_Dispatcher> m_RequestDispatcher;
546 
547  // Mapping between the libuv thread id and the binder associated with the
548  // libuv worker thread loop
549  map<uv_thread_t,
550  unique_ptr<CPSGS_UvLoopBinder>> m_ThreadToBinder;
552  map<uv_thread_t, uv_loop_t *> m_ThreadToUVLoop;
553 
554 private:
556 };
557 
558 
559 #endif
Checksum and hash calculation classes.
HTTP request.
JSON node abstraction.
CNcbiLogFields –.
Definition: ncbidiag.hpp:2397
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 &param_name, const CTempString &param_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)
virtual void Init(void)
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)
virtual int Run(void)
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)
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 &param_name, const CTempString &param_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 &param_name, const CTempString &param_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 ...
Definition: tempstr.hpp:65
CTime –.
Definition: ncbitime.hpp:296
CTimeout – Timeout interval.
Definition: ncbitime.hpp:1693
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[]
#define false
Definition: bool.h:36
Int4 int32_t
Int8 int64_t
static bool trace
#define CNcbiApplication
EDiagSev
Severity level for the posted diagnostics.
Definition: ncbidiag.hpp:650
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
true_type verbose
Definition: processing.cpp:890
USING_SCOPE(objects)
const long kMaxTestIOSize
USING_NCBI_SCOPE
EPSGS_StartupDataState
EPSGS_PubseqGatewayErrorCode
psg_clock_t::time_point psg_time_point_t
static bool check_name(const char *name)
Definition: setenv.c:26
unsigned int m_TimeoutMs
Definition: settings.hpp:59
map< string, tuple< string, string > > m_IdToNameAndDescription
Definition: settings.hpp:144
size_t GetProcessorMaxConcurrency(const CNcbiRegistry &registry, const string &processor_id)
Definition: settings.cpp:1004
unsigned int m_MaxRetries
Definition: settings.hpp:60
size_t m_ShutdownIfTooManyOpenFD
Definition: settings.hpp:68
unsigned long m_SendBlobIfSmall
Definition: settings.hpp:61
Definition: inftrees.h:24
static CS_CONTEXT * context
Definition: will_convert.c:21
Modified on Wed Sep 04 15:01:22 2024 by modify_doxy.py rev. 669887