1 #ifndef PSGS_REQUEST__HPP
2 #define PSGS_REQUEST__HPP
44 #include <condition_variable>
73 void SetId(
const string & blob_id)
135 return "UnknownRequestTypeValue (" + to_string(req_type) +
")";
142 unique_ptr<SPSGS_RequestBase> req,
173 void Lock(
const string & event_name);
176 void Unlock(
const string & event_name);
178 void WaitFor(
const string & event_name,
size_t timeout_sec = 10);
183 TRequest* req =
dynamic_cast<TRequest *
>(
m_Request.get());
189 "User request type mismatch. Stored type: " +
200 virtual string GetName(
void)
const;
284 return "UnknownCacheAndDbUseOptionValue";
306 return "UnknownAccSubstitutioOptionValue";
321 return "UnknownTraceOptionValue";
337 bool processor_events,
338 const vector<string> & enabled_processors,
339 const vector<string> & disabled_processors,
399 return "UnknownFormatOptionValue";
450 bool processor_events,
451 const vector<string> & enabled_processors,
452 const vector<string> & disabled_processors,
455 enabled_processors, disabled_processors,
519 return "UnknownOptionValue";
540 const string & client_id,
541 int send_blob_if_small,
543 const optional<bool> & include_hup,
545 bool processor_events,
546 const vector<string> & enabled_processors,
547 const vector<string> & disabled_processors,
550 enabled_processors, disabled_processors,
587 vector<string> & exclude_blobs,
591 double resend_timeout,
592 const string & client_id,
593 int send_blob_if_small,
596 const optional<bool> & include_hup,
598 bool processor_events,
599 const vector<string> & enabled_processors,
600 const vector<string> & disabled_processors,
603 hops, include_hup,
trace, processor_events,
604 enabled_processors, disabled_processors,
649 const string & client_id,
650 int send_blob_if_small,
652 const optional<bool> & include_hup,
654 bool processor_events,
655 const vector<string> & enabled_processors,
656 const vector<string> & disabled_processors,
659 hops, include_hup,
trace, processor_events,
660 enabled_processors, disabled_processors,
702 vector<string> &
names,
704 double resend_timeout,
705 vector<string> & seq_ids,
706 const string & client_id,
708 int send_blob_if_small,
710 optional<CSeq_id::ESNPScaleLimit> & snp_scale_limit,
712 const optional<bool> & include_hup,
714 bool processor_events,
715 const vector<string> & enabled_processors,
716 const vector<string> & disabled_processors,
719 hops, include_hup,
trace, processor_events,
720 enabled_processors, disabled_processors,
765 const string & name);
814 bool WasSent(
const string & annot_name)
const;
841 const string & id2_info,
844 const optional<bool> & include_hup,
846 bool processor_events,
847 const vector<string> & enabled_processors,
848 const vector<string> & disabled_processors,
851 enabled_processors, disabled_processors,
873 return "ID/get_tse_chunk";
893 const string & seq_id,
898 bool processor_events,
899 const vector<string> & enabled_processors,
900 const vector<string> & disabled_processors,
903 enabled_processors, disabled_processors,
923 return "ID/accession_version_history";
945 const optional<string> & nucleotide,
949 bool processor_events,
950 const vector<string> & enabled_processors,
951 const vector<string> & disabled_processors,
954 enabled_processors, disabled_processors,
973 return "IPG/resolve";
optional< string > GetWebCubbyUser(void)
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
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)
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
CPSGS_Request(CPSGS_Request &&)=delete
uint64_t m_BacklogTimeMks
@ ePSGS_AnnotationRequest
@ ePSGS_BlobBySatSatKeyRequest
@ ePSGS_IPGResolveRequest
@ ePSGS_AccessionVersionHistoryRequest
@ ePSGS_BlobBySeqIdRequest
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 NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
chrono::steady_clock psg_clock_t
const int kUnknownPriority
psg_clock_t::time_point psg_time_point_t
Defines CRequestContext class for NCBI C++ diagnostic API.
EPSGS_WaitObjectState m_State
condition_variable m_WaitObject
@ ePSGS_LockedSomebodyWaits
@ ePSGS_LockedNobodyWaits
SPSGS_AccessionVersionHistoryRequest(const SPSGS_AccessionVersionHistoryRequest &)=default
virtual string GetName(void) const
SPSGS_AccessionVersionHistoryRequest & operator=(SPSGS_AccessionVersionHistoryRequest &&)=default
SPSGS_AccessionVersionHistoryRequest()
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
EPSGS_CacheAndDbUse m_UseCache
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
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
virtual string GetName(void) const
void ReportBlobError(TProcessorPriority priority, EPSGS_ResultStatus rs)
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
SPSGS_BlobBySatSatKeyRequest()
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()
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
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
SPSGS_IPGResolveRequest()
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
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
EPSGS_AccSubstitutioOption
@ ePSGS_LimitedAccSubstitution
@ ePSGS_UnknownAccSubstitution
@ ePSGS_DefaultAccSubstitution
@ ePSGS_NeverAccSubstitute
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
int TPSGS_BioseqIncludeData
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