&
value, &value_size);
52 static string kYes=
"yes";
53 static string kNo=
"no";
55 "' and '"+
kNo+
"'.";
59 string& err_msg)
const 61 if(param_value !=
kYes&& param_value !=
kNo) {
62err_msg =
"Malformed '"+ param_name +
"' parameter. "+
kBoolAcceptable;
72 string& err_msg)
const 77err_msg =
"Error converting '"+ param_name +
"' parameter " 78 "to integer (received value: '"+
89 string& err_msg)
const 94err_msg =
"Error converting '"+ param_name +
"' parameter " 95 "to integer (received value: '"+
106 string& err_msg)
const 111err_msg =
"Error converting '"+ param_name +
"' parameter " 112 "to double (received value: '"+
121shared_ptr<CPSGS_Reply> reply,
123 const string& err_msg)
135shared_ptr<CPSGS_Reply> reply,
137 const string& err_msg)
152 const string& err_msg)
165shared_ptr<CPSGS_Reply> reply,
172 if(trace_protocol_param.
m_Found) {
176trace_protocol_param.
m_Value, err_msg)) {
193shared_ptr<CPSGS_Reply> reply,
195 bool& processor_events)
197processor_events =
false;
200 if(processor_events_param.
m_Found) {
204processor_events_param.
m_Value, err_msg)) {
208processor_events = processor_events_param.
m_Value==
kYes;
218shared_ptr<CPSGS_Reply> reply,
220optional<bool> & include_hup)
224 if(include_hup_param.
m_Found) {
228include_hup_param.
m_Value, err_msg)) {
244shared_ptr<CPSGS_Reply> reply,
246 double& resend_timeout)
251 if(resend_timeout_param.
m_Found) {
254resend_timeout_param.
m_Value,
255resend_timeout, err_msg)) {
260 if(resend_timeout < 0.0) {
262to_string(resend_timeout) +
". It must be >= 0.0";
275shared_ptr<CPSGS_Reply> reply,
277 bool& seq_id_resolve)
279seq_id_resolve =
true;
282 if(seq_id_resolve_param.
m_Found) {
285seq_id_resolve_param.
m_Value, err_msg)) {
289seq_id_resolve = seq_id_resolve_param.
m_Value==
kYes;
299shared_ptr<CPSGS_Reply> reply,
315err_msg =
"Invalid '"+
kHopsParam+
"' parameter value "+
316to_string(hops) +
". It must be > 0.";
322err_msg =
"The '"+
kHopsParam+
"' parameter value "+ to_string(hops) +
323 " exceeds the server configured value "+
342shared_ptr<CPSGS_Reply> reply,
349 if(last_modified_param.
m_Found) {
352last_modified, err_msg)) {
363 "' parameter is not found.";
365 "' parameter value has not been supplied";
369shared_ptr<CPSGS_Reply> reply,
374 if(!blob_id_param.
m_Found) {
380 if(blob_id.
GetId().empty()) {
388 staticvector<pair<string, SPSGS_ResolveRequest::EPSGS_BioseqIncludeData>>
409shared_ptr<CPSGS_Reply> reply,
413include_data_flags = 0;
417request_param =
x_GetParam(req, flag_param.first);
421request_param.
m_Value, err_msg)) {
425 if(request_param.
m_Value==
"yes") {
426include_data_flags |= flag_param.second;
428include_data_flags &= ~flag_param.second;
442shared_ptr<CPSGS_Reply> reply,
453id2_info = id2_info_param.
m_Value;
460 "' parameter is not found.";
462 "' parameter value. It must be >= 0";
466shared_ptr<CPSGS_Reply> reply,
472 if(!id2_chunk_param.
m_Found) {
479id2_chunk_param.
m_Value, id2_chunk, err_msg)) {
500 if(exclude_blobs_param.
m_Found) {
501vector<string> blob_ids;
504 size_tempty_count = 0;
505 for(
const auto& item : blob_ids) {
513 PSG_WARNING(
"Found "<< empty_count <<
" empty blob id(s) in the '"<<
527shared_ptr<CPSGS_Reply> reply,
529vector<string> & enabled_processors,
530vector<string> & disabled_processors)
537disabled_processors);
539enabled_processors.erase(
540 remove_if(enabled_processors.begin(), enabled_processors.end(),
541[](
string const& s) { return s.empty(); }),
542enabled_processors.end());
543disabled_processors.erase(
544 remove_if(disabled_processors.begin(), disabled_processors.end(),
545[](
string const& s) { return s.empty(); }),
546disabled_processors.end());
548 for(
const auto& en_processor : enabled_processors) {
549 for(
const auto& dis_processor : disabled_processors) {
552 "The same processor name is found " 579shared_ptr<CPSGS_Reply> reply,
628shared_ptr<CPSGS_Reply> reply,
658 "' and '"+
kJson+
"'";
697shared_ptr<CPSGS_Reply> reply,
727shared_ptr<CPSGS_Reply> reply,
734 if(use_cache_param.
m_Found) {
737use_cache_param.
m_Value, err_msg)) {
742 if(use_cache_param.
m_Value==
"yes") {
754 "' parameter value. It must be an integer >= 0";
758shared_ptr<CPSGS_Reply> reply,
760 int& send_blob_if_small)
762send_blob_if_small = 0;
765 if(send_blob_if_small_param.
m_Found) {
768send_blob_if_small_param.
m_Value,
769send_blob_if_small, err_msg)) {
774 if(send_blob_if_small < 0) {
785 "' parameter is not found";
790shared_ptr<CPSGS_Reply> reply,
792vector<string> &
names)
802vector<string> raw_names;
806 for(
const auto& raw_item : raw_names) {
807 if(!raw_item.empty()) {
810 " is found in the list of names more than once " 811 "(case sensitive). The duplicates are ignored.");
813 names.push_back(raw_item);
818 if(
names.empty()) {
829shared_ptr<CPSGS_Reply> reply,
833vector<string> & enabled_processors,
834vector<string> & disabled_processors,
835 bool& processor_events)
843 if(!
x_GetHops(req, reply, now, hops)) {
847enabled_processors.clear();
848disabled_processors.clear();
850disabled_processors)) {
854processor_events =
false;
869 "' value must be >= 0 and < "+
874shared_ptr<CPSGS_Reply> reply,
879 boolseq_id_is_optional)
886 if(!seq_id_is_optional) {
892 if(!seq_id_is_optional) {
900seq_id = seq_id_param.
m_Value;
910 if(seq_id_type_param.
m_Found) {
913seq_id_type, err_msg)) {
934shared_ptr<CPSGS_Reply> reply,
936optional<string> & protein)
943protein = protein_param.
m_Value;
954shared_ptr<CPSGS_Reply> reply,
983shared_ptr<CPSGS_Reply> reply,
985optional<string> & nucleotide)
988 if(nucleotide_param.
m_Found) {
992nucleotide = nucleotide_param.
m_Value;
1013shared_ptr<CPSGS_Reply> reply,
1015optional<CSeq_id::ESNPScaleLimit> & snp_scale_limit)
1018 if(snp_scale_limit_param.
m_Found) {
1059shared_ptr<CPSGS_Reply> reply,
1061vector<pair<int, int>> & time_series)
1064 if(time_series_param.
m_Found) {
1065time_series.clear();
1069 "' parameter is empty. Expected at leas one " 1070 "space separated pair of integers " 1071 "<aggregation mins>:<last minute> or 'no'");
1075 if(time_series_param.
m_Value==
"no") {
1084vector<string> parts;
1086 for(
auto& item : parts) {
1089 "' parameter is malformed. Another item is found " 1090 "after the one which describes the rest " 1091 "of the time series.");
1096vector<string> vals;
1098 if(vals.size() != 2) {
1100 "' parameter is malformed. One or more items " 1101 "do not have a second value.");
1110 "' parameter is malformed. Cannot convert one or more " 1111 "aggregation mins into an integer");
1114 if(aggregation <= 0) {
1116 "' paremeter is malformed. One or more " 1117 "aggregation mins is <= 0 while it must be > 0.");
1122 if(vals[1].
empty()) {
1130 "' parameter is malformed. Cannot convert one or more " 1131 "last minute into an integer");
1135 if(last_minute <= previous) {
1137 "' parameter is malformed. One or more last minute " 1138 "<= than the previous one");
1144 if(previous != -1) {
1145start = previous + 1;
1147 if((last_minute - start + 1) % aggregation != 0) {
1149 "' parameter is malformed. The range "+
1150to_string(start) +
"-"+
1151to_string(last_minute) +
1152 " is not divisable by aggregation of "+
1153to_string(aggregation));
1157previous = last_minute;
1160time_series.push_back(make_pair(aggregation, last_minute));
1165 "' parameter is malformed. The item which descibes the " 1166 "rest of the series is not found.");
1183shared_ptr<CPSGS_Reply> reply,
1200shared_ptr<CPSGS_Reply> reply,
1202vector<string> & exclude_checks)
1208exclude_checks.erase(
1209 remove_if(exclude_checks.begin(), exclude_checks.end(),
1210[](
string const& s) { return s.empty(); }),
1211exclude_checks.end());
1221 "' parameter is not found.";
1223 "' parameter cannot be empty.";
1225 "' parameter cannot contain whitespace characters.";
1228shared_ptr<CPSGS_Reply> reply,
1236 if(peer_id_param.
m_Found) {
1237peer_id = peer_id_param.
m_Value;
1238 if(!peer_id.empty()) {
1240 if(char_pos == string::npos) {
1255reply->SetContentLength(err_msg.size());
1256reply->Send400(err_msg.c_str());
1264 "' parameter is not found.";
1266 "' parameter cannot be empty.";
1268 "' parameter cannot contain " 1269 "whitespace characters.";
1271shared_ptr<CPSGS_Reply> reply,
1273 string& peer_user_agent)
1275peer_user_agent =
"";
1279 if(peer_user_agent_param.
m_Found) {
1280peer_user_agent = peer_user_agent_param.
m_Value;
1281 if(!peer_user_agent.empty()) {
1283 if(char_pos == string::npos) {
1298reply->SetContentLength(err_msg.size());
1299reply->Send400(err_msg.c_str());
void remove_if(Container &c, Predicate *__pred)
bool GetParam(const char *name, size_t len, const char **value, size_t *value_len)
bool GetMultipleValuesParam(const char *name, size_t len, vector< string > &values)
@ ePSGS_MaxHopsExceededError
@ ePSGS_NonProtocolRequests
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)
bool x_GetIPG(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, int64_t &ipg)
bool x_GetPeerUserAgentParameter(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, string &peer_user_agent)
bool x_GetExcludeChecks(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, vector< string > &exclude_checks)
bool x_GetId2Info(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, string &id2_info)
bool x_IsBoolParamValid(const string ¶m_name, const CTempString ¶m_value, string &err_msg) const
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 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_GetIncludeHUPParameter(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, optional< bool > &include_hup)
bool x_GetNames(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, vector< string > &names)
void x_InsufficientArguments(shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, const string &err_msg)
bool x_GetTSEOption(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, SPSGS_BlobRequestBase::EPSGS_TSEOption &tse_option)
SPubseqGatewaySettings m_Settings
bool x_GetSeqIdResolveParameter(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, bool &auto_blob_skipping)
bool x_GetProcessorEventsParameter(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, bool &processor_events)
bool x_GetNucleotide(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, optional< string > &nucleotide)
bool x_GetSNPScaleLimit(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, optional< CSeq_id::ESNPScaleLimit > &snp_scale_limit)
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)
bool x_GetEnabledAndDisabledProcessors(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, vector< string > &enabled_processors, vector< string > &disabled_processors)
void x_SendMessageAndCompletionChunks(shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, const string &message, CRequestStatus::ECode status, int code, EDiagSev severity)
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
bool x_GetPeerIdParameter(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, string &peer_id)
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)
bool x_GetOutputFormat(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, SPSGS_ResolveRequest::EPSGS_OutputFormat &output_format)
bool x_ConvertIntParameter(const string ¶m_name, const CTempString ¶m_value, int &converted, string &err_msg) const
SRequestParameter x_GetParam(CHttpRequest &req, const string &name) 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)
bool x_GetId2Chunk(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, int64_t &id2_chunk)
bool x_GetVerboseParameter(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, bool &verbose)
bool x_GetTraceParameter(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, SPSGS_RequestBase::EPSGS_Trace &trace)
bool x_GetBlobId(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, SPSGS_BlobId &blob_id)
bool x_ConvertDoubleParameter(const string ¶m_name, const CTempString ¶m_value, double &converted, string &err_msg) const
bool x_GetUseCacheParameter(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, SPSGS_RequestBase::EPSGS_CacheAndDbUse &use_cache)
bool x_GetProtein(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, optional< string > &protein)
bool x_GetSendBlobIfSmallParameter(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, int &send_blob_if_small)
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
static const struct name_t names[]
static DLIST_TYPE *DLIST_NAME() last(DLIST_LIST_TYPE *list)
@ eDiag_Error
Error message.
@ e500_InternalServerError
@ eSNPScaleLimit_Supercontig
@ eSNPScaleLimit_Chromosome
static int CompareNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive compare of a substring with another string.
static int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to int.
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static double StringToDouble(const CTempStringEx str, TStringToNumFlags flags=0)
Convert string to double.
CTempString & assign(const char *src_str, size_type len)
Assign new values to the content of the a string.
bool empty(void) const
Return true if the represented string is empty (i.e., the length is zero)
static long StringToLong(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to long.
size_type find_first_of(const CTempString match, size_type pos=0) const
Find the first occurrence of any character in the matching string within the current string,...
@ fSplit_Tokenize
All delimiters are merged and trimmed, to get non-empty tokens only.
@ e_MaxChoice
== e_Named_annot_track+1
constexpr bool empty(list< Ts... >) noexcept
const GenericPointer< typename T::ValueType > T2 value
#define PSG_ERROR(message)
#define PSG_WARNING(message)
EPSGS_PubseqGatewayErrorCode
@ ePSGS_MalformedParameter
@ ePSGS_InsufficientArguments
psg_clock_t::time_point psg_time_point_t
string SanitizeInputValue(const string &input_val)
void SetId(const string &blob_id)
EPSGS_AccSubstitutioOption
@ ePSGS_LimitedAccSubstitution
@ ePSGS_DefaultAccSubstitution
@ ePSGS_NeverAccSubstitute
int TPSGS_BioseqIncludeData
double m_ResendTimeoutSec
static string kMalformedAccSubstMsg
static string kAcceptableFmt
static string kMalformedFmtMsg
static string kId2ChunkNotFoundMsg
static string kSeqIdParam
static string kPeerIdNotFoundMsg
static string kNamesParam
static string kEnableProcessor
static string kExcludeBlobsParam
static string kSeqIdResolveParam
static string kProteinParam
static string kSeqIdMissingValMsg
static string kSendBlobIfSmallInvalidMsg
static string kIPGBadValMsg
static vector< pair< string, SPSGS_ResolveRequest::EPSGS_BioseqIncludeData > > kResolveFlagParams
static string kChromosome
static string kId2ValInvalidMsg
static string kPeerIdSpaceCharsMsg
static string kPeerUserAgentSpaceCharsMsg
static string kSendBlobIfSmallParam
static string kLastModifiedParam
static string kBoolAcceptable
static string kBlobIdNotFoundMsg
static vector< pair< int, int > > kDefaultTimeSeries
static string kNeverOption
static string kTSEAcceptable
static string kNoNamesValueMsg
static string kAccSubstAcceptable
static string kLimitedOption
static string kSupercontig
static string kPeerUserAgentEmptyMsg
static string kNamesNotFoundMsg
static string kId2ChunkParam
static string kTraceParam
static string kDefaultOption
static string kAccSubstitutionParam
static string kIncludeHUPParam
static string kSeqIdMissingMsg
static string kResendTimeoutParam
static string kBlobIdValNotFoundMsg
static string kSeqIdTypeParam
static string kSNPScaleLimitParam
static string kWhitespaceChars
static string kUseCacheParam
static string kTSEMalformedMsg
static string kBlobIdParam
static string kPeerIdParam
static string kSeqIdTypeBadValMsg
static string kPeerUserAgentNotFoundMsg
static string kDisableProcessor
static string kTimeSeriesParam
static string kProcessorEventsParam
static string kNucleotideParam
static string kPeerUserAgentParam
static string kId2InfoNotFoundMsg
static string kId2InfoParam
static string kBadSNPScaleValMsg
static string kVerboseParam
static string kAcceptableIntroFmt
static string kSNPScaleacceptable
static string kPeerIdEmptyMsg
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4