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

Go to the SVN repository for this file.

1 #ifndef PSGS_REQUEST__HPP
2 #define PSGS_REQUEST__HPP
3 
4 /* $Id: psgs_request.hpp 103123 2024-09-11 18:57:02Z 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: Sergey Satskiy
30  *
31  * File Description: PSG server requests
32  *
33  */
34 
35 #include <corelib/request_ctx.hpp>
40 #include <string>
41 #include <vector>
42 #include <mutex>
43 #include <optional>
44 #include <condition_variable>
45 
47 #include "pubseq_gateway_types.hpp"
48 #include "http_request.hpp"
49 
53 
54 
55 // Blob identifier consists of two integers: sat and sat key.
56 // The blob sat eventually needs to be resolved to a sat name.
58 {
60  {}
61 
62  SPSGS_BlobId(const string & blob_id) :
63  m_Id(blob_id)
64  {}
65 
66  SPSGS_BlobId(int32_t sat, int32_t sat_key);
67 
68  SPSGS_BlobId(const SPSGS_BlobId &) = default;
69  SPSGS_BlobId(SPSGS_BlobId &&) = default;
70  SPSGS_BlobId & operator=(const SPSGS_BlobId &) = default;
72 
73  void SetId(const string & blob_id)
74  {
75  m_Id = blob_id;
76  }
77 
78  string GetId(void) const
79  {
80  return m_Id;
81  }
82 
83  bool operator < (const SPSGS_BlobId & other) const
84  {
85  return m_Id < other.m_Id;
86  }
87 
88  bool operator == (const SPSGS_BlobId & other) const
89  {
90  return m_Id == other.m_Id;
91  }
92 
93  bool operator != (const SPSGS_BlobId & other) const
94  {
95  return !this->operator==(other);
96  }
97 
98  string m_Id;
99 };
100 
101 
102 // Forward declaration
103 // CPSGS_Request uses unique_ptr to SPSGS_RequestBase and
104 // SPSGS_RequestBase uses the request type from CPSGS_Request
105 struct SPSGS_RequestBase;
106 
108 {
109 public:
110  enum EPSGS_Type {
118 
120  };
121 
122  static string TypeToString(EPSGS_Type req_type)
123  {
124  switch (req_type) {
125  case ePSGS_ResolveRequest: return "ResolveRequest";
126  case ePSGS_BlobBySeqIdRequest: return "BlobBySeqIdRequest";
127  case ePSGS_BlobBySatSatKeyRequest: return "BlobBySatSatKeyRequest";
128  case ePSGS_AnnotationRequest: return "AnnotationRequest";
129  case ePSGS_TSEChunkRequest: return "TSEChunkRequest";
130  case ePSGS_AccessionVersionHistoryRequest: return "AccessionVersionHistoryRequest";
131  case ePSGS_IPGResolveRequest: return "IPGResolveRequest";
132  case ePSGS_UnknownRequest: return "UnknownRequest";
133  default: break;
134  }
135  return "UnknownRequestTypeValue (" + to_string(req_type) + ")";
136  }
137 
138 public:
139  CPSGS_Request();
140  virtual ~CPSGS_Request();
141  CPSGS_Request(const CHttpRequest & http_request,
142  unique_ptr<SPSGS_RequestBase> req,
143  CRef<CRequestContext> request_context);
144 
145  EPSGS_Type GetRequestType(void) const;
146  size_t GetRequestId(void) const
147  {
148  return m_RequestId;
149  }
150 
152  {
154  }
155 
157  {
158  return m_BacklogTimeMks;
159  }
160 
162  {
164  }
165 
166  size_t GetConcurrentProcessorCount(void) const
167  {
169  }
170 
171  // The Lock() call makes it possible for the other processors to wait for
172  // the event name
173  void Lock(const string & event_name);
174  // The Unlock() call signals for the waiting processors that they can
175  // continue
176  void Unlock(const string & event_name);
177  // The WaitFor() call blocks the processor till the event is unlocked
178  void WaitFor(const string & event_name, size_t timeout_sec = 10);
179 
180  template<typename TRequest> TRequest& GetRequest(void)
181  {
182  if (m_Request) {
183  TRequest* req = dynamic_cast<TRequest *>(m_Request.get());
184  if (req != nullptr)
185  return *req;
186  }
187 
188  NCBI_THROW(CPubseqGatewayException, eInvalidUserRequestType,
189  "User request type mismatch. Stored type: " +
191  }
192 
194  void SetRequestContext(void);
196  bool NeedTrace(void);
197  bool NeedProcessorEvents(void);
198  int GetHops(void);
199  optional<bool> GetIncludeHUP(void);
200  virtual string GetName(void) const;
201  virtual CJsonNode Serialize(void) const;
202 
203  optional<string> GetWebCubbyUser(void)
204  {
206  }
207 
208  size_t GetLimitedProcessorCount(void) const
209  {
210  return m_LimitedProcessors.size();
211  }
212 
213  void AddLimitedProcessor(const string & name, size_t limit)
214  {
215  m_LimitedProcessors.push_back(pair<string, size_t>(name, limit));
216  }
217 
218  string GetLimitedProcessorsMessage(void);
219 
220  CPSGS_Request(const CPSGS_Request &) = delete;
222  CPSGS_Request & operator=(const CPSGS_Request &) = delete;
224 
225 private:
227  unique_ptr<SPSGS_RequestBase> m_Request;
229  size_t m_RequestId;
231 
232 private:
233  struct SWaitData
234  {
239  };
240 
243  {}
244 
246  size_t m_WaitCount;
247  condition_variable m_WaitObject;
248  };
249 
250  // Number of processors serving the request
252  mutex m_WaitLock;
253  map<string, SWaitData *> m_Wait;
254 
255  // Processors which have not been instantiated due to a concurrency limit
256  // together with the actual limit
257  vector<pair<string, size_t>> m_LimitedProcessors;
258 };
259 
260 
261 
262 // Base struct for all requests: any request can be traceable and has a start
263 // time
265 {
266  // Use cache option comes from the user (the URL 'use_cache' parameter)
270  ePSGS_CacheAndDb, // Default
271 
273  };
274 
276  {
277  switch (option) {
278  case ePSGS_CacheOnly: return "CacheOnly";
279  case ePSGS_DbOnly: return "DbOnly";
280  case ePSGS_CacheAndDb: return "CacheAndDb";
281  case ePSGS_UnknownUseCache: return "UnknownUseCache";
282  default: break;
283  }
284  return "UnknownCacheAndDbUseOptionValue";
285  }
286 
287  // The accession substitution option comes from the user (the URL
288  // 'acc_substitution' parameter)
293 
295  };
296 
298  {
299  switch (option) {
300  case ePSGS_DefaultAccSubstitution: return "DefaultAccSubstitution";
301  case ePSGS_LimitedAccSubstitution: return "LimitedAccSubstitution";
302  case ePSGS_NeverAccSubstitute: return "NeverAccSubstitute";
303  case ePSGS_UnknownAccSubstitution: return "UnknownAccSubstitution";
304  default: break;
305  }
306  return "UnknownAccSubstitutioOptionValue";
307  }
308 
309  enum EPSGS_Trace {
312  };
313 
315  {
316  switch (trace) {
317  case ePSGS_NoTracing: return "NoTracing";
318  case ePSGS_WithTracing: return "WithTracing";
319  default: break;
320  }
321  return "UnknownTraceOptionValue";
322  }
323 
327  vector<string> m_EnabledProcessors;
328  vector<string> m_DisabledProcessors;
329 
334  {}
335 
337  bool processor_events,
338  const vector<string> & enabled_processors,
339  const vector<string> & disabled_processors,
340  const psg_time_point_t & start) :
341  m_Trace(trace), m_ProcessorEvents(processor_events),
342  m_StartTimestamp(start),
343  m_EnabledProcessors(enabled_processors),
344  m_DisabledProcessors(disabled_processors)
345  {}
346 
347  virtual ~SPSGS_RequestBase() {}
348 
349  virtual CPSGS_Request::EPSGS_Type GetRequestType(void) const = 0;
350  virtual string GetName(void) const = 0;
351  virtual CJsonNode Serialize(void) const = 0;
352 
353  virtual EPSGS_Trace GetTrace(void) const
354  {
355  return m_Trace;
356  }
357 
358  virtual bool GetProcessorEvents(void) const
359  {
360  return m_ProcessorEvents;
361  }
362 
364  {
365  return m_StartTimestamp;
366  }
367 
368  void AppendCommonParameters(CJsonNode & json) const;
369 
374 };
375 
376 
377 // Resolve request parsed parameters
379 {
380  // The output format may come from the user (the URL 'fmt' parameter)
384  ePSGS_NativeFormat, // Default: the server decides between
385  // protobuf and json
386 
388  };
389 
391  {
392  switch (format) {
393  case ePSGS_ProtobufFormat: return "ProtobufFormat";
394  case ePSGS_JsonFormat: return "JsonFormat";
395  case ePSGS_NativeFormat: return "NativeFormat";
396  case ePSGS_UnknownFormat: return "UnknownFormat";
397  default: break;
398  }
399  return "UnknownFormatOptionValue";
400  }
401 
402  // The user can specify what fields of the bioseq_info should be included
403  // into the server response.
404  // Pretty much copied from the client; the justfication for copying is:
405  // "it will be decoupled with the client type"
407  fPSGS_CanonicalId = (1 << 1),
408  fPSGS_SeqIds = (1 << 2),
409  fPSGS_MoleculeType = (1 << 3),
410  fPSGS_Length = (1 << 4),
411  fPSGS_State = (1 << 5),
412  fPSGS_BlobId = (1 << 6),
413  fPSGS_TaxId = (1 << 7),
414  fPSGS_Hash = (1 << 8),
415  fPSGS_DateChanged = (1 << 9),
416  fPSGS_Gi = (1 << 10),
417  fPSGS_Name = (1 << 11),
418  fPSGS_SeqState = (1 << 12),
419 
426  };
427 
428  // Bit-set of EPSGS_BioseqIncludeData flags
430 
431 
432  string m_SeqId;
439  int m_Hops;
440 
441  SPSGS_ResolveRequest(const string & seq_id,
442  int seq_id_type,
443  TPSGS_BioseqIncludeData include_data_flags,
444  EPSGS_OutputFormat output_format,
445  EPSGS_CacheAndDbUse use_cache,
446  EPSGS_AccSubstitutioOption subst_option,
447  bool seq_id_resolve,
448  int hops,
450  bool processor_events,
451  const vector<string> & enabled_processors,
452  const vector<string> & disabled_processors,
453  const psg_time_point_t & start_timestamp) :
454  SPSGS_RequestBase(trace, processor_events,
455  enabled_processors, disabled_processors,
456  start_timestamp),
457  m_SeqId(seq_id), m_SeqIdType(seq_id_type),
458  m_IncludeDataFlags(include_data_flags),
459  m_OutputFormat(output_format),
460  m_UseCache(use_cache),
461  m_AccSubstOption(subst_option),
462  m_SeqIdResolve(seq_id_resolve),
463  m_Hops(hops)
464  {}
465 
467  m_SeqIdType(-1),
472  m_SeqIdResolve(true), // default
473  m_Hops(0)
474  {}
475 
477  {
479  }
480 
481  virtual string GetName(void) const
482  {
483  return "ID/resolve";
484  }
485 
486  virtual CJsonNode Serialize(void) const;
487 
492 };
493 
494 
496 {
497  // The TSE option comes from the user (the URL 'tse' parameter)
503  ePSGS_OrigTSE, // Default value
504 
506  };
507 
509  {
510  switch (option) {
511  case ePSGS_NoneTSE: return "NoneTSE";
512  case ePSGS_SlimTSE: return "SlimTSE";
513  case ePSGS_SmartTSE: return "SmartTSE";
514  case ePSGS_WholeTSE: return "WholeTSE";
515  case ePSGS_OrigTSE: return "OrigTSE";
516  case ePSGS_UnknownTSE: return "UnknownTSE";
517  default: break;
518  }
519  return "UnknownOptionValue";
520  }
521 
522 
525  string m_ClientId;
526  unsigned long m_SendBlobIfSmall; // 0 - means do not send
527  // only for slim and smart
528 
529  // Both cases: by seq_id/seq_id_type and by sat/sat_key store the
530  // required blob id here.
531  // When the seq_id/seq_id_type is resolved to sat/sat_key the m_BlobId
532  // is populated
534 
535  int m_Hops;
536  optional<bool> m_IncludeHUP;
537 
539  EPSGS_CacheAndDbUse use_cache,
540  const string & client_id,
541  int send_blob_if_small,
542  int hops,
543  const optional<bool> & include_hup,
545  bool processor_events,
546  const vector<string> & enabled_processors,
547  const vector<string> & disabled_processors,
548  const psg_time_point_t & start_timestamp) :
549  SPSGS_RequestBase(trace, processor_events,
550  enabled_processors, disabled_processors,
551  start_timestamp),
552  m_TSEOption(tse_option),
553  m_UseCache(use_cache),
554  m_ClientId(client_id),
555  m_SendBlobIfSmall(send_blob_if_small),
556  m_Hops(hops), m_IncludeHUP(include_hup)
557  {}
558 
563  m_Hops(0)
564  {}
565 
566  void AppendCommonParameters(CJsonNode & json) const;
567 
572 };
573 
574 
575 // Blob by seq_id request (eBlobBySeqIdRequest)
577 {
578  string m_SeqId;
580  vector<string> m_ExcludeBlobs;
582  unsigned long m_ResendTimeoutMks;
584 
585  SPSGS_BlobBySeqIdRequest(const string & seq_id,
586  int seq_id_type,
587  vector<string> & exclude_blobs,
588  EPSGS_TSEOption tse_option,
589  EPSGS_CacheAndDbUse use_cache,
590  EPSGS_AccSubstitutioOption subst_option,
591  double resend_timeout,
592  const string & client_id,
593  int send_blob_if_small,
594  bool seq_id_resolve,
595  int hops,
596  const optional<bool> & include_hup,
598  bool processor_events,
599  const vector<string> & enabled_processors,
600  const vector<string> & disabled_processors,
601  const psg_time_point_t & start_timestamp) :
602  SPSGS_BlobRequestBase(tse_option, use_cache, client_id, send_blob_if_small,
603  hops, include_hup, trace, processor_events,
604  enabled_processors, disabled_processors,
605  start_timestamp),
606  m_SeqId(seq_id),
607  m_SeqIdType(seq_id_type),
608  m_ExcludeBlobs(std::move(exclude_blobs)),
609  m_AccSubstOption(subst_option),
610  m_ResendTimeoutMks((unsigned long)(resend_timeout * 1000000)),
611  m_SeqIdResolve(seq_id_resolve)
612  {}
613 
615  m_SeqIdType(-1),
618  m_SeqIdResolve(true) // default
619  {}
620 
622  {
624  }
625 
626  virtual string GetName(void) const
627  {
628  return "ID/get";
629  }
630 
631  virtual CJsonNode Serialize(void) const;
632 
637 };
638 
639 
640 // Blob by sat/sat_key request (eBlobBySatSatKeyRequest)
642 {
644 
646  CBlobRecord::TTimestamp last_modified,
647  EPSGS_TSEOption tse_option,
648  EPSGS_CacheAndDbUse use_cache,
649  const string & client_id,
650  int send_blob_if_small,
651  int hops,
652  const optional<bool> & include_hup,
654  bool processor_events,
655  const vector<string> & enabled_processors,
656  const vector<string> & disabled_processors,
657  const psg_time_point_t & start_timestamp) :
658  SPSGS_BlobRequestBase(tse_option, use_cache, client_id, send_blob_if_small,
659  hops, include_hup, trace, processor_events,
660  enabled_processors, disabled_processors,
661  start_timestamp),
662  m_LastModified(last_modified)
663  {
664  m_BlobId = blob_id;
665  }
666 
669  {}
670 
672  {
674  }
675 
676  virtual string GetName(void) const
677  {
678  return "ID/getblob";
679  }
680 
681  virtual CJsonNode Serialize(void) const;
682 
687 };
688 
689 
691 {
692  string m_SeqId;
694  vector<string> m_Names;
695  unsigned long m_ResendTimeoutMks;
696  vector<string> m_SeqIds;
698  optional<CSeq_id::ESNPScaleLimit> m_SNPScaleLimit;
699 
700  SPSGS_AnnotRequest(const string & seq_id,
701  int seq_id_type,
702  vector<string> & names,
703  EPSGS_CacheAndDbUse use_cache,
704  double resend_timeout,
705  vector<string> & seq_ids,
706  const string & client_id,
708  int send_blob_if_small,
709  bool seq_id_resolve,
710  optional<CSeq_id::ESNPScaleLimit> & snp_scale_limit,
711  int hops,
712  const optional<bool> & include_hup,
714  bool processor_events,
715  const vector<string> & enabled_processors,
716  const vector<string> & disabled_processors,
717  const psg_time_point_t & start_timestamp) :
718  SPSGS_BlobRequestBase(tse_option, use_cache, client_id, send_blob_if_small,
719  hops, include_hup, trace, processor_events,
720  enabled_processors, disabled_processors,
721  start_timestamp),
722  m_SeqId(seq_id),
723  m_SeqIdType(seq_id_type),
724  m_Names(std::move(names)),
725  m_ResendTimeoutMks((unsigned long)(resend_timeout * 1000000)),
726  m_SeqIds(std::move(seq_ids)),
727  m_SeqIdResolve(seq_id_resolve),
728  m_SNPScaleLimit(snp_scale_limit),
729  m_Lock(false),
731  {}
732 
734  m_SeqIdType(-1),
736  m_SeqIdResolve(true), // default
737  m_Lock(false),
739  {}
740 
745 
747  {
749  }
750 
751  virtual string GetName(void) const
752  {
753  return "ID/get_na";
754  }
755 
756  virtual CJsonNode Serialize(void) const;
757 
758  // Facilities to work with the list of already processed names
759 
760  // If the given name is already in the list then the priority
761  // of the processor which has registered it before is returned
762  // If the given name is not in the list then kUnknownPriority constant is
763  // returned.
765  const string & name);
766 
767 
768  // If bioseq info has already been sent then the priority of the processor
769  // which sent it will be returned. Otherwise kUnknownPriority constant is
770  // returned.
771  // The highest priority of all the calls will be stored.
773 
774  // Names which have not been processed by a processor which priority
775  // is higher than given
776  vector<string> GetNotProcessedName(TProcessorPriority priority);
777 
778  vector<pair<TProcessorPriority, string>> GetProcessedNames(void) const;
779 
780  // Used to track a status of each individual annotation
782  // ePSGS_RS_Success = 200, implicitly memorized when a
783  // processor checks priority before
784  // sending
785  ePSGS_RS_NotFound = 404, // Used by a processor
786  ePSGS_RS_Error = 500, // Used by a processor
787  ePSGS_RS_Unavailable = 503, // This is for the case when a
788  // processor was not instantiated.
789  // Used by the framework
790  ePSGS_RS_Timeout = 504 // Used by a processor
791  };
792 
793  void ReportResultStatus(const string & annot_name, EPSGS_ResultStatus rs);
794 
795  // In case of exactly one annotation requested it is possible that blob
796  // props and blob chunks are need to be sent to the client. Thus it is
797  // possible that there is an error during the blob prop or blob chunks
798  // stage. This method should be called by the corresponding processor if
799  // such an error encountered.
800  // The rs is expected to be here a timeout or an error
801  void ReportBlobError(TProcessorPriority priority,
802  EPSGS_ResultStatus rs);
803 
805  {
806  return m_NotFound;
807  }
808 
810  {
811  return m_ErrorAnnotations;
812  }
813 
814  bool WasSent(const string & annot_name) const;
815 
816 private:
817  // A list of names which have been already processed by some processors
818  mutable atomic<bool> m_Lock;
820  vector<pair<TProcessorPriority, string>> m_Processed;
821 
822  // Processor reported not found annotations
824 
825  // This map includes limited, error and timeout annotations and stores only
826  // the highest reported code. This is because the highest error will be
827  // reported to the client.
829 };
830 
831 
833 {
835  string m_Id2Info;
837  int m_Hops;
838  optional<bool> m_IncludeHUP;
839 
841  const string & id2_info,
842  EPSGS_CacheAndDbUse use_cache,
843  int hops,
844  const optional<bool> & include_hup,
846  bool processor_events,
847  const vector<string> & enabled_processors,
848  const vector<string> & disabled_processors,
849  const psg_time_point_t & start_timestamp) :
850  SPSGS_RequestBase(trace, processor_events,
851  enabled_processors, disabled_processors,
852  start_timestamp),
853  m_Id2Chunk(id2_chunk),
854  m_Id2Info(id2_info),
855  m_UseCache(use_cache),
856  m_Hops(hops),
857  m_IncludeHUP(include_hup)
858  {}
859 
863  m_Hops(0)
864  {}
865 
867  {
869  }
870 
871  virtual string GetName(void) const
872  {
873  return "ID/get_tse_chunk";
874  }
875 
876  virtual CJsonNode Serialize(void) const;
877 
882 };
883 
884 
886 {
887  string m_SeqId;
890  int m_Hops;
891 
893  const string & seq_id,
894  int seq_id_type,
895  EPSGS_CacheAndDbUse use_cache,
896  int hops,
898  bool processor_events,
899  const vector<string> & enabled_processors,
900  const vector<string> & disabled_processors,
901  const psg_time_point_t & start_timestamp) :
902  SPSGS_RequestBase(trace, processor_events,
903  enabled_processors, disabled_processors,
904  start_timestamp),
905  m_SeqId(seq_id), m_SeqIdType(seq_id_type),
906  m_UseCache(use_cache),
907  m_Hops(hops)
908  {}
909 
911  m_SeqIdType(-1),
913  m_Hops(0)
914  {}
915 
917  {
919  }
920 
921  virtual string GetName(void) const
922  {
923  return "ID/accession_version_history";
924  }
925 
926  virtual CJsonNode Serialize(void) const;
927 
932 };
933 
934 
936 {
937  optional<string> m_Protein;
939  optional<string> m_Nucleotide;
942 
943  SPSGS_IPGResolveRequest(const optional<string> & protein,
944  int64_t ipg,
945  const optional<string> & nucleotide,
946  EPSGS_CacheAndDbUse use_cache,
947  bool seq_id_resolve,
949  bool processor_events,
950  const vector<string> & enabled_processors,
951  const vector<string> & disabled_processors,
952  const psg_time_point_t & start_timestamp) :
953  SPSGS_RequestBase(trace, processor_events,
954  enabled_processors, disabled_processors,
955  start_timestamp),
956  m_Protein(protein), m_IPG(ipg), m_Nucleotide(nucleotide),
957  m_UseCache(use_cache), m_SeqIdResolve(seq_id_resolve)
958  {}
959 
961  m_IPG(-1),
963  m_SeqIdResolve(true) // default
964  {}
965 
967  {
969  }
970 
971  virtual string GetName(void) const
972  {
973  return "IPG/resolve";
974  }
975 
976  virtual CJsonNode Serialize(void) const;
977 
982 };
983 
984 #endif // PSGS_REQUEST__HPP
985 
int64_t TTimestamp
Definition: blob_record.hpp:56
HTTP request.
optional< string > GetWebCubbyUser(void)
JSON node abstraction.
CHttpRequest m_HttpRequest
void WaitFor(const string &event_name, size_t timeout_sec=10)
void Lock(const string &event_name)
size_t GetRequestId(void) const
int GetHops(void)
map< string, SWaitData * > m_Wait
static string TypeToString(EPSGS_Type req_type)
void SetRequestContext(void)
void AddLimitedProcessor(const string &name, size_t limit)
CPSGS_Request & operator=(const CPSGS_Request &)=delete
CPSGS_Request & operator=(CPSGS_Request &&)=delete
optional< bool > GetIncludeHUP(void)
virtual CJsonNode Serialize(void) const
CRef< CRequestContext > GetRequestContext(void)
bool NeedTrace(void)
EPSGS_Type GetRequestType(void) const
void SetConcurrentProcessorCount(size_t cnt)
string GetLimitedProcessorsMessage(void)
CRef< CRequestContext > m_RequestContext
size_t GetConcurrentProcessorCount(void) const
size_t GetLimitedProcessorCount(void) const
unique_ptr< SPSGS_RequestBase > m_Request
size_t m_ConcurrentProcessorCount
uint64_t GetBacklogTime(void) const
optional< string > GetWebCubbyUser(void)
void Unlock(const string &event_name)
bool NeedProcessorEvents(void)
vector< pair< string, size_t > > m_LimitedProcessors
virtual ~CPSGS_Request()
CPSGS_Request(CPSGS_Request &&)=delete
uint64_t m_BacklogTimeMks
@ ePSGS_BlobBySatSatKeyRequest
@ ePSGS_AccessionVersionHistoryRequest
CPSGS_Request(const CPSGS_Request &)=delete
psg_time_point_t GetStartTimestamp(void) const
virtual string GetName(void) const
void SetBacklogTime(uint64_t val)
TRequest & GetRequest(void)
static const struct name_t names[]
#define true
Definition: bool.h:35
#define false
Definition: bool.h:36
#define option
Uint8 uint64_t
Int4 int32_t
Int8 int64_t
static bool trace
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
Definition: ncbiexpt.hpp:704
static Format format
Definition: njn_ioutil.cpp:53
static unsigned cnt[256]
USING_SCOPE(objects)
USING_IDBLOB_SCOPE
USING_NCBI_SCOPE
chrono::steady_clock psg_clock_t
int TProcessorPriority
const int kUnknownPriority
psg_clock_t::time_point psg_time_point_t
Defines CRequestContext class for NCBI C++ diagnostic API.
#define INT64_MIN
Definition: stdint.h:184
EPSGS_WaitObjectState m_State
condition_variable m_WaitObject
SPSGS_AccessionVersionHistoryRequest(const SPSGS_AccessionVersionHistoryRequest &)=default
virtual string GetName(void) const
SPSGS_AccessionVersionHistoryRequest & operator=(SPSGS_AccessionVersionHistoryRequest &&)=default
SPSGS_AccessionVersionHistoryRequest(SPSGS_AccessionVersionHistoryRequest &&)=default
virtual CPSGS_Request::EPSGS_Type GetRequestType(void) const
virtual CJsonNode Serialize(void) const
SPSGS_AccessionVersionHistoryRequest(const string &seq_id, int seq_id_type, EPSGS_CacheAndDbUse use_cache, int hops, EPSGS_Trace trace, bool processor_events, const vector< string > &enabled_processors, const vector< string > &disabled_processors, const psg_time_point_t &start_timestamp)
SPSGS_AccessionVersionHistoryRequest & operator=(const SPSGS_AccessionVersionHistoryRequest &)=default
SPSGS_AnnotRequest(const string &seq_id, int seq_id_type, vector< string > &names, EPSGS_CacheAndDbUse use_cache, double resend_timeout, vector< string > &seq_ids, const string &client_id, SPSGS_BlobRequestBase::EPSGS_TSEOption tse_option, int send_blob_if_small, bool seq_id_resolve, optional< CSeq_id::ESNPScaleLimit > &snp_scale_limit, int hops, const optional< bool > &include_hup, EPSGS_Trace trace, bool processor_events, const vector< string > &enabled_processors, const vector< string > &disabled_processors, const psg_time_point_t &start_timestamp)
SPSGS_AnnotRequest(SPSGS_AnnotRequest &&)=delete
TProcessorPriority RegisterProcessedName(TProcessorPriority priority, const string &name)
bool WasSent(const string &annot_name) const
optional< CSeq_id::ESNPScaleLimit > m_SNPScaleLimit
map< string, int > GetErrorNames(void) const
vector< string > m_Names
set< string > GetNotFoundNames(void) const
SPSGS_AnnotRequest & operator=(SPSGS_AnnotRequest &&)=delete
map< string, int > m_ErrorAnnotations
vector< string > GetNotProcessedName(TProcessorPriority priority)
vector< pair< TProcessorPriority, string > > m_Processed
vector< pair< TProcessorPriority, string > > GetProcessedNames(void) const
vector< string > m_SeqIds
TProcessorPriority RegisterBioseqInfo(TProcessorPriority priority)
virtual CPSGS_Request::EPSGS_Type GetRequestType(void) const
atomic< bool > m_Lock
virtual string GetName(void) const
void ReportBlobError(TProcessorPriority priority, EPSGS_ResultStatus rs)
set< string > m_NotFound
unsigned long m_ResendTimeoutMks
SPSGS_AnnotRequest(const SPSGS_AnnotRequest &)=delete
SPSGS_AnnotRequest & operator=(const SPSGS_AnnotRequest &)=delete
void ReportResultStatus(const string &annot_name, EPSGS_ResultStatus rs)
TProcessorPriority m_ProcessedBioseqInfo
virtual CJsonNode Serialize(void) const
virtual CJsonNode Serialize(void) const
virtual string GetName(void) const
SPSGS_BlobBySatSatKeyRequest & operator=(SPSGS_BlobBySatSatKeyRequest &&)=default
SPSGS_BlobBySatSatKeyRequest(const SPSGS_BlobId &blob_id, CBlobRecord::TTimestamp last_modified, EPSGS_TSEOption tse_option, EPSGS_CacheAndDbUse use_cache, const string &client_id, int send_blob_if_small, int hops, const optional< bool > &include_hup, EPSGS_Trace trace, bool processor_events, const vector< string > &enabled_processors, const vector< string > &disabled_processors, const psg_time_point_t &start_timestamp)
SPSGS_BlobBySatSatKeyRequest(const SPSGS_BlobBySatSatKeyRequest &)=default
virtual CPSGS_Request::EPSGS_Type GetRequestType(void) const
SPSGS_BlobBySatSatKeyRequest & operator=(const SPSGS_BlobBySatSatKeyRequest &)=default
SPSGS_BlobBySatSatKeyRequest(SPSGS_BlobBySatSatKeyRequest &&)=default
CBlobRecord::TTimestamp m_LastModified
virtual CJsonNode Serialize(void) const
virtual string GetName(void) const
vector< string > m_ExcludeBlobs
virtual CPSGS_Request::EPSGS_Type GetRequestType(void) const
SPSGS_BlobBySeqIdRequest(SPSGS_BlobBySeqIdRequest &&)=default
SPSGS_BlobBySeqIdRequest & operator=(SPSGS_BlobBySeqIdRequest &&)=default
unsigned long m_ResendTimeoutMks
SPSGS_BlobBySeqIdRequest(const string &seq_id, int seq_id_type, vector< string > &exclude_blobs, EPSGS_TSEOption tse_option, EPSGS_CacheAndDbUse use_cache, EPSGS_AccSubstitutioOption subst_option, double resend_timeout, const string &client_id, int send_blob_if_small, bool seq_id_resolve, int hops, const optional< bool > &include_hup, EPSGS_Trace trace, bool processor_events, const vector< string > &enabled_processors, const vector< string > &disabled_processors, const psg_time_point_t &start_timestamp)
EPSGS_AccSubstitutioOption m_AccSubstOption
SPSGS_BlobBySeqIdRequest(const SPSGS_BlobBySeqIdRequest &)=default
SPSGS_BlobBySeqIdRequest & operator=(const SPSGS_BlobBySeqIdRequest &)=default
SPSGS_BlobId(const SPSGS_BlobId &)=default
SPSGS_BlobId(SPSGS_BlobId &&)=default
bool operator==(const SPSGS_BlobId &other) const
string GetId(void) const
SPSGS_BlobId(const string &blob_id)
SPSGS_BlobId & operator=(const SPSGS_BlobId &)=default
void SetId(const string &blob_id)
bool operator<(const SPSGS_BlobId &other) const
bool operator!=(const SPSGS_BlobId &other) const
SPSGS_BlobId & operator=(SPSGS_BlobId &&)=default
EPSGS_CacheAndDbUse m_UseCache
static string TSEOptionToString(EPSGS_TSEOption option)
SPSGS_BlobRequestBase(const SPSGS_BlobRequestBase &)=default
void AppendCommonParameters(CJsonNode &json) const
unsigned long m_SendBlobIfSmall
SPSGS_BlobRequestBase(SPSGS_BlobRequestBase &&)=default
SPSGS_BlobRequestBase & operator=(const SPSGS_BlobRequestBase &)=default
SPSGS_BlobRequestBase & operator=(SPSGS_BlobRequestBase &&)=default
EPSGS_TSEOption m_TSEOption
SPSGS_BlobRequestBase(EPSGS_TSEOption tse_option, EPSGS_CacheAndDbUse use_cache, const string &client_id, int send_blob_if_small, int hops, const optional< bool > &include_hup, EPSGS_Trace trace, bool processor_events, const vector< string > &enabled_processors, const vector< string > &disabled_processors, const psg_time_point_t &start_timestamp)
optional< bool > m_IncludeHUP
optional< string > m_Protein
virtual CPSGS_Request::EPSGS_Type GetRequestType(void) const
SPSGS_IPGResolveRequest(const optional< string > &protein, int64_t ipg, const optional< string > &nucleotide, EPSGS_CacheAndDbUse use_cache, bool seq_id_resolve, EPSGS_Trace trace, bool processor_events, const vector< string > &enabled_processors, const vector< string > &disabled_processors, const psg_time_point_t &start_timestamp)
EPSGS_CacheAndDbUse m_UseCache
SPSGS_IPGResolveRequest(SPSGS_IPGResolveRequest &&)=default
optional< string > m_Nucleotide
SPSGS_IPGResolveRequest & operator=(SPSGS_IPGResolveRequest &&)=default
virtual CJsonNode Serialize(void) const
SPSGS_IPGResolveRequest & operator=(const SPSGS_IPGResolveRequest &)=default
SPSGS_IPGResolveRequest(const SPSGS_IPGResolveRequest &)=default
virtual string GetName(void) const
virtual bool GetProcessorEvents(void) const
virtual CPSGS_Request::EPSGS_Type GetRequestType(void) const =0
virtual ~SPSGS_RequestBase()
static string TraceToString(EPSGS_Trace trace)
static string CacheAndDbUseToString(EPSGS_CacheAndDbUse option)
SPSGS_RequestBase & operator=(const SPSGS_RequestBase &)=default
EPSGS_Trace m_Trace
virtual EPSGS_Trace GetTrace(void) const
virtual CJsonNode Serialize(void) const =0
vector< string > m_DisabledProcessors
virtual psg_time_point_t GetStartTimestamp(void) const
vector< string > m_EnabledProcessors
SPSGS_RequestBase(EPSGS_Trace trace, bool processor_events, const vector< string > &enabled_processors, const vector< string > &disabled_processors, const psg_time_point_t &start)
static string AccSubstitutioOptionToString(EPSGS_AccSubstitutioOption option)
SPSGS_RequestBase(SPSGS_RequestBase &&)=default
psg_time_point_t m_StartTimestamp
SPSGS_RequestBase(const SPSGS_RequestBase &)=default
virtual string GetName(void) const =0
SPSGS_RequestBase & operator=(SPSGS_RequestBase &&)=default
void AppendCommonParameters(CJsonNode &json) const
static string OutputFormatToString(EPSGS_OutputFormat format)
EPSGS_CacheAndDbUse m_UseCache
virtual CPSGS_Request::EPSGS_Type GetRequestType(void) const
SPSGS_ResolveRequest(const string &seq_id, int seq_id_type, TPSGS_BioseqIncludeData include_data_flags, EPSGS_OutputFormat output_format, EPSGS_CacheAndDbUse use_cache, EPSGS_AccSubstitutioOption subst_option, bool seq_id_resolve, int hops, EPSGS_Trace trace, bool processor_events, const vector< string > &enabled_processors, const vector< string > &disabled_processors, const psg_time_point_t &start_timestamp)
virtual CJsonNode Serialize(void) const
virtual string GetName(void) const
TPSGS_BioseqIncludeData m_IncludeDataFlags
SPSGS_ResolveRequest & operator=(const SPSGS_ResolveRequest &)=default
EPSGS_OutputFormat m_OutputFormat
EPSGS_AccSubstitutioOption m_AccSubstOption
SPSGS_ResolveRequest(const SPSGS_ResolveRequest &)=default
SPSGS_ResolveRequest & operator=(SPSGS_ResolveRequest &&)=default
SPSGS_ResolveRequest(SPSGS_ResolveRequest &&)=default
SPSGS_TSEChunkRequest(int64_t id2_chunk, const string &id2_info, EPSGS_CacheAndDbUse use_cache, int hops, const optional< bool > &include_hup, EPSGS_Trace trace, bool processor_events, const vector< string > &enabled_processors, const vector< string > &disabled_processors, const psg_time_point_t &start_timestamp)
virtual CJsonNode Serialize(void) const
EPSGS_CacheAndDbUse m_UseCache
optional< bool > m_IncludeHUP
SPSGS_TSEChunkRequest & operator=(SPSGS_TSEChunkRequest &&)=default
SPSGS_TSEChunkRequest(SPSGS_TSEChunkRequest &&)=default
SPSGS_TSEChunkRequest(const SPSGS_TSEChunkRequest &)=default
virtual string GetName(void) const
virtual CPSGS_Request::EPSGS_Type GetRequestType(void) const
SPSGS_TSEChunkRequest & operator=(const SPSGS_TSEChunkRequest &)=default
Modified on Fri Sep 20 14:57:58 2024 by modify_doxy.py rev. 669887