49 if (message.
HasKey(
"SessionID")) {
50 string session = message.
GetString(
"SessionID");
58 if (message.
HasKey(
"ClientIP"))
59 client_ip = message.
GetString(
"ClientIP");
61 if (client_ip.empty())
69 bool ncbi_context_deserialized =
false;
70 if (message.
HasKey(
"ncbi_context")) {
76 ncbi_context_deserialized =
true;
77 }
catch (
const exception & ex) {
82 if (ncbi_context_deserialized ==
false && message.
HasKey(
"ncbi_phid")) {
84 string ncbi_phid = message.
GetString(
"ncbi_phid");
85 if (!ncbi_phid.empty())
87 }
catch (
const exception & ex) {
102 catch (
const std::exception & ex) {
117 if (message.
HasKey(
"StorageFlags")) {
119 if (
flags.HasKey(
"Fast") &&
flags.GetBoolean(
"Fast"))
121 if (
flags.HasKey(
"Persistent") &&
flags.GetBoolean(
"Persistent"))
123 if (
flags.HasKey(
"NetCache") &&
flags.GetBoolean(
"NetCache"))
125 if (
flags.HasKey(
"FileTrack") &&
flags.GetBoolean(
"FileTrack"))
127 if (
flags.HasKey(
"Movable") &&
flags.GetBoolean(
"Movable"))
129 if (
flags.HasKey(
"Cacheable") &&
flags.GetBoolean(
"Cacheable"))
131 if (
flags.HasKey(
"NoMetaData") &&
flags.GetBoolean(
"NoMetaData"))
143 if (message.
HasKey(
"ICache")) {
145 if (settings.
HasKey(
"ServiceName"))
147 if (settings.
HasKey(
"CacheName"))
159 if (message.
HasKey(
"UserKey")) {
161 if (user_key.
HasKey(
"UniqueID"))
163 if (user_key.
HasKey(
"AppDomain"))
177 reply_message.
SetInteger(
"RE", serial_number);
179 return reply_message;
186 const string & error_message,
187 const string & scope,
195 reply_message.
SetInteger(
"RE", serial_number);
199 reply_message.
SetByKey(
"Errors", errors);
201 return reply_message;
208 const string & warning_message,
209 const string & scope,
213 if (!message.
HasKey(
"Warnings"))
216 warnings = message.
GetByKey(
"Warnings");
225 const string & error_message,
226 const string & scope,
234 if (!message.
HasKey(
"Errors"))
237 errors = message.
GetByKey(
"Errors");
245 const string & error_message,
246 const string & scope,
252 issue_node.
SetString(
"Message", error_message);
261 string * error_scope,
263 unsigned int * error_sub_code)
static CJsonNode NewArrayNode()
Create a new JSON array node.
bool HasKey(const string &key) const
Check if an object node has an element accessible by the specified key.
void SetString(const string &key, const string &value)
Set a JSON object element to the specified string value.
Int8 GetInteger(const string &key) const
For a JSON object node, return the integer referred to by the specified key.
string GetString(const string &key) const
For a JSON object node, return the string referred to by the specified key.
void SetInteger(const string &key, Int8 value)
Set a JSON object element to the specified integer value.
void SetByKey(const string &key, CJsonNode::TInstance value)
For a JSON object node, insert a new element or update an existing element.
static CJsonNode NewObjectNode()
Create a new JSON object node.
void Append(CJsonNode::TInstance value)
For an array node, add a new element at the end of the array.
CJsonNode GetByKey(const string &key) const
For a JSON object node, return the value associated with the specified key.
Exception class for use by CNetStorage, CNetStorageByKey, and CNetStorageObject.
Request context properties passed between tasks.
void SetSessionID(const string &session)
void SetClientIP(const string &client)
#define NCBI_ERRCODE_X_NAME(name)
Returns value of error code by its name defined by NCBI_DEFINE_ERRCODE_X.
static CRequestContext & GetRequestContext(void)
Shortcut to CDiagContextThreadData::GetThreadData().GetRequestContext()
void Deserialize(CTempString data, EFormat format)
Deserialize values using the specified format.
void SetHitID(const string &hit)
Set explicit hit id. The id is reset on request end.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
@ eFormat_UrlEncoded
name=value pairs URL-encoded and separated with '&'
virtual const char * GetType(void) const
Get class name as a string.
TErrCode GetErrCode(void) const
Get error code.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
unsigned TNetStorageFlags
Bitwise OR of ENetStorageFlags.
@ fNST_NoMetaData
Do not use NetStorage relational database to track ownership & changes.
@ fNST_Cacheable
Has no effect at the moment.
@ fNST_NetCache
Use NetCache as the primary storage.
@ fNST_FileTrack
Use FileTrack as the primary storage.
@ fNST_Movable
Allow the object to move between storages.
int64_t Int8
8-byte (64-bit) signed integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
void GetPeerAddress(unsigned int *host, unsigned short *port, ENH_ByteOrder byte_order) const
Get peer address.
@ eSAF_IP
only numeric IP if INET socket, empty otherwise
CJsonNode CreateIssue(Int8 error_code, const string &error_message, const string &scope, Int8 sub_code)
void AppendError(CJsonNode &message, Int8 code, const string &error_message, const string &scope, Int8 sub_code, bool update_status)
TNetStorageFlags ExtractStorageFlags(const CJsonNode &message)
bool GetReplyMessageProperties(const exception &ex, string *error_scope, Int8 *error_code, unsigned int *error_sub_code)
CJsonNode CreateResponseMessage(Int8 serial_number)
CJsonNode CreateErrorResponseMessage(Int8 serial_number, Int8 error_code, const string &error_message, const string &scope, Int8 sub_code)
SUserKey ExtractUserKey(const CJsonNode &message)
void AppendWarning(CJsonNode &message, Int8 code, const string &warning_message, const string &scope, Int8 sub_code)
void SetSessionAndIPAndPHID(const CJsonNode &message, const CSocket &peer)
SCommonRequestArguments ExtractCommonFields(const CJsonNode &message)
SICacheSettings ExtractICacheSettings(const CJsonNode &message)
const string kMessageTypeReply
const string kStatusError
const string kScopeStdException
Defines CRequestContext class for NCBI C++ diagnostic API.
static CS_CONTEXT * context