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 101453 2023-12-14 20:19:17Z 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  ~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  virtual string GetName(void) const;
200  virtual CJsonNode Serialize(void) const;
201 
202  optional<string> GetWebCubbyUser(void)
203  {
205  }
206 
207  size_t GetLimitedProcessorCount(void) const
208  {
209  return m_LimitedProcessors.size();
210  }
211 
212  void AddLimitedProcessor(const string & name, size_t limit)
213  {
214  m_LimitedProcessors.push_back(pair<string, size_t>(name, limit));
215  }
216 
217  string GetLimitedProcessorsMessage(void);
218 
219  CPSGS_Request(const CPSGS_Request &) = default;
221  CPSGS_Request & operator=(const CPSGS_Request &) = default;
223 
224 private:
226  unique_ptr<SPSGS_RequestBase> m_Request;
228  size_t m_RequestId;
230 
231 private:
232  struct SWaitData
233  {
238  };
239 
242  {}
243 
245  size_t m_WaitCount;
246  condition_variable m_WaitObject;
247  };
248 
249  // Number of processors serving the request
251  mutex m_WaitLock;
252  map<string, SWaitData *> m_Wait;
253 
254  // Processors which have not been instantiated due to a concurrency limit
255  // together with the actual limit
256  vector<pair<string, size_t>> m_LimitedProcessors;
257 };
258 
259 
260 
261 // Base struct for all requests: any request can be traceable and has a start
262 // time
264 {
265  // Use cache option comes from the user (the URL 'use_cache' parameter)
269  ePSGS_CacheAndDb, // Default
270 
272  };
273 
275  {
276  switch (option) {
277  case ePSGS_CacheOnly: return "CacheOnly";
278  case ePSGS_DbOnly: return "DbOnly";
279  case ePSGS_CacheAndDb: return "CacheAndDb";
280  case ePSGS_UnknownUseCache: return "UnknownUseCache";
281  default: break;
282  }
283  return "UnknownCacheAndDbUseOptionValue";
284  }
285 
286  // The accession substitution option comes from the user (the URL
287  // 'acc_substitution' parameter)
292 
294  };
295 
297  {
298  switch (option) {
299  case ePSGS_DefaultAccSubstitution: return "DefaultAccSubstitution";
300  case ePSGS_LimitedAccSubstitution: return "LimitedAccSubstitution";
301  case ePSGS_NeverAccSubstitute: return "NeverAccSubstitute";
302  case ePSGS_UnknownAccSubstitution: return "UnknownAccSubstitution";
303  default: break;
304  }
305  return "UnknownAccSubstitutioOptionValue";
306  }
307 
308  enum EPSGS_Trace {
311  };
312 
314  {
315  switch (trace) {
316  case ePSGS_NoTracing: return "NoTracing";
317  case ePSGS_WithTracing: return "WithTracing";
318  default: break;
319  }
320  return "UnknownTraceOptionValue";
321  }
322 
326  vector<string> m_EnabledProcessors;
327  vector<string> m_DisabledProcessors;
328 
333  {}
334 
336  bool processor_events,
337  const vector<string> & enabled_processors,
338  const vector<string> & disabled_processors,
339  const psg_time_point_t & start) :
340  m_Trace(trace), m_ProcessorEvents(processor_events),
341  m_StartTimestamp(start),
342  m_EnabledProcessors(enabled_processors),
343  m_DisabledProcessors(disabled_processors)
344  {}
345 
346  virtual ~SPSGS_RequestBase() {}
347 
348  virtual CPSGS_Request::EPSGS_Type GetRequestType(void) const = 0;
349  virtual string GetName(void) const = 0;
350  virtual CJsonNode Serialize(void) const = 0;
351 
352  virtual EPSGS_Trace GetTrace(void) const
353  {
354  return m_Trace;
355  }
356 
357  virtual bool GetProcessorEvents(void) const
358  {
359  return m_ProcessorEvents;
360  }
361 
363  {
364  return m_StartTimestamp;
365  }
366 
367  void AppendCommonParameters(CJsonNode & json) const;
368 
373 };
374 
375 
376 // Resolve request parsed parameters
378 {
379  // The output format may come from the user (the URL 'fmt' parameter)
383  ePSGS_NativeFormat, // Default: the server decides between
384  // protobuf and json
385 
387  };
388 
390  {
391  switch (format) {
392  case ePSGS_ProtobufFormat: return "ProtobufFormat";
393  case ePSGS_JsonFormat: return "JsonFormat";
394  case ePSGS_NativeFormat: return "NativeFormat";
395  case ePSGS_UnknownFormat: return "UnknownFormat";
396  default: break;
397  }
398  return "UnknownFormatOptionValue";
399  }
400 
401  // The user can specify what fields of the bioseq_info should be included
402  // into the server response.
403  // Pretty much copied from the client; the justfication for copying is:
404  // "it will be decoupled with the client type"
406  fPSGS_CanonicalId = (1 << 1),
407  fPSGS_SeqIds = (1 << 2),
408  fPSGS_MoleculeType = (1 << 3),
409  fPSGS_Length = (1 << 4),
410  fPSGS_State = (1 << 5),
411  fPSGS_BlobId = (1 << 6),
412  fPSGS_TaxId = (1 << 7),
413  fPSGS_Hash = (1 << 8),
414  fPSGS_DateChanged = (1 << 9),
415  fPSGS_Gi = (1 << 10),
416  fPSGS_Name = (1 << 11),
417  fPSGS_SeqState = (1 << 12),
418 
425  };
426 
427  // Bit-set of EPSGS_BioseqIncludeData flags
429 
430 
431  string m_SeqId;
438  int m_Hops;
439 
440  SPSGS_ResolveRequest(const string & seq_id,
441  int seq_id_type,
442  TPSGS_BioseqIncludeData include_data_flags,
443  EPSGS_OutputFormat output_format,
444  EPSGS_CacheAndDbUse use_cache,
445  EPSGS_AccSubstitutioOption subst_option,
446  bool seq_id_resolve,
447  int hops,
449  bool processor_events,
450  const vector<string> & enabled_processors,
451  const vector<string> & disabled_processors,
452  const psg_time_point_t & start_timestamp) :
453  SPSGS_RequestBase(trace, processor_events,
454  enabled_processors, disabled_processors,
455  start_timestamp),
456  m_SeqId(seq_id), m_SeqIdType(seq_id_type),
457  m_IncludeDataFlags(include_data_flags),
458  m_OutputFormat(output_format),
459  m_UseCache(use_cache),
460  m_AccSubstOption(subst_option),
461  m_SeqIdResolve(seq_id_resolve),
462  m_Hops(hops)
463  {}
464 
466  m_SeqIdType(-1),
471  m_SeqIdResolve(true), // default
472  m_Hops(0)
473  {}
474 
476  {
478  }
479 
480  virtual string GetName(void) const
481  {
482  return "ID/resolve";
483  }
484 
485  virtual CJsonNode Serialize(void) const;
486 
491 };
492 
493 
495 {
496  // The TSE option comes from the user (the URL 'tse' parameter)
502  ePSGS_OrigTSE, // Default value
503 
505  };
506 
508  {
509  switch (option) {
510  case ePSGS_NoneTSE: return "NoneTSE";
511  case ePSGS_SlimTSE: return "SlimTSE";
512  case ePSGS_SmartTSE: return "SmartTSE";
513  case ePSGS_WholeTSE: return "WholeTSE";
514  case ePSGS_OrigTSE: return "OrigTSE";
515  case ePSGS_UnknownTSE: return "UnknownTSE";
516  default: break;
517  }
518  return "UnknownOptionValue";
519  }
520 
521 
524  string m_ClientId;
525  unsigned long m_SendBlobIfSmall; // 0 - means do not send
526  // only for slim and smart
527 
528  // Both cases: by seq_id/seq_id_type and by sat/sat_key store the
529  // required blob id here.
530  // When the seq_id/seq_id_type is resolved to sat/sat_key the m_BlobId
531  // is populated
533 
534  int m_Hops;
535 
537  EPSGS_CacheAndDbUse use_cache,
538  const string & client_id,
539  int send_blob_if_small,
540  int hops,
542  bool processor_events,
543  const vector<string> & enabled_processors,
544  const vector<string> & disabled_processors,
545  const psg_time_point_t & start_timestamp) :
546  SPSGS_RequestBase(trace, processor_events,
547  enabled_processors, disabled_processors,
548  start_timestamp),
549  m_TSEOption(tse_option),
550  m_UseCache(use_cache),
551  m_ClientId(client_id),
552  m_SendBlobIfSmall(send_blob_if_small),
553  m_Hops(hops)
554  {}
555 
560  m_Hops(0)
561  {}
562 
563  void AppendCommonParameters(CJsonNode & json) const;
564 
569 };
570 
571 
572 // Blob by seq_id request (eBlobBySeqIdRequest)
574 {
575  string m_SeqId;
577  vector<string> m_ExcludeBlobs;
579  unsigned long m_ResendTimeoutMks;
581 
582  SPSGS_BlobBySeqIdRequest(const string & seq_id,
583  int seq_id_type,
584  vector<string> & exclude_blobs,
585  EPSGS_TSEOption tse_option,
586  EPSGS_CacheAndDbUse use_cache,
587  EPSGS_AccSubstitutioOption subst_option,
588  double resend_timeout,
589  const string & client_id,
590  int send_blob_if_small,
591  bool seq_id_resolve,
592  int hops,
594  bool processor_events,
595  const vector<string> & enabled_processors,
596  const vector<string> & disabled_processors,
597  const psg_time_point_t & start_timestamp) :
598  SPSGS_BlobRequestBase(tse_option, use_cache, client_id, send_blob_if_small,
599  hops, trace, processor_events,
600  enabled_processors, disabled_processors,
601  start_timestamp),
602  m_SeqId(seq_id),
603  m_SeqIdType(seq_id_type),
604  m_ExcludeBlobs(move(exclude_blobs)),
605  m_AccSubstOption(subst_option),
606  m_ResendTimeoutMks((unsigned long)(resend_timeout * 1000000)),
607  m_SeqIdResolve(seq_id_resolve)
608  {}
609 
611  m_SeqIdType(-1),
614  m_SeqIdResolve(true) // default
615  {}
616 
618  {
620  }
621 
622  virtual string GetName(void) const
623  {
624  return "ID/get";
625  }
626 
627  virtual CJsonNode Serialize(void) const;
628 
633 };
634 
635 
636 // Blob by sat/sat_key request (eBlobBySatSatKeyRequest)
638 {
640 
642  CBlobRecord::TTimestamp last_modified,
643  EPSGS_TSEOption tse_option,
644  EPSGS_CacheAndDbUse use_cache,
645  const string & client_id,
646  int send_blob_if_small,
647  int hops,
649  bool processor_events,
650  const vector<string> & enabled_processors,
651  const vector<string> & disabled_processors,
652  const psg_time_point_t & start_timestamp) :
653  SPSGS_BlobRequestBase(tse_option, use_cache, client_id, send_blob_if_small,
654  hops, trace, processor_events,
655  enabled_processors, disabled_processors,
656  start_timestamp),
657  m_LastModified(last_modified)
658  {
659  m_BlobId = blob_id;
660  }
661 
664  {}
665 
667  {
669  }
670 
671  virtual string GetName(void) const
672  {
673  return "ID/getblob";
674  }
675 
676  virtual CJsonNode Serialize(void) const;
677 
682 };
683 
684 
686 {
687  string m_SeqId;
689  vector<string> m_Names;
690  unsigned long m_ResendTimeoutMks;
691  vector<string> m_SeqIds;
693  optional<CSeq_id::ESNPScaleLimit> m_SNPScaleLimit;
694 
695  SPSGS_AnnotRequest(const string & seq_id,
696  int seq_id_type,
697  vector<string> & names,
698  EPSGS_CacheAndDbUse use_cache,
699  double resend_timeout,
700  vector<string> & seq_ids,
701  const string & client_id,
703  int send_blob_if_small,
704  bool seq_id_resolve,
705  optional<CSeq_id::ESNPScaleLimit> & snp_scale_limit,
706  int hops,
708  bool processor_events,
709  const vector<string> & enabled_processors,
710  const vector<string> & disabled_processors,
711  const psg_time_point_t & start_timestamp) :
712  SPSGS_BlobRequestBase(tse_option, use_cache, client_id, send_blob_if_small,
713  hops, trace, processor_events,
714  enabled_processors, disabled_processors,
715  start_timestamp),
716  m_SeqId(seq_id),
717  m_SeqIdType(seq_id_type),
718  m_Names(move(names)),
719  m_ResendTimeoutMks((unsigned long)(resend_timeout * 1000000)),
720  m_SeqIds(move(seq_ids)),
721  m_SeqIdResolve(seq_id_resolve),
722  m_SNPScaleLimit(snp_scale_limit),
723  m_Lock(false),
725  {}
726 
728  m_SeqIdType(-1),
730  m_SeqIdResolve(true), // default
731  m_Lock(false),
733  {}
734 
739 
741  {
743  }
744 
745  virtual string GetName(void) const
746  {
747  return "ID/get_na";
748  }
749 
750  virtual CJsonNode Serialize(void) const;
751 
752  // Facilities to work with the list of already processed names
753 
754  // If the given name is already in the list then the priority
755  // of the processor which has registered it before is returned
756  // If the given name is not in the list then kUnknownPriority constant is
757  // returned.
759  const string & name);
760 
761 
762  // If bioseq info has already been sent then the priority of the processor
763  // which sent it will be returned. Otherwise kUnknownPriority constant is
764  // returned.
765  // The highest priority of all the calls will be stored.
767 
768  // Names which have not been processed by a processor which priority
769  // is higher than given
770  vector<string> GetNotProcessedName(TProcessorPriority priority);
771 
772  vector<pair<TProcessorPriority, string>> GetProcessedNames(void) const;
773 
774  // Used to track a status of each individual annotation
776  // ePSGS_RS_Success = 200, implicitly memorized when a
777  // processor checks priority before
778  // sending
779  ePSGS_RS_NotFound = 404, // Used by a processor
780  ePSGS_RS_Error = 500, // Used by a processor
781  ePSGS_RS_Unavailable = 503, // This is for the case when a
782  // processor was not instantiated.
783  // Used by the framework
784  ePSGS_RS_Timeout = 504 // Used by a processor
785  };
786 
787  void ReportResultStatus(const string & annot_name, EPSGS_ResultStatus rs);
788 
789  // In case of exactly one annotation requested it is possible that blob
790  // props and blob chunks are need to be sent to the client. Thus it is
791  // possible that there is an error during the blob prop or blob chunks
792  // stage. This method should be called by the corresponding processor if
793  // such an error encountered.
794  // The rs is expected to be here a timeout or an error
795  void ReportBlobError(TProcessorPriority priority,
796  EPSGS_ResultStatus rs);
797 
799  {
800  return m_NotFound;
801  }
802 
804  {
805  return m_ErrorAnnotations;
806  }
807 
808  bool WasSent(const string & annot_name) const;
809 
810 private:
811  // A list of names which have been already processed by some processors
812  mutable atomic<bool> m_Lock;
814  vector<pair<TProcessorPriority, string>> m_Processed;
815 
816  // Processor reported not found annotations
818 
819  // This map includes limited, error and timeout annotations and stores only
820  // the highest reported code. This is because the highest error will be
821  // reported to the client.
823 };
824 
825 
827 {
829  string m_Id2Info;
831  int m_Hops;
832 
834  const string & id2_info,
835  EPSGS_CacheAndDbUse use_cache,
836  int hops,
838  bool processor_events,
839  const vector<string> & enabled_processors,
840  const vector<string> & disabled_processors,
841  const psg_time_point_t & start_timestamp) :
842  SPSGS_RequestBase(trace, processor_events,
843  enabled_processors, disabled_processors,
844  start_timestamp),
845  m_Id2Chunk(id2_chunk),
846  m_Id2Info(id2_info),
847  m_UseCache(use_cache),
848  m_Hops(hops)
849  {}
850 
854  m_Hops(0)
855  {}
856 
858  {
860  }
861 
862  virtual string GetName(void) const
863  {
864  return "ID/get_tse_chunk";
865  }
866 
867  virtual CJsonNode Serialize(void) const;
868 
873 };
874 
875 
877 {
878  string m_SeqId;
881  int m_Hops;
882 
884  const string & seq_id,
885  int seq_id_type,
886  EPSGS_CacheAndDbUse use_cache,
887  int hops,
889  bool processor_events,
890  const vector<string> & enabled_processors,
891  const vector<string> & disabled_processors,
892  const psg_time_point_t & start_timestamp) :
893  SPSGS_RequestBase(trace, processor_events,
894  enabled_processors, disabled_processors,
895  start_timestamp),
896  m_SeqId(seq_id), m_SeqIdType(seq_id_type),
897  m_UseCache(use_cache),
898  m_Hops(hops)
899  {}
900 
902  m_SeqIdType(-1),
904  m_Hops(0)
905  {}
906 
908  {
910  }
911 
912  virtual string GetName(void) const
913  {
914  return "ID/accession_version_history";
915  }
916 
917  virtual CJsonNode Serialize(void) const;
918 
923 };
924 
925 
927 {
928  optional<string> m_Protein;
930  optional<string> m_Nucleotide;
933 
934  SPSGS_IPGResolveRequest(const optional<string> & protein,
935  int64_t ipg,
936  const optional<string> & nucleotide,
937  EPSGS_CacheAndDbUse use_cache,
938  bool seq_id_resolve,
940  bool processor_events,
941  const vector<string> & enabled_processors,
942  const vector<string> & disabled_processors,
943  const psg_time_point_t & start_timestamp) :
944  SPSGS_RequestBase(trace, processor_events,
945  enabled_processors, disabled_processors,
946  start_timestamp),
947  m_Protein(protein), m_IPG(ipg), m_Nucleotide(nucleotide),
948  m_UseCache(use_cache), m_SeqIdResolve(seq_id_resolve)
949  {}
950 
952  m_IPG(-1),
954  m_SeqIdResolve(true) // default
955  {}
956 
958  {
960  }
961 
962  virtual string GetName(void) const
963  {
964  return "IPG/resolve";
965  }
966 
967  virtual CJsonNode Serialize(void) const;
968 
973 };
974 
975 #endif // PSGS_REQUEST__HPP
976 
#define true
Definition: bool.h:35
#define false
Definition: bool.h:36
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(const CPSGS_Request &)=default
CPSGS_Request & operator=(const CPSGS_Request &)=default
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)
CPSGS_Request & operator=(CPSGS_Request &&)=default
void Unlock(const string &event_name)
bool NeedProcessorEvents(void)
CPSGS_Request(CPSGS_Request &&)=default
vector< pair< string, size_t > > m_LimitedProcessors
uint64_t m_BacklogTimeMks
@ ePSGS_BlobBySatSatKeyRequest
@ ePSGS_AccessionVersionHistoryRequest
psg_time_point_t GetStartTimestamp(void) const
virtual string GetName(void) const
void SetBacklogTime(uint64_t val)
TRequest & GetRequest(void)
#define option
static const struct name_t names[]
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.
signed __int64 int64_t
Definition: stdint.h:135
signed int int32_t
Definition: stdint.h:123
#define INT64_MIN
Definition: stdint.h:184
unsigned __int64 uint64_t
Definition: stdint.h:136
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
TProcessorPriority RegisterProcessedName(TProcessorPriority priority, const string &name)
SPSGS_AnnotRequest & operator=(const SPSGS_AnnotRequest &)=default
bool WasSent(const string &annot_name) const
optional< CSeq_id::ESNPScaleLimit > m_SNPScaleLimit
map< string, int > GetErrorNames(void) const
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, EPSGS_Trace trace, bool processor_events, const vector< string > &enabled_processors, const vector< string > &disabled_processors, const psg_time_point_t &start_timestamp)
vector< string > m_Names
set< string > GetNotFoundNames(void) const
SPSGS_AnnotRequest(SPSGS_AnnotRequest &&)=default
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
SPSGS_AnnotRequest(const SPSGS_AnnotRequest &)=default
SPSGS_AnnotRequest & operator=(SPSGS_AnnotRequest &&)=default
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
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_BlobBySatSatKeyRequest &)=default
virtual CPSGS_Request::EPSGS_Type GetRequestType(void) const
SPSGS_BlobBySatSatKeyRequest & operator=(const 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, 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(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
EPSGS_AccSubstitutioOption m_AccSubstOption
SPSGS_BlobBySeqIdRequest(const SPSGS_BlobBySeqIdRequest &)=default
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, EPSGS_Trace trace, bool processor_events, const vector< string > &enabled_processors, const vector< string > &disabled_processors, const psg_time_point_t &start_timestamp)
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(EPSGS_TSEOption tse_option, EPSGS_CacheAndDbUse use_cache, const string &client_id, int send_blob_if_small, 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_BlobRequestBase & operator=(SPSGS_BlobRequestBase &&)=default
EPSGS_TSEOption m_TSEOption
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
virtual CJsonNode Serialize(void) const
EPSGS_CacheAndDbUse m_UseCache
SPSGS_TSEChunkRequest & operator=(SPSGS_TSEChunkRequest &&)=default
SPSGS_TSEChunkRequest(SPSGS_TSEChunkRequest &&)=default
SPSGS_TSEChunkRequest(const SPSGS_TSEChunkRequest &)=default
SPSGS_TSEChunkRequest(int64_t id2_chunk, const string &id2_info, 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)
virtual string GetName(void) const
virtual CPSGS_Request::EPSGS_Type GetRequestType(void) const
SPSGS_TSEChunkRequest & operator=(const SPSGS_TSEChunkRequest &)=default
Modified on Fri Jan 05 07:22:15 2024 by modify_doxy.py rev. 669887