NCBI C++ ToolKit
|
Classes | |
class | CRetryContext |
CRetryContext – Retry context. More... | |
class | CHttpRetryContext |
HTTP-specific retry context implementation. More... | |
Typedefs | |
typedef map< string, string > | CRetryContext::TValues |
Map of name-value pairs. More... | |
typedef int | CRetryContext::TFlags |
Enumerations | |
enum | CRetryContext::EContentOverride { CRetryContext::eNot_set , CRetryContext::eNoContent , CRetryContext::eFromResponse , CRetryContext::eData } |
Content override flags. More... | |
enum | CRetryContext::FFlags { CRetryContext::fStop = 1 << 0 , CRetryContext::fDelay = 1 << 1 , CRetryContext::fArgs = 1 << 2 , CRetryContext::fUrl = 1 << 3 , CRetryContext::fContentOverride = 1 << 4 , CRetryContext::fContent = 1 << 5 } |
Variables | |
TFlags | CRetryContext::m_Flags |
string | CRetryContext::m_StopReason |
CTimeSpan | CRetryContext::m_Delay |
string | CRetryContext::m_Args |
string | CRetryContext::m_Url |
EContentOverride | CRetryContext::m_ContentOverride |
string | CRetryContext::m_Content |
bool | CRetryContext::m_NeedRetry |
bool | CRetryContext::m_NeedReconnect |
static const char * | CHttpRetryContext::kHeader_Stop = "X-NCBI-Retry-Stop" |
static const char * | CHttpRetryContext::kHeader_Delay = "X-NCBI-Retry-Delay" |
static const char * | CHttpRetryContext::kHeader_Args = "X-NCBI-Retry-Args" |
static const char * | CHttpRetryContext::kHeader_Url = "X-NCBI-Retry-URL" |
static const char * | CHttpRetryContext::kHeader_Content = "X-NCBI-Retry-Content" |
static const char * | CHttpRetryContext::kContent_None = "no_content" |
static const char * | CHttpRetryContext::kContent_FromResponse = "from_response" |
static const char * | CHttpRetryContext::kContent_Value = "content:" |
|
private |
Definition at line 172 of file retry_ctx.hpp.
typedef map<string, string> CRetryContext::TValues |
Map of name-value pairs.
Definition at line 158 of file retry_ctx.hpp.
Content override flags.
Definition at line 64 of file retry_ctx.hpp.
|
private |
Enumerator | |
---|---|
fStop | |
fDelay | |
fArgs | |
fUrl | |
fContentOverride | |
fContent |
Definition at line 164 of file retry_ctx.hpp.
CHttpRetryContext::CHttpRetryContext | ( | const CRetryContext & | ctx | ) |
Definition at line 51 of file retry_ctx.cpp.
References ctx.
|
inline |
Definition at line 193 of file retry_ctx.hpp.
|
inline |
Definition at line 226 of file retry_ctx.hpp.
Get retry args, URL-decoded.
Definition at line 346 of file retry_ctx.hpp.
References CRetryContext::m_Args.
Referenced by CHttpRetryContext::GetValues().
Get retry content.
Definition at line 456 of file retry_ctx.hpp.
References CRetryContext::m_Content.
Referenced by CHttpRetryContext::GetValues(), and CRPCClient_Base::x_Ask().
|
inline |
Get content source.
Definition at line 424 of file retry_ctx.hpp.
References CRetryContext::m_ContentOverride.
Referenced by CHttpRetryContext::GetValues(), and CRPCClient_Base::x_Ask().
Get retry delay.
Definition at line 308 of file retry_ctx.hpp.
References CRetryContext::m_Delay.
Referenced by CHttpRetryContext::GetValues(), and CRPCClient_Base::x_GetRetryDelay().
|
inline |
Check if another retry attempt has been requested (any new headers except STOP received in the last reply).
Definition at line 236 of file retry_ctx.hpp.
References CRetryContext::m_NeedRetry.
Referenced by CRPCClient_Base::x_Ask().
Get STOP reason (or empty string).
Definition at line 278 of file retry_ctx.hpp.
References CRetryContext::m_StopReason.
Referenced by CHttpRetryContext::GetValues(), and CRPCClient_Base::x_Ask().
Get retry URL.
Definition at line 384 of file retry_ctx.hpp.
References CRetryContext::m_Url.
Referenced by CHttpRetryContext::GetValues().
|
inlinevirtual |
Fill name-value pairs (e.g.
to be used by a server application to serve retry information). The default implementaion does nothing.
Reimplemented in CHttpRetryContext.
Definition at line 161 of file retry_ctx.hpp.
|
virtual |
Fills HTTP header names and values.
Reimplemented from CRetryContext.
Definition at line 128 of file retry_ctx.cpp.
References map_checker< Container >::clear(), CRetryContext::eData, CRetryContext::eFromResponse, CRetryContext::eNoContent, CRetryContext::GetArgs(), CRetryContext::GetContent(), CRetryContext::GetContentOverride(), CRetryContext::GetDelay(), CRetryContext::GetStopReason(), CRetryContext::GetUrl(), CRetryContext::IsSetArgs(), CRetryContext::IsSetContent(), CRetryContext::IsSetContentOverride(), CRetryContext::IsSetDelay(), CRetryContext::IsSetStop(), CRetryContext::IsSetUrl(), CHttpRetryContext::kContent_FromResponse, CHttpRetryContext::kContent_None, CHttpRetryContext::kContent_Value, CHttpRetryContext::kHeader_Args, CHttpRetryContext::kHeader_Content, CHttpRetryContext::kHeader_Delay, CHttpRetryContext::kHeader_Stop, CHttpRetryContext::kHeader_Url, NStr::NumericToString(), NStr::URLEncode(), and rapidjson::value.
|
inline |
Check if retry args are set.
Definition at line 339 of file retry_ctx.hpp.
References CRetryContext::fArgs, and CRetryContext::x_IsSetFlag().
Referenced by CHttpRetryContext::GetValues().
|
inline |
Check if retry content is set and content-override flag assumes any content (eFromResponse or eData).
Definition at line 447 of file retry_ctx.hpp.
References CRetryContext::eData, CRetryContext::eFromResponse, CRetryContext::fContent, CRetryContext::m_Content, CRetryContext::m_ContentOverride, and CRetryContext::x_IsSetFlag().
Referenced by CHttpRetryContext::GetValues(), and CRPCClient_Base::x_Ask().
|
inline |
Check if content source is set.
Definition at line 415 of file retry_ctx.hpp.
References CRetryContext::eNot_set, CRetryContext::fContentOverride, CRetryContext::m_ContentOverride, and CRetryContext::x_IsSetFlag().
Referenced by CHttpRetryContext::GetValues(), and CRPCClient_Base::x_Ask().
|
inline |
Check if retry delay is set.
Definition at line 301 of file retry_ctx.hpp.
References CRetryContext::fDelay, and CRetryContext::x_IsSetFlag().
Referenced by CHttpRetryContext::GetValues(), and CRPCClient_Base::x_GetRetryDelay().
|
inline |
Check if STOP flag is set.
Definition at line 271 of file retry_ctx.hpp.
References CRetryContext::fStop, and CRetryContext::x_IsSetFlag().
Referenced by CHttpRetryContext::GetValues(), and CRPCClient_Base::x_Ask().
|
inline |
Check if retry URL is set.
Definition at line 377 of file retry_ctx.hpp.
References CRetryContext::fUrl, and CRetryContext::x_IsSetFlag().
Referenced by CHttpRetryContext::GetValues().
|
inline |
Check if the client should reconnect (e.g. if URL or args have changed).
Definition at line 150 of file retry_ctx.hpp.
References CRetryContext::m_NeedReconnect.
CHttpRetryContext & CHttpRetryContext::operator= | ( | const CRetryContext & | ctx | ) |
Definition at line 57 of file retry_ctx.cpp.
References ctx, and CObject::operator=().
void CHttpRetryContext::ParseHeader | ( | const char * | http_header | ) |
Definition at line 67 of file retry_ctx.cpp.
References CRetryContext::eData, CRetryContext::eFromResponse, NStr::eNocase, CRetryContext::eNoContent, CRetryContext::eNot_set, NStr::EqualNocase(), NStr::eTrunc_Both, NStr::fSplit_MergeDelimiters, NStr::fSplit_Truncate, HTTP_EOL, ITERATE, CHttpRetryContext::kContent_FromResponse, CHttpRetryContext::kContent_None, CHttpRetryContext::kContent_Value, CHttpRetryContext::kHeader_Args, CHttpRetryContext::kHeader_Content, CHttpRetryContext::kHeader_Delay, CHttpRetryContext::kHeader_Stop, CHttpRetryContext::kHeader_Url, NPOS, CRetryContext::ResetContent(), CRetryContext::ResetNeedRetry(), CRetryContext::SetArgs(), CRetryContext::SetContent(), CRetryContext::SetContentOverride(), CRetryContext::SetDelay(), CRetryContext::SetNeedReconnect(), CRetryContext::SetNeedRetry(), CRetryContext::SetStop(), CRetryContext::SetUrl(), NStr::Split(), NStr::StartsWith(), NStr::StringToDouble(), NStr::TruncateSpacesInPlace(), NStr::URLDecode(), val, and rapidjson::value.
Referenced by CRPCClient< TRequest, TReply >::sx_ParseHeader().
|
inline |
Clear all options.
Definition at line 257 of file retry_ctx.hpp.
References CRetryContext::ResetArgs(), CRetryContext::ResetContent(), CRetryContext::ResetContentOverride(), CRetryContext::ResetDelay(), CRetryContext::ResetNeedReconnect(), CRetryContext::ResetNeedRetry(), CRetryContext::ResetStop(), and CRetryContext::ResetUrl().
Referenced by CRPCClient_Base::x_Ask().
|
inline |
Reset args.
Definition at line 369 of file retry_ctx.hpp.
References CRetryContext::fArgs, CRetryContext::m_Args, and CRetryContext::x_SetFlag().
Referenced by CRetryContext::Reset().
|
inline |
Reset content.
Definition at line 471 of file retry_ctx.hpp.
References CRetryContext::fContent, CRetryContext::m_Content, and CRetryContext::x_SetFlag().
Referenced by CHttpRetryContext::ParseHeader(), and CRetryContext::Reset().
|
inline |
Reset content source.
Definition at line 439 of file retry_ctx.hpp.
References CRetryContext::eNot_set, CRetryContext::fContentOverride, CRetryContext::m_ContentOverride, and CRetryContext::x_SetFlag().
Referenced by CRetryContext::Reset().
|
inline |
Reset delay.
Definition at line 331 of file retry_ctx.hpp.
References CTimeSpan::Clear(), CRetryContext::fDelay, CRetryContext::m_Delay, and CRetryContext::x_SetFlag().
Referenced by CRetryContext::Reset().
|
inline |
Reset need-reconnect flag (e.g.
after reconnecting to the new URL, but before reading new context).
Definition at line 155 of file retry_ctx.hpp.
References CRetryContext::m_NeedReconnect.
Referenced by CRPCClient_Base::Connect(), and CRetryContext::Reset().
|
inline |
Definition at line 250 of file retry_ctx.hpp.
References CRetryContext::m_NeedRetry.
Referenced by CHttpRetryContext::ParseHeader(), and CRetryContext::Reset().
|
inline |
Reset STOP flag and reason.
Definition at line 293 of file retry_ctx.hpp.
References CRetryContext::fStop, CRetryContext::m_StopReason, and CRetryContext::x_SetFlag().
Referenced by CRetryContext::Reset().
|
inline |
Reset URL.
Definition at line 407 of file retry_ctx.hpp.
References CRetryContext::fUrl, CRetryContext::m_Url, and CRetryContext::x_SetFlag().
Referenced by CRetryContext::Reset().
Set retry args.
The arguments set here will override any values set in the URL.
Definition at line 361 of file retry_ctx.hpp.
References CUrlArgs::eAmp_Char, CRetryContext::fArgs, CUrlArgs::GetQueryString(), CRetryContext::m_Args, and CRetryContext::x_SetFlag().
Set retry args.
The arguments must be pre-URL-encoded as required. The arguments set here will override any values set in the URL.
Definition at line 353 of file retry_ctx.hpp.
References CRetryContext::fArgs, CRetryContext::m_Args, and CRetryContext::x_SetFlag().
Referenced by CHttpRetryContext::ParseHeader().
Set retry content.
If the content is non-empty and content-override is eFromResponse or eData, the value should be sent by the server automatically.
Definition at line 463 of file retry_ctx.hpp.
References CRetryContext::fContent, CRetryContext::m_Content, and CRetryContext::x_SetFlag().
Referenced by CHttpRetryContext::ParseHeader(), and CRPCClient_Base::x_Ask().
|
inline |
Set content source.
Definition at line 431 of file retry_ctx.hpp.
References CRetryContext::fContentOverride, CRetryContext::m_ContentOverride, and CRetryContext::x_SetFlag().
Referenced by CHttpRetryContext::ParseHeader().
|
inline |
Set retry delay.
Definition at line 315 of file retry_ctx.hpp.
References CRetryContext::fDelay, CRetryContext::m_Delay, and CRetryContext::x_SetFlag().
Referenced by CHttpRetryContext::ParseHeader().
|
inline |
Set retry delay in seconds.
Definition at line 323 of file retry_ctx.hpp.
References CRetryContext::fDelay, CRetryContext::m_Delay, CTimeSpan::Set(), and CRetryContext::x_SetFlag().
|
inline |
Set need-reconnect flag.
Definition at line 152 of file retry_ctx.hpp.
References CRetryContext::m_NeedReconnect.
Referenced by CHttpRetryContext::ParseHeader().
|
inline |
Definition at line 243 of file retry_ctx.hpp.
References CRetryContext::m_NeedRetry.
Referenced by CHttpRetryContext::ParseHeader().
Set STOP flag, clear all other options.
Definition at line 285 of file retry_ctx.hpp.
References CRetryContext::fStop, CRetryContext::m_StopReason, and CRetryContext::x_SetFlag().
Referenced by CHttpRetryContext::ParseHeader().
Set retry URL.
If the URL contains any arguments, they may be overwritten by the values set through SetArgs().
Definition at line 399 of file retry_ctx.hpp.
References CUrl::ComposeUrl(), CUrlArgs::eAmp_Char, CRetryContext::fUrl, CRetryContext::m_Url, and CRetryContext::x_SetFlag().
Set retry URL.
If the URL contains any arguments, they may be overwritten by the values set through SetArgs().
Definition at line 391 of file retry_ctx.hpp.
References CRetryContext::fUrl, CRetryContext::m_Url, and CRetryContext::x_SetFlag().
Referenced by CHttpRetryContext::ParseHeader().
Definition at line 479 of file retry_ctx.hpp.
References f, and CRetryContext::m_Flags.
Referenced by CRetryContext::IsSetArgs(), CRetryContext::IsSetContent(), CRetryContext::IsSetContentOverride(), CRetryContext::IsSetDelay(), CRetryContext::IsSetStop(), and CRetryContext::IsSetUrl().
Definition at line 486 of file retry_ctx.hpp.
References f, CRetryContext::m_Flags, and rapidjson::value.
Referenced by CRetryContext::ResetArgs(), CRetryContext::ResetContent(), CRetryContext::ResetContentOverride(), CRetryContext::ResetDelay(), CRetryContext::ResetStop(), CRetryContext::ResetUrl(), CRetryContext::SetArgs(), CRetryContext::SetContent(), CRetryContext::SetContentOverride(), CRetryContext::SetDelay(), CRetryContext::SetStop(), and CRetryContext::SetUrl().
|
inlinevirtual |
Definition at line 194 of file retry_ctx.hpp.
|
inlinevirtual |
Definition at line 61 of file retry_ctx.hpp.
|
static |
Definition at line 211 of file retry_ctx.hpp.
Referenced by CHttpRetryContext::GetValues(), and CHttpRetryContext::ParseHeader().
|
static |
Definition at line 210 of file retry_ctx.hpp.
Referenced by CHttpRetryContext::GetValues(), and CHttpRetryContext::ParseHeader().
|
static |
Definition at line 212 of file retry_ctx.hpp.
Referenced by CHttpRetryContext::GetValues(), and CHttpRetryContext::ParseHeader().
Definition at line 207 of file retry_ctx.hpp.
Referenced by CHttpRetryContext::GetValues(), and CHttpRetryContext::ParseHeader().
Definition at line 209 of file retry_ctx.hpp.
Referenced by CHttpRetryContext::GetValues(), and CHttpRetryContext::ParseHeader().
Definition at line 206 of file retry_ctx.hpp.
Referenced by CCgi2RCgiApp::DefineRefreshTags(), CHttpRetryContext::GetValues(), and CHttpRetryContext::ParseHeader().
Definition at line 205 of file retry_ctx.hpp.
Referenced by CHttpRetryContext::GetValues(), and CHttpRetryContext::ParseHeader().
Definition at line 208 of file retry_ctx.hpp.
Referenced by CCgi2RCgiApp::DefineRefreshTags(), CHttpRetryContext::GetValues(), and CHttpRetryContext::ParseHeader().
|
private |
Definition at line 180 of file retry_ctx.hpp.
Referenced by CRetryContext::GetArgs(), CRetryContext::ResetArgs(), and CRetryContext::SetArgs().
|
private |
Definition at line 183 of file retry_ctx.hpp.
Referenced by CRetryContext::GetContent(), CRetryContext::IsSetContent(), CRetryContext::ResetContent(), and CRetryContext::SetContent().
|
private |
Definition at line 182 of file retry_ctx.hpp.
Referenced by CRetryContext::GetContentOverride(), CRetryContext::IsSetContent(), CRetryContext::IsSetContentOverride(), CRetryContext::ResetContentOverride(), and CRetryContext::SetContentOverride().
|
private |
Definition at line 179 of file retry_ctx.hpp.
Referenced by CRetryContext::GetDelay(), CRetryContext::ResetDelay(), and CRetryContext::SetDelay().
|
private |
Definition at line 177 of file retry_ctx.hpp.
Referenced by CRetryContext::x_IsSetFlag(), and CRetryContext::x_SetFlag().
|
private |
Definition at line 185 of file retry_ctx.hpp.
Referenced by CRetryContext::NeedReconnect(), CRetryContext::ResetNeedReconnect(), and CRetryContext::SetNeedReconnect().
|
private |
Definition at line 184 of file retry_ctx.hpp.
Referenced by CRetryContext::GetNeedRetry(), CRetryContext::ResetNeedRetry(), and CRetryContext::SetNeedRetry().
|
private |
Definition at line 178 of file retry_ctx.hpp.
Referenced by CRetryContext::GetStopReason(), CRetryContext::ResetStop(), and CRetryContext::SetStop().
|
private |
Definition at line 181 of file retry_ctx.hpp.
Referenced by CRetryContext::GetUrl(), CRetryContext::ResetUrl(), and CRetryContext::SetUrl().