:
return "Start";
111 case eSubmit:
return "Submit";
112 case eReply:
return "Reply";
113 case eDone:
return "Done";
114 case eSend:
return "Send";
116 case eClose:
return "Close";
117 case eRetry:
return "Retry";
118 case eFail:
return "Fail";
147unique_lock<mutex> lock(
m_Mutex);
150cout << ss.rdbuf() << endl;
152cout <<
m_Separator<<
'\n'<< ss.rdbuf() << flush;
163cout <<
"\n]"<< endl;
167 template<
classTItem,
class... TArgs>
169m_JsonObj(SetObject())
180 catch(exception& e) {
185 Set(
"message", e.what());
200 Set(error_obj,
"code",
code);
201 Set(error_obj,
"message", message);
205m_JsonObj(SetObject())
207 Set(
"jsonrpc",
"2.0");
211 if(
id.
empty()) {
214id_value.SetString(
id);
218 template<
classTItem,
class... TArgs>
221 if(
autorequest_id =
s_GetReply(item)->GetRequest()->
templateGetUserContext<string>()) {
222 Set(
"request_id", *request_id);
242 return "UnknownItem";
248rv.
Set(
"reply",
"NewItem");
261 autoreply_item_type = reply_item->GetType();
268 Set(
"processor_id", reply_item->GetProcessorId());
276 switch(reply_item_type) {
278 return Fill(static_pointer_cast<CPSG_BlobData>(reply_item));
281 return Fill(static_pointer_cast<CPSG_BlobInfo>(reply_item));
284 return Fill(static_pointer_cast<CPSG_SkippedBlob>(reply_item));
287 return Fill(static_pointer_cast<CPSG_BioseqInfo>(reply_item));
290 return Fill(static_pointer_cast<CPSG_NamedAnnotInfo>(reply_item));
293 return Fill(static_pointer_cast<CPSG_NamedAnnotStatus>(reply_item));
296 return Fill(static_pointer_cast<CPSG_PublicComment>(reply_item));
299 return Fill(static_pointer_cast<CPSG_Processor>(reply_item));
302 return Fill(static_pointer_cast<CPSG_IpgInfo>(reply_item));
305 return Fill(static_pointer_cast<CPSG_AccVerHistory>(reply_item));
312 throwlogic_error(
"Received unknown item: "+ to_string(reply_item_type));
319 Set(
"reply", blob_id->GetId());
321 for(
const auto& p : json_doc.GetObject()) {
329 Set(
"id", blob_data);
331os << blob_data->GetStream().rdbuf();
332 auto data= os.str();
337 Set(
"length",
static_cast<Uint8>(data_size));
339 hash.Calculate(
data.data(), data_size);
340 Set(
"hash",
hash.GetResultHex());
348 Set(
"id", blob_info);
349 Set(
"compression", blob_info->GetCompression());
350 Set(
"format", blob_info->GetFormat());
351 Set(
"storage_size", blob_info->GetStorageSize());
352 Set(
"size", blob_info->GetSize());
361 Set(
"hup_release_date", blob_info->GetHupReleaseDate().AsString());
362 Set(
"owner", blob_info->GetOwner());
363 Set(
"original_load_date", blob_info->GetOriginalLoadDate().AsString());
365 Set(
"division", blob_info->GetDivision());
366 Set(
"username", blob_info->GetUsername());
367 Set(
"id2_info", blob_info->GetId2Info());
368 Set(
"n_chunks", blob_info->GetNChunks());
386 Set(
"id", skipped_blob);
388 Set(
"sent_seconds_ago", skipped_blob->GetSentSecondsAgo());
389 Set(
"time_until_resend", skipped_blob->GetTimeUntilResend());
394 const autoincluded_info = bioseq_info->IncludedInfo();
411 Set(
"name", named_annot_info->GetName());
412 Set(
"blob_id", named_annot_info->GetBlobId());
413 Set(
"id2_annot_info", named_annot_info->GetId2AnnotInfo());
420 for(
const auto& status : named_annot_status->GetId2AnnotStatusList()) {
422 autoobj = ar.back().ResetObject();
423 Set(obj,
"name", status.first);
430 Set(
"id", public_comment);
431 Set(
"text", public_comment->GetText());
436 switch(progress_status) {
454 const autoprogress_status = processor->GetProgressStatus();
459 Set(
"processor_id", processor->GetProcessorId());
467 Set(
"protein", ipg_info->GetProtein());
468 Set(
"ipg", ipg_info->GetIpg());
469 Set(
"nucleotide", ipg_info->GetNucleotide());
470 Set(
"tax_id", ipg_info->GetTaxId());
471 Set(
"gb_state", ipg_info->GetGbState());
476 Set(
"canonical_id", acc_ver_history->GetCanonicalId());
478 Set(
"date", acc_ver_history->GetDate().AsString());
479 Set(
"blob_id", acc_ver_history->GetBlobId());
480 Set(
"chain",
GI_TO(
Int8, acc_ver_history->GetChain()));
485 automessages =
m_JsonObj[
"messages"];
486 autoar = messages.
IsNull() ? messages.ResetArray() : messages.SetArray();
488 autoobj = ar.back().ResetObject();
490 Set(obj,
"code", message.
code);
491 Set(obj,
"text", message);
510 for(
const auto& bio_id : bio_ids) {
512 Set(ar.back(), bio_id);
519 Set(obj,
"id", blob_id.
GetId());
535 if(!servers.empty()) {
536 sort(servers.begin(), servers.end(), [](
const auto&
l,
const auto&
r) { return l.second < r.second; });
537 returnservers.back().first.AsString();
546 for(
const auto& item :
m_Items) {
561 void Process(shared_ptr<CPSG_BlobInfo> blob_info);
562 void Process(shared_ptr<CPSG_BlobData> blob_data);
563 void Process(shared_ptr<CPSG_NamedAnnotInfo> named_annot_info);
564 void Process(shared_ptr<CPSG_BlobInfo> blob_info, shared_ptr<CPSG_BlobData> blob_data);
566 template<
classTItem>
570unordered_map<string, pair<shared_ptr<CPSG_BlobInfo>, shared_ptr<CPSG_BlobData>>>
m_Data;
574 template<
classTItem>
589 automessage = item->GetNextMessage();
591 if(message.empty())
break;
593ss << delim << message;
600 automessage = item->GetNextMessage();
602 if(message.empty())
break;
604ss <<
"\n\t"<< message;
620 Process(static_pointer_cast<CPSG_BlobInfo>(item));
623 Process(static_pointer_cast<CPSG_BlobData>(item));
626 Process(static_pointer_cast<CPSG_NamedAnnotInfo>(item));
648 if(
autochunk_id = blob_data->GetId<
CPSG_ChunkId>()) {
649 returnchunk_id->GetId2Chunk() == 999999999 ? CID2S_Split_Info::GetTypeInfo() : CID2S_Chunk::GetTypeInfo();
652 returnCSeq_entry::GetTypeInfo();
657 auto& p =
m_Data[blob_info->GetId()->Repr()];
660 Process(std::move(blob_info), std::move(p.second));
662p.first = std::move(blob_info);
668 auto& p =
m_Data[blob_data->GetId()->Repr()];
671 Process(std::move(p.first), std::move(blob_data));
673p.second = std::move(blob_data);
679 auto& is = blob_data->GetStream();
687unique_ptr<CObjectIStream>
in;
689 if(blob_info->GetCompression().find(
"zip") == string::npos) {
698 in->UseMemoryPool();
708cerr <<
"Failed to process blob '"<< blob_data->GetId()->Repr() <<
"': "<< ex.
ReportThis() << endl;
722 for(
const auto&
info: named_annot_info->GetId2AnnotInfoList() ) {
727 template<
class... TArgs>
741 template<
class... TArgs>
755 template<
class... TArgs>
758 const auto type= item->GetType();
761m_Items.try_emplace(
type, item);
763TBase::ItemComplete(json_out, status, item);
765 if(
auto[it,
result] = m_Items.try_emplace(
type,
nullptr); !
result&& it->second) {
771 template<
class... TArgs>
774 for(
const auto& p : m_Items) {
775 if(
auto& item = p.second) {
781TBase::ReplyComplete(json_out, status, reply);
785 template<
class... TArgs>
791 template<
class... TArgs>
801s_ReplyComplete<>(json_out, status, reply);
805 template<
class... TArgs>
820 "/objtools/pubseq_gateway/client/",
821R
"(\S+: (\S+:[0-9]+)/\S+?\S+&client_id=\S+)", 822 R"(\S+: Closed with status \S+)", 823 R"(\S+: \S+&item_type=reply&\S+&exec_time=([0-9]+)\\n)" 836 using namespaceplaceholders;
842}
else if(!params.
verbose) {
847 autoitem_complete = bind(&s_ItemComplete<SOneRequestParams>, ref(json_out), _1, _2);
857 returndata_only_copy;
866 voidItemComplete(
SJsonOut& json_out,
EPSG_Statusstatus,
constshared_ptr<CPSG_ReplyItem>& item);
867 voidReplyComplete(
SJsonOut& json_out,
EPSG_Statusstatus,
constshared_ptr<CPSG_Reply>& reply);
870 template<
classTParams>
881 while(m_InputQueue.Pop(
id)) {
883 autobio_id =
CPSG_BioId(
id, m_Params.type);
884 autouser_context = make_shared<SNonVerbose<SBatchResolveParams>>(std::move(
id));
885 autorequest = make_shared<CPSG_Request_Resolve>(std::move(bio_id), m_Params.bio_id_resolution, std::move(user_context));
887request->IncludeInfo(m_Params.include_info);
888request->SetAccSubstitution(m_Params.acc_substitution);
904 context->ItemComplete(json_out, status, item);
909reported.emplace(status);
910s_ItemComplete<verbose>(json_out, status, item);
918 context->ReplyComplete(json_out, status, reply);
923 if(
autofirst_message = reply->GetNextMessage(
SParams::min_severity); first_message || (reported.find(status) == reported.end())) {
925json_out << result_doc;
929 template<
classTParams>
934 return&s_ItemComplete<verbose>;
940 template<
classTParams>
945 return&s_ReplyComplete<verbose>;
951 template<
classTParams>
954 return&s_NewItem<TParams>;
960 stringline, protein,
n;
962 while(m_InputQueue.Pop(line)) {
966 autouser_context = make_shared<SNonVerbose<SBatchResolveParams>>(std::move(line));
967 autorequest = make_shared<CPSG_Request_IpgResolve>(std::move(protein), 0, std::move(nucleotide), std::move(user_context));
989 while(m_InputQueue.Pop(line)) {
996}
else if(!json_schema.
Validate(json_doc)) {
999 if(m_Params.echo) json_out << json_doc;
1004 autoparams_obj = json_obj[
"params"].
GetObject();
1005 autouser_context = make_shared<string>(
id);
1008 if(
autorequest =
SRequestBuilder::Build(method, params_obj, std::move(user_context), std::move(request_context))) {
1025 const autorequest = reply->GetRequest();
1026 const auto& request_id = *request->GetUserContext<
string>();
1043 const autorequest = reply->GetRequest();
1053 const autorequest = reply->GetRequest();
1063 const autorequest = item->GetReply()->GetRequest();
1064 const auto& request_id = *request->GetUserContext<
string>();
1079 if(m_Params.testing) {
1081 if(m_Params.server) {
1088 if(m_Params.server) {
1099 const autorequest = item->GetReply()->GetRequest();
1100 const auto& request_id = *request->GetUserContext<
string>();
1113 return&s_NewItem<SInteractiveParams, no_verbose>;
1117 template<
classTParams>
1119json_out(params.pipe, params.server),
1125 template<
classTParams>
1129 using namespaceplaceholders;
1134 for(
int n= params.worker_threads;
n> 0; --
n) {
1135 m_PsgQueues.emplace_back(params.service, item_complete, reply_complete, new_item);
1137queue.SetRequestFlags(params.request_flags);
1138queue.SetUserArgs(params.user_args);
1144shared_ptr<CPSG_Reply>
s_GetReply(shared_ptr<CPSG_ReplyItem>& item)
1146 returnitem->GetReply();
1149shared_ptr<CPSG_Reply>
s_GetReply(shared_ptr<CPSG_Reply>& reply)
1156 switch(psg_status) {
1175 if(req_obj.has(
"id")) {
1176 autoid_node = req_obj[
"id"];
1178 if(id_node.IsValue()) {
1179 autoid_value = id_node.
GetValue();
1181 if(id_value.IsString()) {
1191 template<
classTCreateContext>
1196vector<shared_ptr<CPSG_Request>> requests;
1197unordered_set<string> ids;
1204cerr <<
"Error in request '"<< line <<
"': "<< json_doc.
GetReadError() << endl;
1210 if(
id.
empty()) {
1211cerr <<
"Error in request '"<< line <<
"': no id or id is empty"<< endl;
1213}
else if(!json_schema.
Validate(json_doc)) {
1214cerr <<
"Error in request '"<<
id<<
"': "<< json_schema.
GetValidationError() << endl;
1216}
else if(!ids.insert(
id).second) {
1217cerr <<
"Error in request '"<<
id<<
"': duplicate ID"<< endl;
1222 autoparams_obj = json_obj[
"params"].
GetObject();
1223 autouser_context = create_context(
id, params_obj);
1225 if(!user_context)
return{};
1228requests.emplace_back(std::move(request));
1229 if(report_progress_after && (requests.size() % report_progress_after == 0)) cerr <<
'.';
1239 if(params.
delay< 0.0) {
1240cerr <<
"DELAY must be non-negative"<< endl;
1244 const size_tkReportProgressAfter = 2000;
1246 usingTReplyStorage = deque<shared_ptr<CPSG_Reply>>;
1249 autorequests = ReadCommands([](
string id,
CJson_ConstNode&){
returnmake_shared<SMetrics>(std::move(
id)); },
SParams::verbose? kReportProgressAfter : 0);
1251 if(requests.empty())
return-1;
1254atomic_int to_submit(
static_cast<int>(requests.size()));
1255 autowait = [&]() {
while(start > 0) this_thread::sleep_for(chrono::microseconds(1)); };
1257 auto l= [&](
CPSG_Queue& queue, TReplyStorage& replies) {
1262 auto i= to_submit--;
1264 if(
i<= 0)
break;
1267 auto& request = requests[requests.size() -
i];
1268 autometrics = request->GetUserContext<
SMetrics>();
1282 const auto type= reply_item->GetType();
1287metrics->AddItem({
type, status});
1301replies.emplace_back(reply);
1304 if(params.
delay) {
1305this_thread::sleep_for(chrono::duration<double>(params.
delay));
1310vector<CPSG_Queue> queues;
1314queues.emplace_back(params.
service);
1316queues.back().SetUserArgs(params.
user_args);
1319vector<thread> threads;
1324threads.emplace_back(
l, ref(queues[params.
local_queue?
i: 0]), ref(replies[
i]));
1331cerr <<
"\nSubmitting requests: ";
1332 size_tprevious = requests.size() / kReportProgressAfter;
1334 while(to_submit > 0) {
1335 size_tcurrent = to_submit / kReportProgressAfter;
1337 for(
auto i= current;
i< previous; ++
i) {
1342this_thread::sleep_for(chrono::milliseconds(100));
1345cerr <<
"\nWaiting for threads: "<< params.
user_threads<<
'\n';
1348 for(
auto&
t: threads) {
1360 for(
auto& thread_replies : replies) {
1361 for(
auto& reply : thread_replies) {
1374 if(single_doc ? !getline(is, line,
'\x00') : !getline(is, line)) {
1376}
else if(!line.empty()) {
1394 autocontext_obj =
context->value.GetObject();
1396 autosid = context_obj.find(
"sid");
1398 if(sid != context_obj.end()) {
1399 ctx.SetSessionID(sid->value.GetValue().GetString());
1402 autophid = context_obj.find(
"phid");
1404 if(phid != context_obj.end()) {
1405 ctx.SetHitID(phid->value.GetValue().GetString());
1408 autoauth_token = context_obj.find(
"auth_token");
1410 if(auth_token != context_obj.end()) {
1411 ctx.SetProperty(
"auth_token", auth_token->value.GetValue().GetString());
1414 autoclient_ip = context_obj.find(
"client_ip");
1416 if(client_ip != context_obj.end()) {
1417 ctx.SetClientIP(client_ip->value.GetValue().GetString());
1421 if(!
ctx.IsSetSessionID())
ctx.SetSessionID();
1422 if(!
ctx.IsSetHitID())
ctx.SetHitID();
1425extra.
Print(
"request", request);
1426extra.
Print(
"params", params_obj);
1435}
else if(json.
IsUint4()) {
1437}
else if(json.
IsInt8()) {
1439}
else if(json.
IsUint8()) {
1450 for(
size_t i= 0;
i< json.
size(); ++
i) {
1451 Print(prefix +
'['+ to_string(
i) +
']', json[
i]);
1457 for(
const auto& pair : json) {
1458 Print(prefix +
'.'+ pair.name, pair.value);
1466 Print(prefix,
"<null>");
1496schema_doc = RequestSchema();
1498}
else if(!schema_doc.
Read(*schema_is)) {
1499cerr <<
"Error on reading JSON schema: "<< schema_doc.
GetReadError() << endl;
1503cerr <<
"Error on validating JSON schema: "<< meta_schema.GetValidationError() << endl;
1511 autocout_prefix = [&](
const autop) ->
auto& { cout << p;
if(!single_doc) cout <<
" ("<< line_no <<
")";
returncout; };
1513 while(
ReadLine(line, cin, single_doc)) {
1518cout_prefix(
"Error on reading JSON document") <<
": "<< input_doc.
GetReadError() << endl;
1519 if(rv == 0) rv = -2;
1520}
else if(
schema.Validate(input_doc)) {
1521cout_prefix(
"JSON document") <<
" is valid"<< endl;
1523cout_prefix(
"Error on validating JSON document") <<
": "<<
schema.GetValidationError() << endl;
1524 if(rv == 0) rv = -3;
1528 if(single_doc)
returnrv;
1530cout << line_no <<
" JSON document(s) have been checked"<< endl;
1539 if(
auto value= objects::CSeq_id::WhichInverseSeqId(
type))
return value;
1546 auto id=
array[0].GetValue().GetString();
1559 if(
input.has(
"bio_ids")) {
1560 autobio_ids =
input[
"bio_ids"].GetArray();
1562 for(
const auto& bio_id : bio_ids) {
1563rv.push_back(GetBioId(bio_id.GetArray()));
1566rv.push_back(GetBioId(
input[
"bio_id"].GetArray()));
1575 auto id=
array[0].GetValue().GetString();
1576 return array.size() > 1 ?
CPSG_BlobId(std::move(
id),
array[1].GetValue().GetInt8()) : std::move(
id);
1581 auto array=
input[
"chunk_id"].GetArray();
1582 return{
static_cast<int>(
array[0].GetValue().GetInt4()),
array[1].GetValue().GetString() };
1587 autona_array =
input[
"named_annots"].GetArray();
1590 for(
const auto& na : na_array) {
1591 names.push_back(na.GetValue().GetString());
1600 const auto& info_flags = GetInfoFlags();
1602 auto i= info_flags.begin();
1603 boolall_info_except = specified(
i->name);
1606 for(++
i;
i!= info_flags.end(); ++
i) {
1607 if(specified(
i->name)) {
1608 if(all_info_except) {
1609include_info &= ~
i->value;
1611include_info |=
i->value;
1622 if(!
input.has(
"exclude_blobs"))
return;
1624 autoblob_ids =
input[
"exclude_blobs"].GetArray();
1626 for(
const auto& blob_id : blob_ids) {
1627exclude(blob_id.GetValue().GetString());
1633 if(!
input.has(
"request_flags"))
return;
1635 for(
const auto& request_flag :
input[
"request_flags"].GetArray()) {
1636 const auto value= request_flag.GetValue().GetString();
1638 if(
value==
"exclude-hup") {
1641}
else if(
value==
"include-hup") {
1720 "$ref": "#/definitions/bio_id" 1753 "$id": "#include_data", 1763 "$id": "#include_info", 1786 "$id": "#named_annots", 1793 "$id": "#exclude_blobs", 1799 "acc_substitution": { 1800 "$id": "#acc_substitution", 1807 "snp_scale_limit": { 1808 "$id": "#snp_scale_limit", 1836 "$id": "#request_flags", 1854 "$ref": "#/definitions/jsonrpc" 1865 "$ref": "#/definitions/bio_id" 1868 "$ref": "#/definitions/include_data" 1871 "$ref": "#/definitions/exclude_blobs" 1873 "acc_substitution": { 1874 "$ref": "#/definitions/acc_substitution" 1876 "bio_id_resolution": { 1883 "$ref": "#/definitions/context" 1886 "$ref": "#/definitions/request_flags" 1912 "$ref": "#/definitions/jsonrpc" 1923 "$ref": "#/definitions/blob_id" 1926 "$ref": "#/definitions/include_data" 1929 "$ref": "#/definitions/context" 1932 "$ref": "#/definitions/request_flags" 1958 "$ref": "#/definitions/jsonrpc" 1969 "$ref": "#/definitions/bio_id" 1972 "$ref": "#/definitions/include_info" 1974 "acc_substitution": { 1975 "$ref": "#/definitions/acc_substitution" 1977 "bio_id_resolution": { 1981 "$ref": "#/definitions/context" 1984 "$ref": "#/definitions/request_flags" 2006 "$id": "#named_annot", 2010 "$ref": "#/definitions/jsonrpc" 2021 "$ref": "#/definitions/bio_id" 2024 "$ref": "#/definitions/bio_ids" 2027 "$ref": "#/definitions/named_annots" 2029 "acc_substitution": { 2030 "$ref": "#/definitions/acc_substitution" 2032 "bio_id_resolution": { 2035 "snp_scale_limit": { 2036 "$ref": "#/definitions/snp_scale_limit" 2039 "$ref": "#/definitions/context" 2042 "$ref": "#/definitions/request_flags" 2080 "$ref": "#/definitions/jsonrpc" 2091 "$ref": "#/definitions/chunk_id" 2094 "$ref": "#/definitions/context" 2097 "$ref": "#/definitions/request_flags" 2119 "$id": "#ipg_resolve", 2123 "$ref": "#/definitions/jsonrpc" 2143 "$ref": "#/definitions/context" 2146 "$ref": "#/definitions/request_flags" 2181 "acc_ver_history": { 2182 "$id": "#acc_ver_history", 2186 "$ref": "#/definitions/jsonrpc" 2197 "$ref": "#/definitions/bio_id" 2200 "$ref": "#/definitions/context" 2203 "$ref": "#/definitions/request_flags" 2229 "$ref": "#/definitions/jsonrpc" 2243 "$ref": "#/definitions/context" 2246 "$ref": "#/definitions/request_flags" 2270 "$ref": "#/definitions/biodata" 2273 "$ref": "#/definitions/blob" 2276 "$ref": "#/definitions/resolve" 2279 "$ref": "#/definitions/named_annot" 2282 "$ref": "#/definitions/chunk" 2285 "$ref": "#/definitions/ipg_resolve" 2288 "$ref": "#/definitions/acc_ver_history" 2291 "$ref": "#/definitions/raw"User-defined methods of the data storage class.
User-defined methods of the data storage class.
Checksum and hash calculation classes.
CHash â Hash calculator.
void AddMessage(const SPSG_Message &message)
static void SetDataLimit(size_t value)
static bool sm_SetReplyType
static auto sm_PreviewSize
void Set(const char *name, shared_ptr< TReplyItem > &reply_item)
static CJsonResponse NewItem(const shared_ptr< CPSG_ReplyItem > &reply_item)
void AddRequestID(TItem, EDoNotAddRequestID)
static void SetReplyType(bool value)
void Fill(EPSG_Status status, shared_ptr< CPSG_Reply >)
static void SetPreviewSize(size_t value)
void push_back(void)
Add null element to the end of the array.
size_t size(void) const
Return the number of elements in the array.
bool IsObject(void) const
CJson_ConstObject GetObject(void) const
Get JSON object contents of the node.
CJson_ConstArray GetArray(void) const
Get JSON array contents of the node.
CJson_ConstValue GetValue(void) const
Get JSON value contents of the node.
EJsonType GetType(void) const
Get value type.
const_iterator find(const CJson_Node::TKeyType &name) const
Return an iterator that points to the location of the element.
const_iterator end(void) const
Return an iterator that points to the location after the last element.
Uint4 GetUint4(void) const
Uint8 GetUint8(void) const
bool GetBool(void) const
Get primitive value data.
TStringType GetString(void) const
double GetDouble(void) const
bool IsDouble(void) const
bool IsNumber(void) const
bool Read(std::istream &in)
Read JSON data from a stream.
std::string GetReadError(void) const
Get most recent read error.
bool ParseString(const TStringType &v)
Read JSON data from a UTF8 string.
bool ReadSucceeded(void) const
Test if the most recent read was successful.
bool Write(std::ostream &out, TJson_Write_Flags flags=fJson_Write_IndentWithSpace, unsigned int indent_char_count=4) const
Write JSON data into a stream.
CJson_Object ResetObject(void)
Erase node data and convert it into JSON object.
CJson_Array ResetArray(void)
Erase node data and convert it into JSON array.
CJson_Node & AssignCopy(const CJson_ConstNode &n)
Copy Node contents data into this node.
CJson_Node & SetNull(void)
Erase node data and convert it into JSON NULL value.
CJson_Value SetValue(void)
Get JSON value contents of the node.
void insert(const CJson_Node::TKeyType &name)
Insert null element into the object.
CJson_Object insert_object(const CJson_Node::TKeyType &name)
Insert object type element into the object.
bool Validate(const CJson_Document &v)
Validate JSON document against schema.
std::string GetValidationError() const
Return validation error.
Bio-id (such as accession)
const string & GetId() const
Get ID.
TType GetType() const
Get type.
const string & GetId() const
Get ID.
const TLastModified & GetLastModified() const
Get last modified.
@ eNoIncrementalProcessing
const string & GetId2Info() const
Get ID2 info.
int GetId2Chunk() const
Get ID2 chunk number.
A class derived from the queue class that additionally allows to run event loop.
bool Run(CDeadline deadline)
Process everything in the queue until it's empty or times out.
static const CPSG_BlobId * GetRawResponseBlobId(const shared_ptr< CPSG_BlobData > &blob_data)
A queue to retrieve data (accession resolution info; bio-sequence; annotation blobs) from the storage...
bool SendRequest(shared_ptr< CPSG_Request > request, CDeadline deadline)
Push request into the queue.
shared_ptr< CPSG_Reply > SendRequestAndGetReply(shared_ptr< CPSG_Request > request, CDeadline deadline)
Push request into the queue and get corresponding reply.
void Stop()
Stop accepting new requests.
@ eEndOfReply
No more items expected in the (overall!) reply.
@ eSmartTSE
If ID2 split is available, return split info blob only.
@ eSlimTSE
If ID2 split is available, return split info blob only.
@ eWholeTSE
If ID2 split is available, return all split blobs.
@ eOrigTSE
Return all Cassandra data chunks of the blob itself.
CNullable< string > TNucleotide
vector< string > TAnnotNames
Names of the named annotations.
@ fName
Requests name to use for canonical bio-id.
CParallelProcessing(const TParams ¶ms)
list< SThread > m_Threads
list< CPSG_EventLoop > m_PsgQueues
static bool ReadLine(string &line, istream &is=cin, bool single_doc=false)
static vector< shared_ptr< CPSG_Request > > ReadCommands(TCreateContext create_context, size_t report_progress_after=0)
static int OneRequest(const SOneRequestParams ¶ms, shared_ptr< CPSG_Request > request)
static CParallelProcessing< SBatchResolveParams > CreateParallelProcessing(const SBatchResolveParams ¶ms)
static CJson_Document RequestSchema()
static int Performance(const SPerformanceParams ¶ms)
static int JsonCheck(istream *schema_is, bool single_doc)
Take guard of the current CRequestContext, handle app-state, start/stop logging and request status in...
CTypeInfo class contains all information about C++ types (both basic and classes): members and layout...
CZipStreamDecompressor â zlib based decompression stream processor.
void Print(const CCompactSAMApplication::AlignInfo &ai)
std::ofstream out("events_result.xml")
main entry point for tests
static const struct name_t names[]
static SQLCHAR output[256]
static const char * schema
#define TAX_ID_TO(T, tax_id)
@ eTakeOwnership
An object can take ownership of another.
#define NCBI_ALWAYS_TROUBLE(mess)
#define _DEBUG_CODE(code)
CDiagContext_Extra & Print(const string &name, const string &value)
The method does not print the argument, but adds it to the string.
CDiagContext & GetDiagContext(void)
Get diag context instance.
static void SetRequestContext(CRequestContext *ctx)
Shortcut to CDiagContextThreadData::GetThreadData().SetRequestContext()
void SetRequestID(TCount rid)
Set request ID.
static CRequestContext & GetRequestContext(void)
Shortcut to CDiagContextThreadData::GetThreadData().GetRequestContext()
void SetStatus(int status)
Set request context status.
static const char * SeverityName(EDiagSev sev)
Get a common symbolic name for the severity levels.
EDiagSev
Severity level for the posted diagnostics.
@ eDiag_Warning
Warning message.
@ e499_BrokenConnection
Non-standard status code - used to indicate broken connection while serving normal request.
@ e500_InternalServerError
string ReportThis(TDiagPostFlags flags=eDPF_Exception) const
Report this exception only.
#define ENUM_METHOD_NAME(EnumName)
ESerialDataFormat
Data file format.
@ eSerial_AsnText
ASN.1 text.
@ eSerial_AsnBinary
ASN.1 binary.
static CObjectOStream * Open(ESerialDataFormat format, CNcbiOstream &outStream, bool deleteOutStream)
Create serial object writer and attach it to an output stream.
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
void Copy(const CObjectTypeInfo &type)
Copy data.
int64_t Int8
8-byte (64-bit) signed integer
uint64_t Uint8
8-byte (64-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static string Base64Encode(const CTempString str, size_t line_len=0)
Base64-encode string.
static bool SplitInTwo(const CTempString str, const CTempString delim, string &str1, string &str2, TSplitFlags flags=0)
Split a string into two pieces using the specified delimiters.
static string Base64Decode(const CTempString str)
Base64-decode string.
@ eNoWait
No-wait, expires immediately.
@ eInfinite
Infinite deadline.
E_Choice
Choice variants.
unsigned int
A callback function used to compare two keys in a database.
The blob sat and sat key Both must be positive integers</td > n< td > Non empty string The interpretation of the blob id depends on a processor Cassandra n processor expects the following format
constexpr auto sort(_Init &&init)
constexpr bool empty(list< Ts... >) noexcept
const GenericPointer< typename T::ValueType > T2 value
std::istream & in(std::istream &in_, double &x_)
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
string ReadLine(CNcbiIstream &in)
void s_ItemComplete< SInteractiveParams >(SJsonOut &json_out, EPSG_Status status, const shared_ptr< CPSG_ReplyItem > &item)
void s_ItemComplete(SJsonOut &json_out, EPSG_Status status, const shared_ptr< CPSG_ReplyItem > &item)
CRequestStatus::ECode s_PsgStatusToRequestStatus(EPSG_Status psg_status)
@ eJsonRpc_InvalidRequest
@ eJsonRpc_ExceptionOnRead
const char * s_StrStatus(EPSG_Status status)
false_type no_server_mode
string s_ProgressStatusToString(CPSG_Processor::EProgressStatus progress_status)
string s_GetId(const CJson_Document &req_doc)
void s_ReplyComplete< SOneRequestParams >(SJsonOut &json_out, EPSG_Status status, const shared_ptr< CPSG_Reply > &reply)
shared_ptr< CPSG_Reply > s_GetReply(shared_ptr< CPSG_ReplyItem > &item)
void s_NewItem(SJsonOut &, const shared_ptr< CPSG_ReplyItem > &)
void s_ReplyComplete< SInteractiveParams, testing, server_mode >(SJsonOut &json_out, EPSG_Status status, const shared_ptr< CPSG_Reply > &reply)
const initializer_list< SInfoFlag > kInfoFlags
void s_ReplyComplete(SJsonOut &json_out, EPSG_Status status, const shared_ptr< CPSG_Reply > &reply)
void s_NewItem< SInteractiveParams, verbose >(SJsonOut &json_out, const shared_ptr< CPSG_ReplyItem > &item)
const initializer_list< SDataFlag > kDataFlags
void s_ReplyComplete< SInteractiveParams, testing, no_server_mode >(SJsonOut &json_out, EPSG_Status status, const shared_ptr< CPSG_Reply > &reply)
ESerialDataFormat s_GetInputFormat(const string &format)
void s_ReplyComplete< no_verbose >(SJsonOut &json_out, EPSG_Status status, const shared_ptr< CPSG_Reply > &reply)
void s_ReplyComplete< SInteractiveParams, no_testing, no_server_mode >(SJsonOut &json_out, EPSG_Status status, const shared_ptr< CPSG_Reply > &reply)
TTypeInfo s_GetInputType(const shared_ptr< CPSG_BlobData > &blob_data)
void s_ItemComplete< no_verbose >(SJsonOut &json_out, EPSG_Status status, const shared_ptr< CPSG_ReplyItem > &item)
const char * s_GetItemName(CPSG_ReplyItem::EType type, bool trouble=true)
string s_ReasonToString(CPSG_SkippedBlob::EReason reason)
void s_ReplyComplete< SInteractiveParams, no_testing, server_mode >(SJsonOut &json_out, EPSG_Status status, const shared_ptr< CPSG_Reply > &reply)
void s_NewItem< SOneRequestParams >(SJsonOut &json_out, const shared_ptr< CPSG_ReplyItem > &reply_item)
EPSG_Status
Retrieval result.
@ eSuccess
Successfully retrieved.
@ eInProgress
Retrieval is not finalized yet, more info may come.
@ eForbidden
User is not authorized for the retrieval.
@ eCanceled
Request canceled.
@ eError
An error was encountered while trying to send request or to read and to process the reply.
vector< CPSG_BioId > CPSG_BioIds
static SLJIT_INLINE sljit_ins l(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
SImpl(const TParams ¶ms)
void(*)(SJsonOut &, EPSG_Status, const shared_ptr< CPSG_ReplyItem > &) TItemComplete
void(*)(SJsonOut &, EPSG_Status, const shared_ptr< CPSG_Reply > &) TReplyComplete
void Init(const TParams ¶ms)
TReplyComplete GetReplyComplete()
TItemComplete GetItemComplete()
void Submitter(CPSG_Queue &output)
void(*)(SJsonOut &, const shared_ptr< CPSG_ReplyItem > &) TNewItem
bool ReportErrors(EPSG_Status status, TItem item, const char *prefix)
unordered_map< string, pair< shared_ptr< CPSG_BlobInfo >, shared_ptr< CPSG_BlobData > > > m_Data
SDataOnlyCopy(const SOneRequestParams::SDataOnly ¶ms)
const SOneRequestParams::SDataOnly & m_Params
void ItemComplete(EPSG_Status status, const shared_ptr< CPSG_ReplyItem > &item)
void ReplyComplete(EPSG_Status status, const shared_ptr< CPSG_Reply > &reply)
void Process(shared_ptr< CPSG_BlobInfo > blob_info)
SInteractiveNewRequestStart(const string &request, CJson_ConstObject params_obj)
const size_t preview_size
static string GetService(string service, bool one_server)
const TJson_Write_Flags m_Flags
SJsonOut & operator<<(const CJson_Document &doc)
static const char * Name(EType t)
void OutputItems(ostream &os) const
SNewRequestContext(const SNewRequestContext &)=delete
CRef< CRequestContext > Get() const
void operator=(const SNewRequestContext &)=delete
CRef< CRequestContext > m_RequestContext
SNonVerboseBase(string id)
set< EPSG_Status > reported
static void ReplyComplete(SJsonOut &json_out, EPSG_Status status, const shared_ptr< CPSG_Reply > &reply)
static void ItemComplete(SJsonOut &json_out, EPSG_Status status, const shared_ptr< CPSG_ReplyItem > &item)
void ReplyComplete(SJsonOut &json_out, EPSG_Status status, const shared_ptr< CPSG_Reply > &reply)
map< CPSG_ReplyItem::EType, shared_ptr< CPSG_ReplyItem > > m_Items
void ItemComplete(SJsonOut &json_out, EPSG_Status status, const shared_ptr< CPSG_ReplyItem > &item)
const ESerialDataFormat output_format
const CLogLatencies::EWhich which
static void SetDefault(const T &value)
const SPSG_UserArgs user_args
static EDiagSev min_severity
const CPSG_Request::TFlags request_flags
const size_t user_threads
const bool report_immediately
static CPSG_Request_Resolve::TIncludeInfo GetIncludeInfo(TSpecified specified)
static CPSG_BioId::TType GetBioIdType(const string &type)
function< void(string)> TExclude
static shared_ptr< TRequest > Build(const TInput &input, TArgs &&... args)
static const initializer_list< SInfoFlag > & GetInfoFlags()
static const initializer_list< SDataFlag > & GetDataFlags()
function< bool(const string &)> TSpecified
static CS_CONTEXT * context
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