Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/group__ServiceSupport.html below:
NCBI C++ ToolKit: Service Support
enum ENcbiArch { fArch_Virtual = 1 , fArch_Unknown = 0 } enum ENcbiCapacity { fCapacity_Unknown , fCapacity_32 , fCapacity_64 , fCapacity_32_64 } enum ENcbiOSType {
fOS_Unknown , fOS_IRIX = 8 , fOS_Solaris = 16 , fOS_BSD = 32 ,
fOS_Darwin = 36 , fOS_Windows = 64 , fOS_WindowsServer = 96 , fOS_Linux = 128
} enum ESERV_Type {
fSERV_Ncbid = 0x01 , fSERV_Standalone = 0x02 , fSERV_HttpGet = 0x04 , fSERV_HttpPost = 0x08 ,
fSERV_Http = fSERV_HttpGet | fSERV_HttpPost , fSERV_Firewall = 0x10 , fSERV_Dns = 0x20
} enum ESERV_Algo { eSERV_Regular = 0 , eSERV_Blast = 1 } enum ESERV_Mode { fSERV_Stateful = 1 , fSERV_Secure = 2 } enum ESERV_Site { fSERV_Local = 1 , fSERV_Private = 2 , fSERV_Interzone = 4 , fSERV_ZoneMask = 0xF0 } enum ESERV_TypeSpecial {
fSERV_Any = 0 , fSERV_All = 0x00007FFF , fSERV_Stateless = 0x00008000 , fSERV_Reserved = 0x00100000 ,
fSERV_DelayOpen = 0x00400000 , fSERV_ReverseDns = 0x00800000 , fSERV_IncludeDown = 0x08000000 , fSERV_IncludeStandby = 0x10000000 ,
fSERV_IncludeReserved = 0x20000000 , fSERV_IncludeSuppressed = 0x40000000 , fSERV_IncludeInactive = 0x70000000 , fSERV_IncludePrivate = 0x80000000 ,
fSERV_Promiscuous = 0xF8000000
} Special "type" bit values that may be combined with server types. More...
enum CUsageReportBase::EWhat {
CUsageReportBase::fNone = 0 , CUsageReportBase::fAppName = 1 << 1 , CUsageReportBase::fAppVersion = 1 << 2 , CUsageReportBase::fOS = 1 << 3 ,
CUsageReportBase::fHost = 1 << 4 , CUsageReportBase::fDefault = fAppName | fAppVersion | fOS
} Defines what information should be reported by default by all reporters, in addition to passed parameters for Send() method. More...
enum CUsageReportJob::EState {
CUsageReportJob::eCreated , CUsageReportJob::eQueued , CUsageReportJob::eRunning , CUsageReportJob::eCompleted ,
CUsageReportJob::eFailed , CUsageReportJob::eCanceled , CUsageReportJob::eRejected
} Job state. More...
enum CUsageReport::EWait { CUsageReport::eAlways , CUsageReport::eSkipIfNoConnection } Wait behavior. More...
HEAP HEAP_Create (void *base, TNCBI_Size size, TNCBI_Size chunk_size, FHEAP_Resize resize, void *auxarg) HEAP HEAP_Attach (const void *base, TNCBI_Size maxsize, int serial) HEAP HEAP_AttachFast (const void *base, TNCBI_Size size, int serial) SHEAP_Block * HEAP_Alloc (HEAP heap, TNCBI_Size size, int hint) void HEAP_Free (HEAP heap, SHEAP_Block *ptr) void HEAP_FreeFast (HEAP heap, SHEAP_Block *ptr, const SHEAP_Block *prev) SHEAP_Block * HEAP_Walk (const HEAP heap, const SHEAP_Block *prev) SHEAP_Block * HEAP_Next (const HEAP heap, const SHEAP_Block *prev) HEAP HEAP_Trim (HEAP heap) HEAP HEAP_Copy (const HEAP orig, size_t extra, int serial) unsigned int HEAP_AddRef (HEAP heap) unsigned int HEAP_Detach (HEAP heap) unsigned int HEAP_Destroy (HEAP heap) void * HEAP_Base (const HEAP heap) TNCBI_Size HEAP_Size (const HEAP heap) TNCBI_Size HEAP_Used (const HEAP heap) TNCBI_Size HEAP_Idle (const HEAP heap) int HEAP_Serial (const HEAP heap) void HEAP_Options (ESwitch fast, ESwitch unused) unsigned int HINFO_HostAddr (const HOST_INFO host_info) Get the official host address. More...
int HINFO_CpuCount (const HOST_INFO host_info) Get CPU count (number of logical cores, hyper-threaded included). More...
int HINFO_CpuUnits (const HOST_INFO host_info) Get physical CPU count (number of physical cores, not packages). More...
double HINFO_CpuClock (const HOST_INFO host_info) Get CPU clock rate. More...
int HINFO_TaskCount (const HOST_INFO host_info) Get task count. More...
int HINFO_Memusage (const HOST_INFO host_info, double memusage[5]) Get memory usage data. More...
int HINFO_MachineParams (const HOST_INFO host_info, SHINFO_Params *params) Get host parameters. More...
int HINFO_PortUsage (const HOST_INFO host_info, SHINFO_PortUsage ports[], size_t count) Obtain host port usage (currently only 4 first ports are published). More...
int HINFO_LoadAverage (const HOST_INFO host_info, double lavg[2]) Obtain host load averages. More...
int HINFO_Status (const HOST_INFO host_info, double status[2]) Obtain LB host availability status. More...
const char * HINFO_Environment (const HOST_INFO host_info) Obtain and return LB host environment. More...
const char * HINFO_AffinityArgument (const HOST_INFO host_info) Obtain the affinity argument that has keyed the service selection (if argument affinities have been used at all). More...
const char * HINFO_AffinityArgvalue (const HOST_INFO host_info) Obtain the affinity argument's value that has keyed the service selection (if argument affinities have been used at all). More...
const char * SERV_TypeStr (ESERV_Type type) const char * SERV_ReadType (const char *str, ESERV_Type *type) SSERV_Info * SERV_CreateNcbidInfo (unsigned int host, unsigned short port, const char *args) SSERV_Info * SERV_CreateStandaloneInfo (unsigned int host, unsigned short port) SSERV_Info * SERV_CreateHttpInfo (ESERV_Type type, unsigned int host, unsigned short port, const char *path, const char *args) SSERV_Info * SERV_CreateFirewallInfo (unsigned int host, unsigned short port, ESERV_Type type) SSERV_Info * SERV_CreateDnsInfo (unsigned int host) char * SERV_WriteInfo (const SSERV_Info *info) SSERV_Info * SERV_ReadInfo (const char *info_str) SSERV_Info * SERV_CopyInfo (const SSERV_Info *info) size_t SERV_SizeOfInfo (const SSERV_Info *info) int SERV_EqualInfo (const SSERV_Info *info1, const SSERV_Info *info2) SERV_ITER SERV_OpenEx (const char *service, TSERV_Type types, unsigned int preferred_host, const SConnNetInfo *net_info, SSERV_InfoCPtr skip[], size_t n_skip) Create an iterator for sequential server lookup. More...
SERV_ITER SERV_Open (const char *service, TSERV_Type types, unsigned int preferred_host, const SConnNetInfo *net_info) Same as "SERV_OpenEx(., ., ., ., 0, 0)" – i.e. More...
SERV_ITER SERV_OpenSimple (const char *service) Allocate an iterator and consult either local databases (if any present), or network database, using all default communication parameters found both in the registry and the environment variables (as if having an implicit parameter "net_info" created with "ConnNetInfo_Create(service)"). More...
SSERV_InfoCPtr SERV_GetNextInfoEx (SERV_ITER iter, HOST_INFO *host_info) Get the next server meta-address, optionally accompanied by the host parameters made available by the LB daemon (LBSMD). More...
SSERV_InfoCPtr SERV_GetNextInfo (SERV_ITER iter) Same as "SERV_GetNextInfoEx(., 0)" – i.e. More...
SSERV_Info * SERV_GetInfoEx (const char *service, TSERV_Type types, unsigned int preferred_host, const SConnNetInfo *net_info, SSERV_InfoCPtr skip[], size_t n_skip, HOST_INFO *host_info) A "fast track" routine equivalent to creating of an iterator as with SERV_OpenEx(), and then taking an info as with SERV_GetNextInfoEx(). More...
SSERV_Info * SERV_GetInfo (const char *service, TSERV_Type types, unsigned int preferred_host, const SConnNetInfo *net_info) Same as "SERV_GetInfoEx(., ., ., ., 0, 0, 0)" – i.e. More...
SSERV_Info * SERV_GetInfoSimple (const char *service) Equivalent to "SERV_GetInfo(., fSERV_Any, SERV_ANYHOST, ConnNetInfo_Create(service))", but it takes care not to leak its last "net_info" parameter, which it builds on the fly. More...
int SERV_Penalize (SERV_ITER iter, double fine) Penalize the server returned last from SERV_GetNextInfo[Ex](). More...
int SERV_PenalizeEx (SERV_ITER iter, double fine, TNCBI_Time time) int SERV_Rerate (SERV_ITER iter, double rate) Rerate the server returned last from SERV_GetNextInfo[Ex](). More...
void SERV_Reset (SERV_ITER iter) Reset the iterator to the state as if it has just been opened. More...
void SERV_Close (SERV_ITER iter) Deallocate the iterator. More...
unsigned short SERV_ServerPort (const char *name, unsigned int host) Obtain a port number that corresponds to the named (standalone) service declared at the specified host (per the LB configuration information). More...
int SERV_SetImplicitServerType (const char *service, ESERV_Type type) Set a server type to use when a service mapper returns typeless entries for the given service name (typed entries retain their types as received). More...
ESERV_Type SERV_GetImplicitServerType (const char *service) Get a server type that would be assigned to typeless entries for the given service name. More...
static void CUsageReportAPI::SetEnabled (bool enable=true) Enable or disable usage statistics reporting globally for all reporters. More...
static bool CUsageReportAPI::IsEnabled (void) Indicates whether global application usage statistics collection is enabled. More...
static void CUsageReportAPI::SetDefaultParameters (TWhat what=fDefault) Set default reporting parameters. More...
static TWhat CUsageReportAPI::GetDefaultParameters (void) static void CUsageReportAPI::SetURL (const string &url) Change CGI URL for reporting usage statistics. More...
static string CUsageReportAPI::GetURL (void) static void CUsageReportAPI::SetAppName (const string &name) Set application name for the usage reporters. More...
static string CUsageReportAPI::GetAppName (void) static void CUsageReportAPI::SetAppVersion (const string &version) Set application version for the usage reporter(s). More...
static void CUsageReportAPI::SetAppVersion (const CVersionInfo &version) static string CUsageReportAPI::GetAppVersion (void) static void CUsageReportAPI::SetMaxQueueSize (unsigned n) Declare the maximum reporting jobs queue size per reporter. More...
static unsigned CUsageReportAPI::GetMaxQueueSize () static void CUsageReportAPI::SetTimeout (const CTimeout &timeout) Set timeout for connection. More...
static CTimeout CUsageReportAPI::GetTimeout () Return timeout for network connection, if specified. More...
static void CUsageReportAPI::SetRetries (int retries) Set muximum number of retries in case of error reporting. More...
static int CUsageReportAPI::GetRetries () Return muximum number of retries in case of error reporting, if specified. More...
static bool CUsageReportAPI::CheckConnection () Check that connection to reporting URL can be established. More...
CUsageReportParameters::CUsageReportParameters (void) CUsageReportParameters & CUsageReportParameters::Add (const string &name, const string &value) Add argument Name must contain only alphanumeric chars or '_'. More...
CUsageReportParameters & CUsageReportParameters::Add (const string &name, const char *value) template<typename TValue > CUsageReportParameters & CUsageReportParameters::Add (const string &name, TValue value) string CUsageReportParameters::ToString () const Convert parameters to string. URL-encode all values. More...
CUsageReportParameters::CUsageReportParameters (const CUsageReportParameters &other) Copy constructor. More...
CUsageReportParameters & CUsageReportParameters::operator= (const CUsageReportParameters &other) Copy assignment operator. More...
void CUsageReportParameters::x_CopyFrom (const CUsageReportParameters &other) Copy parameters to another objects. More...
CUsageReportJob::CUsageReportJob (void) Default constructor. More...
virtual CUsageReportJob::~CUsageReportJob (void) Destructor. More...
EState CUsageReportJob::GetState () Return current job state. More...
virtual void CUsageReportJob::OnStateChange (EState) Callback for async reporting. More...
CUsageReportJob::CUsageReportJob (const CUsageReportJob &other) Copy constructor. More...
CUsageReportJob & CUsageReportJob::operator= (const CUsageReportJob &other) Copy assignment operator. More...
void CUsageReportJob::x_SetState (EState state) Set new job state. More...
void CUsageReportJob::x_CopyFrom (const CUsageReportJob &other) Copy data from 'other' job. More...
static CUsageReport & CUsageReport::Instance (void) Return global instance of CUsageReport. More...
CUsageReport::CUsageReport (TWhat what=fDefault, const string &url=string(), unsigned max_queue_size=0) Constructor. More...
virtual CUsageReport::~CUsageReport (void) Destructor. More...
void CUsageReport::SetEnabled (bool enable=true) Enable or disable usage reporter (current instance only). More...
bool CUsageReport::IsEnabled (void) Indicates whether application usage statistics collection is enabled for a current reporter instance. More...
void CUsageReport::Send (void) Report usage statistics (asynchronously), default parameters. More...
void CUsageReport::Send (CUsageReportParameters ¶ms) Report usage statistics (asynchronously). More...
template<typename TJob > void CUsageReport::Send (TJob &job) Report usage statistics (asynchronously) (advanced version). More...
unsigned CUsageReport::GetQueueSize (void) Get number of jobs in the queue – number of unprocessed yet jobs. More...
void CUsageReport::ClearQueue (void) Remove all unprocessed reporting jobs from queue. More...
void CUsageReport::Wait (EWait how=eAlways, CTimeout timeout=CTimeout(CTimeout::eDefault)) Wait until all queued jobs starts to process and queue is empty. More...
void CUsageReport::Finish (void) Finish reporting for the current reporting object. More...
bool CUsageReport::CheckConnection () Check that connection to the reporting URL can be established. More...
CUsageReport::CUsageReport (const CUsageReport &)=delete Prevent copying. More...
CUsageReport & CUsageReport::operator= (const CUsageReport &)=delete bool CUsageReport::x_Send (const string &extra_params) Send parameters string synchronously. More...
void CUsageReport::x_SendAsync (TJobPtr job_ptr) Send job asynchronously. More...
void CUsageReport::x_ThreadHandler (void) Thread handler for asynchronous job reporting. More...
void CUsageReport::x_ClearQueue (void) Remove all unprocessed reporting jobs from queue - internal version. More...
unsigned int SHEAP_Block::flag TNCBI_Size SHEAP_Block::size TNcbiArch SHINFO_Params::arch Architecture ID, see enum, 0=unknown. More...
TNcbiCapacity SHINFO_Params::bits Platform bitness, 32/64/32+64/0=unknown. More...
TNcbiOSType SHINFO_Params::ostype OS type ID, see enum, 0=unknown. More...
unsigned short SHINFO_Params::major unsigned short SHINFO_Params::minor unsigned short SHINFO_Params::patch struct { unsigned short SHINFO_Params::major unsigned short SHINFO_Params::minor unsigned short SHINFO_Params::patch } SHINFO_Params::kernel Kernel/OS version #, if available. More...
size_t SHINFO_Params::pgsize Hardware page size in bytes, if known. More...
TNCBI_Time SHINFO_Params::bootup System boot time, time_t-compatible. More...
TNCBI_Time SHINFO_Params::startup LBSMD start time, time_t-compatible. More...
unsigned short SHINFO_Params::major unsigned short SHINFO_Params::minor unsigned short SHINFO_Params::patch struct { unsigned short SHINFO_Params::major unsigned short SHINFO_Params::minor unsigned short SHINFO_Params::patch } SHINFO_Params::daemon LBSMD daemon version. More...
unsigned short SHINFO_Params::svcpack Kernel service pack (Hi=major, Lo=minor) More...
unsigned short SHINFO_PortUsage::port Port number, host byte order. More...
double SHINFO_PortUsage::used Port usage as percentage, [0..100]. More...
TNCBI_Size SSERV_NcbidInfo::args char SSERV_StandaloneInfo::_pad TNCBI_Size SSERV_HttpInfo::path TNCBI_Size SSERV_HttpInfo::args ESERV_Type SSERV_FirewallInfo::type unsigned char SSERV_DnsInfo::name SSERV_NcbidInfo USERV_Info::ncbid SSERV_StandaloneInfo USERV_Info::standalone SSERV_HttpInfo USERV_Info::http SSERV_FirewallInfo USERV_Info::firewall SSERV_DnsInfo USERV_Info::dns ESERV_Type SSERV_Info::type unsigned int SSERV_Info::host unsigned short SSERV_Info::port TSERV_Mode SSERV_Info::mode TSERV_Site SSERV_Info::site TNCBI_Time SSERV_Info::time double SSERV_Info::coef double SSERV_Info::rate EMIME_Type SSERV_Info::mime_t EMIME_SubType SSERV_Info::mime_s EMIME_Encoding SSERV_Info::mime_e TSERV_Algo SSERV_Info::algo TNCBI_IPv6Addr SSERV_Info::addr unsigned char SSERV_Info::vhost unsigned short SSERV_Info::extra USERV_Info SSERV_Info::u std::map< string, string > CUsageReportParameters::m_Params Stored parameters. More...
EState CUsageReportJob::m_State Job state. More...
bool CUsageReport::m_IsEnabled Enable/disable status. More...
bool CUsageReport::m_IsFinishing TRUE if Finish() has called and reporting thread should terminate. More...
bool CUsageReport::m_IsWaiting TRUE if Wait() is active. More...
string CUsageReport::m_DefaultParams Default parameters to report, concatenated and URL-encoded. More...
string CUsageReport::m_URL Reporting URL. More...
std::thread CUsageReport::m_Thread Reporting thread. More...
list< TJobPtr > CUsageReport::m_Queue Job queue. More...
unsigned CUsageReport::m_MaxQueueSize Maximum allowed queue size. More...
std::mutex CUsageReport::m_Usage_Mutex MT-protection to access members. More...
size_t CUsageReport::m_CountTotal Statistics: number of jobs processed. More...
size_t CUsageReport::m_CountSent Statistics: number of jobs successfully sent. More...
EWait CUsageReport::m_WaitMode Waiting mode. More...
CDeadline CUsageReport::m_WaitDeadline Deadline for Wait(), if active. More...
std::condition_variable CUsageReport::m_ThreadSignal Signal conditional variable for reporting thread synchronization. More...
std::mutex CUsageReport::m_ThreadSignal_Mutex ◆ __NCBI_REPORT_USAGE #define __NCBI_REPORT_USAGE ( event, args ) Value:
{ \
if (reporter.IsEnabled()) { \
CUsageReportParameters params; \
params.Add("jsevent", (event)) args; \
reporter.Send(params); \
} \
}
static CUsageReport & Instance(void)
Return global instance of CUsageReport.
Definition at line 709 of file ncbi_usage_report.hpp.
◆ NCBI_REPORT_USAGE
Convenience macro to log "jsevent" usage statistics (asynchronously).
-
Parameters
-
event Value for "jsevent" parameter. Automatically set "jsevent=...". args A chain of additional parameters to report. Optional. You can list as many .Add() calls here as you want, or drop this parameter at all. See usage example.
-
Usage example:
-
This example demonstrates how to log usage, with and without arguments. NCBI_REPORT_USAGE
(
"tools"
, .Add(
"tool_name"
,
"XYZ"
) .Add(
"tool_version"
, 1));
.Add("tool_name", "XYZ")
.Add("tool_version", 2));
#define NCBI_REPORT_USAGE(event,...)
Convenience macro to log "jsevent" usage statistics (asynchronously).
Definition at line 707 of file ncbi_usage_report.hpp.
◆ NCBI_REPORT_USAGE_FINISH
Finishing reporting via NCBI_REPORT_USAGE and global usage reporter,.
Definition at line 733 of file ncbi_usage_report.hpp.
◆ NCBI_REPORT_USAGE_START ◆ NCBI_REPORT_USAGE_WAIT
Wait until all reports via NCBI_REPORT_USAGE will be processed.
Wait() method have more arguments, so please use it directly if more functionality is required.
Definition at line 726 of file ncbi_usage_report.hpp.
◆ NCBI_REPORT_USAGE_WAIT_ALWAYS ◆ NCBI_REPORT_USAGE_WAIT_IF_SUCCESS ◆ NCBI_REPORT_USAGE_WAIT_TIMEOUT ◆ SERV_ANYHOST ◆ SERV_CLIENT_REVISION_MAJOR #define SERV_CLIENT_REVISION_MAJOR 7 ◆ SERV_CLIENT_REVISION_MINOR #define SERV_CLIENT_REVISION_MINOR 0
Definition at line 48 of file ncbi_service.h.
◆ SERV_DEFAULT_ALGO ◆ SERV_HTTP_ARGS #define SERV_HTTP_ARGS ( ui ) ((char*)(ui) + (ui)->args)
Definition at line 138 of file ncbi_server_info.h.
◆ SERV_HTTP_PATH #define SERV_HTTP_PATH ( ui ) ((char*)(ui) + (ui)->path)
Definition at line 137 of file ncbi_server_info.h.
◆ SERV_LOCALHOST #define SERV_LOCALHOST ((unsigned int)(~0UL)) ◆ SERV_MAXIMAL_BONUS ◆ SERV_MAXIMAL_RATE ◆ SERV_MINIMAL_BONUS ◆ SERV_MINIMAL_RATE ◆ SERV_NCBID_ARGS #define SERV_NCBID_ARGS ( ui ) ((char*)(ui) + (ui)->args)
Definition at line 127 of file ncbi_server_info.h.
◆ FHEAP_Resize ◆ HEAP ◆ HOST_INFO ◆ SERV_ITER ◆ SSERV_InfoCPtr ◆ TJobPtr ◆ TNcbiArch ◆ TNcbiCapacity ◆ TNcbiOSType ◆ TSERV_Algo ◆ TSERV_Mode ◆ TSERV_Site ◆ TSERV_Type
Bitwise OR of ESERV_Type[Special].
Definition at line 94 of file ncbi_service.h.
◆ TSERV_TypeOnly ◆ TWhat ◆ ENcbiArch Enumerator fArch_Virtual
Set when a VM.
fArch_Unknown
Unknown/undefined CPU type.
Definition at line 146 of file ncbi_host_info.h.
◆ ENcbiCapacity Enumerator fCapacity_Unknown fCapacity_32
32 bits only
fCapacity_64
64 bits, but 32-bit backward compatible
fCapacity_32_64
32 bits, but 64-bit forward compatible
Definition at line 154 of file ncbi_host_info.h.
◆ ENcbiOSType Enumerator fOS_Unknown fOS_IRIX fOS_Solaris fOS_BSD fOS_Darwin fOS_Windows fOS_WindowsServer fOS_Linux
Definition at line 164 of file ncbi_host_info.h.
◆ ESERV_Algo ◆ ESERV_Mode ◆ ESERV_Site Enumerator fSERV_Local fSERV_Private fSERV_Interzone fSERV_ZoneMask
Definition at line 97 of file ncbi_server_info.h.
◆ ESERV_Type Enumerator fSERV_Ncbid fSERV_Standalone fSERV_HttpGet fSERV_HttpPost fSERV_Http fSERV_Firewall fSERV_Dns
Definition at line 68 of file ncbi_server_info.h.
◆ ESERV_TypeSpecial
Special "type" bit values that may be combined with server types.
-
Note
-
MSW should be maintained compatible with EMGHBN_Option.
-
See also
-
ESERV_Type, ESERV_OpenEx, SERV_GetInfoEx
Enumerator fSERV_Any fSERV_All
Server type mask.
fSERV_Stateless
Stateless servers only.
fSERV_Reserved
Reserved, MBZ.
fSERV_DelayOpen
Don't open service until use.
fSERV_ReverseDns
LB-DNS translation.
fSERV_IncludeDown fSERV_IncludeStandby fSERV_IncludeReserved
-
Note
-
Not yet implemented
fSERV_IncludeSuppressed fSERV_IncludeInactive fSERV_IncludePrivate fSERV_Promiscuous
Evrthng and the kitchen sink.
Definition at line 78 of file ncbi_service.h.
◆ EState
Job state.
Enumerator eCreated
Initial state, not reported to OnStateChange()
eQueued
Added to queue (sending temporary postpones)
eRunning
Ready to send.
eCompleted
Result: successfully sent.
eFailed
Result: send failed.
eCanceled
Result: canceled / removed from queue.
eRejected
Result: rejected / too many requests.
Definition at line 378 of file ncbi_usage_report.hpp.
◆ EWait
Wait behavior.
Enumerator eAlways
Always wait (default);.
eSkipIfNoConnection
Do not try to send remaining jobs in the queue if all previous attempts failed.
Definition at line 590 of file ncbi_usage_report.hpp.
◆ EWhat ◆ Add() [1/3] ◆ Add() [2/3] ◆ Add() [3/3]
template<typename TValue >
◆ CheckConnection() [1/2] bool CUsageReportAPI::CheckConnection ( ) static ◆ CheckConnection() [2/2] bool CUsageReport::CheckConnection ( ) ◆ ClearQueue() void CUsageReport::ClearQueue ( void ) ◆ CUsageReport() [1/2] ◆ CUsageReport() [2/2]
Constructor.
Creates new reporting instance. For general case we still recommend to use a single global usage reporter, one per application, accessible via CUsageReport::Instance(). But, if you need to use different reporting URL or default parameters for each reporter, you can create new instance yourself with needed arguments.
-
Parameters
-
-
See also
-
TWhat, Instance(), CUsageReportAPI::SetDefaultParameters(), CUsageReportAPI::SetURL(), CUsageReportAPI::SetMaxQueueSize()
Definition at line 432 of file ncbi_usage_report.cpp.
References CUsageReportBase::fAppName, CUsageReportBase::fAppVersion, CUsageReportBase::fDefault, CUsageReportBase::fHost, CUsageReportBase::fOS, CUsageReportAPI::GetAppName(), CUsageReportAPI::GetAppVersion(), CUsageReportAPI::GetDefaultParameters(), CUsageReportAPI::GetMaxQueueSize(), CUsageReportAPI::GetURL(), CUsageReport::m_CountSent, CUsageReport::m_CountTotal, CUsageReport::m_DefaultParams, CUsageReport::m_IsEnabled, CUsageReport::m_IsFinishing, CUsageReport::m_IsWaiting, CUsageReport::m_MaxQueueSize, CUsageReport::m_URL, s_AddDefaultParam(), s_GetHost(), and CUsageReportParameters::ToString().
Referenced by CUsageReport::Instance().
◆ CUsageReportJob() [1/2] ◆ CUsageReportJob() [2/2] CUsageReportJob::CUsageReportJob ( void ) inline ◆ CUsageReportParameters() [1/2] ◆ CUsageReportParameters() [2/2] ◆ Finish() void CUsageReport::Finish ( void )
Finish reporting for the current reporting object.
All jobs in the queue awaiting to be send will be discarded, and reporting thread destroyed. If you want to wait all queued requests to finish as well, please call Wait() just before Finish().
-
Note
-
Only queued requests will be discarded. It doesn't affect already started job, that is sending at the current moment (if any). Reporting thread will be destroyed immediately after finishing sending that already started job.
-
The reporter become invalid after this call and shouldn't be used anymore.
-
See also
-
Wait, ClearQueue
Definition at line 676 of file ncbi_usage_report.cpp.
References CUsageReport::m_IsFinishing, CUsageReport::m_Thread, CUsageReport::m_ThreadSignal, MT_GUARD, and CUsageReport::x_ClearQueue().
Referenced by CUsageReportSampleApp::Pattern_2_MultipleReporters(), CBlastUsageReport::~CBlastUsageReport(), and CUsageReport::~CUsageReport().
◆ GetAppName() string CUsageReportAPI::GetAppName ( void ) static ◆ GetAppVersion() string CUsageReportAPI::GetAppVersion ( void ) static ◆ GetDefaultParameters() ◆ GetMaxQueueSize() unsigned CUsageReportAPI::GetMaxQueueSize ( void ) static ◆ GetQueueSize() unsigned CUsageReport::GetQueueSize ( void ) ◆ GetRetries() int CUsageReportAPI::GetRetries ( void ) static ◆ GetState() EState CUsageReportJob::GetState ( ) inline ◆ GetTimeout() CTimeout CUsageReportAPI::GetTimeout ( void ) static ◆ GetURL() string CUsageReportAPI::GetURL ( void ) static ◆ HEAP_AddRef() unsigned int HEAP_AddRef ( HEAP heap ) ◆ HEAP_Alloc()
Definition at line 641 of file ncbi_heapmgr.c.
References _HEAP_ALIGN_2, _HEAP_ALIGN_EX, assert, CORE_LOG_X, CORE_LOGF_X, eLOG_Error, eLOG_Warning, f, head, heap, HEAP_ALIGN, HEAP_BLOCKS, HEAP_CHECK, HEAP_EXTENT, HEAP_ISLAST, HEAP_ISUSED, HEAP_LAST, int, likely, n, SHEAP_HeapBlock::nextfree, SHEAP_HeapBlock::prevfree, s_HEAP_Collect(), s_HEAP_Find(), s_HEAP_Id(), s_HEAP_Take(), s_HEAP_Unlink, ncbi::grid::netcache::search::fields::size, and unlikely.
◆ HEAP_Attach()
Definition at line 339 of file ncbi_heapmgr.c.
References b, CORE_LOGF_X, eLOG_Error, HEAP_AttachFast(), HEAP_BLOCKS, HEAP_INDEX, HEAP_ISLAST, HEAP_NEXT, HEAP_NEXT_BIT, HEAP_PREV_BIT, HEAP_SIZE, and ncbi::grid::netcache::search::fields::size.
Referenced by s_Shmem_Attach().
◆ HEAP_AttachFast()
Definition at line 309 of file ncbi_heapmgr.c.
References _HEAP_ALIGN_2, _HEAP_ALIGN_EX, assert, calloc(), CORE_LOGF_X, eLOG_Warning, heap, HEAP_BLOCKS, HEAP_EXTENT, and ncbi::grid::netcache::search::fields::size.
Referenced by HEAP_Attach(), and s_Shmem_Attach().
◆ HEAP_Base()
Definition at line 1334 of file ncbi_heapmgr.c.
References heap, and HEAP_CHECK.
Referenced by LBSM_GetVersion(), LBSM_Shmem_Attach(), LBSM_Shmem_Update(), LBSMD_GetConfig(), LBSMD_GetHostParameter(), s_Close(), s_Fini(), s_GetHeapCopy(), s_GetLocalHostAddress(), s_GetNextInfo(), and s_VerifyChecksum().
◆ HEAP_Copy() ◆ HEAP_Create()
Definition at line 262 of file ncbi_heapmgr.c.
References _HEAP_ALIGN_2, _HEAP_ALIGN_EX, assert, b, CORE_LOGF_X, eLOG_Error, eLOG_Warning, heap, HEAP_ALIGN, HEAP_BLOCKS, HEAP_EXTENT, HEAP_LAST, HEAP_SIZE, malloc(), pythonpp::resize(), and ncbi::grid::netcache::search::fields::size.
Referenced by LBSM_Shmem_Create().
◆ HEAP_Destroy() unsigned int HEAP_Destroy ( HEAP heap ) ◆ HEAP_Detach() unsigned int HEAP_Detach ( HEAP heap ) ◆ HEAP_Free()
Definition at line 820 of file ncbi_heapmgr.c.
References b, CORE_LOG_X, CORE_LOGF_X, eLOG_Error, eLOG_Warning, heap, HEAP_CHECK, HEAP_INDEX, HEAP_ISUSED, HEAP_NEXT, likely, n, s_HEAP_Free(), s_HEAP_Id(), and unlikely.
Referenced by HEAP_FreeFast().
◆ HEAP_FreeFast()
Definition at line 872 of file ncbi_heapmgr.c.
References b, CORE_LOG_X, CORE_LOGF_X, eLOG_Error, eLOG_Warning, heap, HEAP_CHECK, HEAP_Free(), HEAP_INDEX, HEAP_ISUSED, HEAP_NEXT, likely, n, prev(), s_HEAP_fast, s_HEAP_Free(), s_HEAP_Id(), t, and unlikely.
◆ HEAP_Idle() ◆ HEAP_Next()
Definition at line 1234 of file ncbi_heapmgr.c.
References CORE_LOG_X, eLOG_Warning, heap, HEAP_CHECK, HEAP_ISUSED, n, s_HEAP_Walk(), and unlikely.
Referenced by LBSM_GetConfig(), LBSM_GetVersion(), LBSM_LookupHost(), and LBSM_LookupServiceEx().
◆ HEAP_Options() ◆ HEAP_Serial() ◆ HEAP_Size() ◆ HEAP_Trim()
Definition at line 932 of file ncbi_heapmgr.c.
References _HEAP_ALIGN_2, assert, b, CORE_LOGF_X, eLOG_Error, eLOG_Warning, heap, HEAP_BLOCKS, HEAP_CHECK, HEAP_EXTENT, HEAP_INDEX, HEAP_ISLAST, HEAP_ISUSED, HEAP_LAST, likely, prev(), s_HEAP_Collect(), s_HEAP_fast, s_HEAP_Id(), s_HEAP_Link(), and ncbi::grid::netcache::search::fields::size.
◆ HEAP_Used() ◆ HEAP_Walk() ◆ HINFO_AffinityArgument() ◆ HINFO_AffinityArgvalue() ◆ HINFO_CpuClock() ◆ HINFO_CpuCount() ◆ HINFO_CpuUnits() ◆ HINFO_Environment()
Obtain and return LB host environment.
LB host environment is a sequence of lines (separated by \n), all having form of "name=value", which is provided to and stored by the Load-Balancing and Service Mapping Daemon (LBSMD) in the configuration file on that host.
-
Parameters
-
host_info HOST_INFO as returned by the SERV API.
-
Returns
-
NULL if the host environment either cannot be obtained or does not exist; otherwise, a non-NULL pointer to a '\0'-terminated string that contains the environment, which remains valid until the handle "host_info" gets free()'d by the application.
-
See also
-
SERV_GetInfoEx, SERV_GetNextInfoEx
Definition at line 171 of file ncbi_host_info.c.
References SHostInfoTag::env, HINFO_MAGIC, and SHostInfoTag::pad.
◆ HINFO_HostAddr() ◆ HINFO_LoadAverage() ◆ HINFO_MachineParams() ◆ HINFO_Memusage()
Get memory usage data.
-
Parameters
-
host_info HOST_INFO as returned by the SERV API. memusage Memory usage in MB (filled in upon return):
- [0] = total RAM;
- [1] = discardable RAM (cached);
- [2] = free RAM;
- [3] = total swap;
- [4] = free swap.
-
Returns
-
Non-zero on success and store memory usage (MB, in the provided array "memusage"), or 0 if an error occurred ("memusage" cleared).
-
See also
-
SERV_GetInfoEx, SERV_GetNextInfoEx
Definition at line 121 of file ncbi_host_info.c.
References HINFO_MAGIC, LBSM_HINFO_Memusage(), and SHostInfoTag::pad.
◆ HINFO_PortUsage()
Obtain host port usage (currently only 4 first ports are published).
-
Parameters
-
host_info HOST_INFO as returned by the SERV API. ports Usage information to fill out count Number of array elements in "ports"
-
Returns
-
Return the number of port usage slots reported (may be zero if the host reports no port usage, can be less than "count" – remaining array elements cleared; or more than "count" if the host requires a bigger array that the one provided – all "count" elements have been filled in), or -1 when an error occurred ("ports" cleared).
-
Note
-
You may call this function with "ports" and "count" passed as 0 to learn how many array elements to expect.
-
See also
-
SERV_GetInfoEx, SERV_GetNextInfoEx
Definition at line 141 of file ncbi_host_info.c.
References count, HINFO_MAGIC, LBSM_HINFO_PortUsage(), and SHostInfoTag::pad.
◆ HINFO_Status() ◆ HINFO_TaskCount() ◆ Instance() ◆ IsEnabled() [1/2] bool CUsageReportAPI::IsEnabled ( void ) static ◆ IsEnabled() [2/2] bool CUsageReport::IsEnabled ( void )
Indicates whether application usage statistics collection is enabled for a current reporter instance.
Takes into account local status and global API setting as well.
-
See also
-
CUsageReportAPI::SetEnabled, SetEnabled
Definition at line 479 of file ncbi_usage_report.cpp.
References CUsageReportAPI::IsEnabled(), CUsageReport::m_IsEnabled, and CUsageReport::m_IsFinishing.
Referenced by CBlastUsageReport::AddParam(), BlastdbCopyApplication::BlastdbCopyApplication(), CBlastDBAliasApp::CBlastDBAliasApp(), CBlastDbCheckApplication::CBlastDbCheckApplication(), CBlastDBCmdApp::CBlastDBCmdApp(), CBlastdbConvertApp::CBlastdbConvertApp(), CBlastFormatterApp::CBlastFormatterApp(), CBlastFormatterVdbApp::CBlastFormatterVdbApp(), CBlastnApp::CBlastnApp(), CBlastpApp::CBlastpApp(), CBlastUsageReport::CBlastUsageReport(), CBlastVdbCmdApp::CBlastVdbCmdApp(), CBlastxApp::CBlastxApp(), CConvert2BlastMaskApplication::CConvert2BlastMaskApplication(), CDeltaBlastApp::CDeltaBlastApp(), CMagicBlastApp::CMagicBlastApp(), CMakeBlastDBApp::CMakeBlastDBApp(), CMakeClusterDBApp::CMakeClusterDBApp(), CMakeProfileDBApp::CMakeProfileDBApp(), CPsiBlastApp::CPsiBlastApp(), CRPSBlastApp::CRPSBlastApp(), CRPSTBlastnApp::CRPSTBlastnApp(), CTblastnApp::CTblastnApp(), CTblastxApp::CTblastxApp(), CVDBBlastnApp::CVDBBlastnApp(), CVDBTblastnApp::CVDBTblastnApp(), CIgBlastnApp::Init(), CIgBlastpApp::Init(), CBlastFormat::LogBlastSearchInfo(), CIgBlastnApp::Run(), CIgBlastpApp::Run(), CUsageReport::Send(), CMagicBlastApp::x_LogBlastSearchInfo(), CUsageReport::x_ThreadHandler(), and CBlastUsageReport::~CBlastUsageReport().
◆ OnStateChange() virtual void CUsageReportJob::OnStateChange ( EState ) inlinevirtual ◆ operator=() [1/3] ◆ operator=() [2/3] ◆ operator=() [3/3] ◆ Send() [1/3]
Report usage statistics (asynchronously).
Send usage statistics with specified parameters in background, without blocking current thread execution.
-
Parameters
-
params Specifies extra parameters to report, in addition to default parameters specified in the CUsageReport constructor. The reporter copy parameters before asynchronously reporting them in background, so parameters object can be freely changed or destroyed after this call.
-
Note
-
This version do nothing on errors. If you want to control reporting progress and results you can use Send(CUsageReportJob&) version with your own class derived from CUsageReportJob.
-
See also
-
CUsageReportParameters, CUsageReportJob, TWhat, SetEnabled(), Wait()
Definition at line 557 of file ncbi_usage_report.cpp.
References CUsageReport::IsEnabled(), and CUsageReport::x_SendAsync().
◆ Send() [2/3]
template<typename TJob >
void CUsageReport::Send ( TJob & job ) inline ◆ Send() [3/3] void CUsageReport::Send ( void ) ◆ SERV_Close()
Deallocate the iterator.
Must be called to finish the lookup process.
-
Warning
-
Invalidates all previosuly issued server descriptors (SSERV_Info*).
-
Parameters
-
iter An iterator handle obtained via a "SERV_Open*" call.
-
Note
-
NULL is accepted, and causes no actions.
-
See also
-
SERV_OpenEx, SERV_Reset
Definition at line 1066 of file ncbi_service.c.
References SSERV_VTable::Close, free(), i, SSERV_IterTag::n_skip, SSERV_IterTag::name, SSERV_IterTag::op, SERV_Reset(), and SSERV_IterTag::skip.
Referenced by DBLB_GetServer(), SServIterDeleter::Delete(), CServiceDiscovery::DiscoverImpl(), CDBLB_ServiceMapper::GetServerOptions(), CDBLB_ServiceMapper::GetServersList(), s_CloseDispatcher(), s_Open(), SERV_GetInfoP(), SERV_GetServers(), CConnTest::ServiceOkay(), CConnTest::StatefulOkay(), and x_Open().
◆ SERV_CopyInfo() ◆ SERV_CreateDnsInfo() ◆ SERV_CreateFirewallInfo() ◆ SERV_CreateHttpInfo() ◆ SERV_CreateNcbidInfo() SSERV_Info* SERV_CreateNcbidInfo ( unsigned int host, unsigned short port, const char * args ) ◆ SERV_CreateStandaloneInfo() SSERV_Info* SERV_CreateStandaloneInfo ( unsigned int host, unsigned short port ) ◆ SERV_EqualInfo()
Definition at line 640 of file ncbi_server_info.c.
References SSERV_Info::addr, assert, SSERV_Ops::Equal, SSERV_Info::host, NcbiIsEmptyIPv6(), SSERV_Attr::ops, SSERV_Info::port, s_GetAttrByType(), SSERV_Info::type, and SSERV_Info::u.
Referenced by s_AddServerInfo(), s_AddSkipInfo(), s_GetNextInfo(), SServerScanInfo::SkipServer(), x_AddInfo(), x_ConsistencyCheck(), and x_Finalize().
◆ SERV_GetImplicitServerType() ◆ SERV_GetInfo()
Same as "SERV_GetInfoEx(., ., ., ., 0, 0, 0)" – i.e.
w/o the "skip" array, and w/o "host_info".
-
See also
-
SERV_GetInfoEx, SERV_Open
Definition at line 970 of file ncbi_service.c.
References SERV_GetInfoP(), and types.
Referenced by CEUtils_Request::GetBaseURL(), and CEutilsClient::x_GetHostName().
◆ SERV_GetInfoEx()
A "fast track" routine equivalent to creating of an iterator as with SERV_OpenEx(), and then taking an info as with SERV_GetNextInfoEx().
However, this call is optimized for an application, which only needs a single entry (the first one), and which is not interested in iterating over all available instances. Both the returned server-info and host information (if any) have to be explicitly free()'d by the application when no longer needed.
-
Parameters
-
service A service name (may not be NULL or empty). types A bitset of type(s) of servers requested. preferred_host Preferred host to use the service at, nbo. net_info Connection information (NULL disables network-based dispatching via LINKERD, NAMERD, and DISPD) skip[] An array of servers NOT to select, see SERV_OpenEx() for notes. n_skip Number of entries in the "skip" array. host_info An optional pointer to store host info at (may be NULL).
-
Note
-
The host information is provided only (if at all) if this call returns a non-NULL result, see SERV_OpenEx() for notes.
-
Returns
-
First matching server-info (non-NULL), or NULL if no instances found.
-
See also
-
SERV_GetInfo, SERV_OpenEx
Definition at line 984 of file ncbi_service.c.
References SERV_GetInfoP(), and types.
◆ SERV_GetInfoSimple()
Equivalent to "SERV_GetInfo(., fSERV_Any, SERV_ANYHOST, ConnNetInfo_Create(service))", but it takes care not to leak its last "net_info" parameter, which it builds on the fly.
-
See also
-
SERV_GetInfo, SERV_OpenSimple
Definition at line 956 of file ncbi_service.c.
References ConnNetInfo_Create(), ConnNetInfo_Destroy(), fSERV_Any, info, SERV_ANYHOST, and SERV_GetInfoP().
◆ SERV_GetNextInfo()
Same as "SERV_GetNextInfoEx(., 0)" – i.e.
w/o the host information.
-
See also
-
SERV_GetNextInfoEx
Definition at line 1009 of file ncbi_service.c.
References assert, SSERV_IterTag::op, and s_GetNextInfo().
Referenced by DBLB_GetServer(), CDBLB_ServiceMapper::GetServersList(), s_GetNextInfo(), LbsmLookup::s_Resolve(), s_ScanInfoGetNextInfo(), SERV_GetServers(), CConnTest::ServiceOkay(), CConnTest::StatefulOkay(), CDBLBClientApp::x_RunWhatIs(), and CDBLBClientApp::x_RunWhereIs().
◆ SERV_GetNextInfoEx()
Get the next server meta-address, optionally accompanied by the host parameters made available by the LB daemon (LBSMD).
-
Parameters
-
iter An iterator handle obtained via a "SERV_Open*" call.
-
Note
-
NULL is accepted, and results in NULL returned.
-
Parameters
-
host_info An optional pointer to store host info at (may be NULL).
-
Returns
-
NULL if no more servers have been found for the service requested (the pointer to "host_info" remains untouched in this case); otherwise, a non-NULL pointer to the server meta address.
-
Note
-
The returned server-info is valid only until either of the two events: 1. SERV_GetNextInfo[Ex]() is called with this iterator again; or 2. The iterator reset / closed (SERV_Reset() / SERV_Close() called).
-
Application program should NOT destroy the returned server-info as it is managed automatically by the iterator.
-
Resulting DNS-type server-info (only if coming out for the first time) may contain 0 in the host field to denote that the name exists but the service is currently not serving (down / unavailable).
-
Only when completing successfully, i.e. returning a non-NULL info, this call can also provide host information as the following: if "host_info" parameter is passed as a non-NULL pointer, then a copy of host information may be allocated, and the handle is then stored at "*host_info" when the host information is available for the host. Otherwise, the pointer is updated with a NULL value stored. Using the non-NULL handle returned, various parameters like load, environment, number of CPUs, etc can be retrieved (see ncbi_host_info.h). The returned host information handle has to be explicitly free()'d when no longer needed.
-
See also
-
SERV_Reset, SERV_Close, SERV_GetInfoEx, ncbi_host_info.h
Definition at line 1001 of file ncbi_service.c.
References assert, SSERV_IterTag::op, and s_GetNextInfo().
Referenced by CServiceDiscovery::DiscoverImpl(), and CDBLB_ServiceMapper::GetServerOptions().
◆ SERV_Open()
Same as "SERV_OpenEx(., ., ., ., 0, 0)" – i.e.
w/o the "skip" array.
-
See also
-
SERV_OpenEx
Definition at line 882 of file ncbi_service.c.
References s_Open(), and types.
Referenced by DBLB_GetServer(), CDBLB_ServiceMapper::GetServerOptions(), CDBLB_ServiceMapper::GetServersList(), s_OpenDispatcher(), LbsmLookup::s_Resolve(), SERV_GetServers(), CDBLBClientApp::x_RunWhatIs(), and CDBLBClientApp::x_RunWhereIs().
◆ SERV_OpenEx()
Create an iterator for sequential server lookup.
-
Note
-
'nbo' in comments denotes parameters coming in network byte order; 'hbo' stands for 'host byte order'.
-
Parameters
-
service A service name, may not be NULL or empty. types A bitset of type(s) of servers requested. preferred_host Preferred host to use the service at, nbo. net_info Connection information (NULL prevents the use of the network-based dispatching via LINKERD, NAMERD, and DISPD)
-
Note
-
If "net_info" is NULL, only the following mappers will be consulted: LOCAL(if enabled, see below), LBSMD, and LBDNS. If "net_info" is not NULL, the above mappers are consulted first, followed by LINKERD, NAMERD, and DISPD (using the connection information provided) but only if mapping with the preceding mapper(s), if any occurred, has failed.
-
The registry section [CONN], keys: LOCAL_ENABLE, LBSMD_DISABLE, LBDNS_ENABLE, LINKERD_ENABLE, NAMERD_ENABLE, DISPD_DISABLE which can be overridden by the environment variables: CONN_LOCAL_ENABLE, CONN_LBSMD_DISABLE, CONN_LBDNS_ENABLE, CONN_LINKERD_ENABLE, CONN_NAMERD_ENABLE, and CONN_DISPD_DISABLE can be used to add(for LOCAL, LBDNS, LINKERD, NAMERD) or to skip (for LBSMD and DISPD) the corresponding service mapper(s). This scheme permits to use any combination of the service mappers (local/lbsmd/ lbdns/linkerd/namerd/dispd, network-aware or not). These keys can also be used for even more granular, per-service basis, as described in <connect/ncbi_connutil.h> – when used in the registry section '[service]' or prefixed with the service name in the process environment.
-
If "net_info" is not NULL then a non-zero value of "net_info->stateless" forces "types" to get the "fSERV_Stateless" bit set implicitly.
-
Parameters
-
skip An array of servers NOT to select: contains server-info elements that are not to return from the search (whose server-infos match the would-be result).
-
Note
-
However, special additional rules apply to the "skip" elements when the fSERV_ReverseDns bit is set in the "types" parameter: the result-to-be is not considered if either 1. There is an entry of the fSERV_Dns type found in "skip" array that matches the host[:port] (any port if the skip entry's port is 0); or 2. The reverse lookup of the host:port turns up an fSERV_Dns-type server whose name matches an fSERV_Dns-type server in "skip".
-
Parameters
-
n_skip Number of entries in the "skip" array.
-
Returns
-
Non-NULL iterator, or NULL if the service does not exist.
-
Note
-
Non-NULL iterator does not guarantee the service operational, it merely acknowledges the service existence.
-
See also
-
SERV_GetNextInfoEx, SERV_Reset, SERV_Close, ConnNetInfo_Create
Definition at line 895 of file ncbi_service.c.
References s_Open(), and types.
◆ SERV_OpenSimple()
Allocate an iterator and consult either local databases (if any present), or network database, using all default communication parameters found both in the registry and the environment variables (as if having an implicit parameter "net_info" created with "ConnNetInfo_Create(service)").
-
Note
-
No preferred host is set in the target iterator.
-
Parameters
-
service A service name (may not be NULL or empty).
-
Returns
-
Non-NULL iterator, or NULL if the service does not exist.
-
Note
-
Non-NULL iterator does not guarantee the service operational, it merely acknowledges the service existence.
-
See also
-
SERV_GetNextInfoEx, SERV_OpenEx, SERV_Reset, SERV_Close, ConnNetInfo_Create
Definition at line 868 of file ncbi_service.c.
References ConnNetInfo_Create(), ConnNetInfo_Destroy(), fSERV_Any, s_Open(), and SERV_ANYHOST.
Referenced by CConnTest::ServiceOkay(), and CConnTest::StatefulOkay().
◆ SERV_Penalize()
Penalize the server returned last from SERV_GetNextInfo[Ex]().
-
Parameters
-
iter An iterator handle obtained via a "SERV_Open*" call. fine A fine value in the range [0=min..100=max] (%%), inclusive.
-
Returns
-
Return 0 if failed, non-zero if successful.
-
See also
-
SERV_OpenEx, SERV_GetNextInfoEx
Definition at line 1039 of file ncbi_service.c.
References SERV_PenalizeEx().
◆ SERV_PenalizeEx() ◆ SERV_ReadInfo() ◆ SERV_ReadType() ◆ SERV_Rerate() ◆ SERV_Reset() ◆ SERV_ServerPort() unsigned short SERV_ServerPort ( const char * name, unsigned int host )
Obtain a port number that corresponds to the named (standalone) service declared at the specified host (per the LB configuration information).
-
Parameters
-
name Service name (of type fSERV_Standalone) to look up. host Host address (or SERV_LOCALHOST, or 0, same) to look the service up at.
-
Returns
-
The port number or 0 on error (no suitable service found).
-
Note
-
The call returns the first match, and does not check whether an application is already running at the returned port (i.e. regardless of whether or not the service is currently up).
-
See also
-
ESERV_Type, SERV_OpenEx, LSOCK_CreateEx
Definition at line 1273 of file ncbi_service.c.
References assert, eDefault, free(), fSERV_Promiscuous, fSERV_Standalone, info, SERV_GetInfoP(), SERV_LOCALHOST, and SOCK_GetLocalHostAddress().
◆ SERV_SetImplicitServerType()
Set a server type to use when a service mapper returns typeless entries for the given service name (typed entries retain their types as received).
-
Note
-
Current implementation of this call tries to store the association in the application's registry as a transient setting. Only if that has failed, then it proceeds to store the association in the application environment.
-
Implicit server type designation is managed the same way as any other service-related parameters from <connect/ncbi_connutil.h>: this one is using the REG_CONN_IMPLICIT_SERVER_TYPE key.
-
Returns
-
0 if failed; non-zero if succeeded
-
See also
-
ConnNetInfo_GetValue, SERV_GetImplicitServerType
Definition at line 1300 of file ncbi_service.c.
References buf, CONN_IMPLICIT_SERVER_TYPE, CORE_LOCK_WRITE, CORE_REG_SET, CORE_UNLOCK, eREG_Transient, free(), len, putenv, SERV_ServiceName(), SERV_TypeStr(), setenv, strupr, and x_mkenv().
◆ SERV_SizeOfInfo() ◆ SERV_TypeStr()
Definition at line 122 of file ncbi_server_info.c.
References s_GetAttrByType(), and SSERV_Attr::tag.
Referenced by LBSM_SubmitPenaltyOrRerate(), s_Firewall_Write(), s_LookupHost(), s_ParseResponse(), s_Resolve(), SERV_GetServers(), SERV_LBNULL_Open(), SERV_Print(), SERV_SetImplicitServerType(), CDBLBClientApp::x_InitWhereIs(), CDBLBClientApp::x_RunWhatIs(), and CDBLBClientApp::x_RunWhereIs().
◆ SERV_WriteInfo()
Definition at line 145 of file ncbi_server_info.c.
References assert, CONN_CONTENT_TYPE_LEN, eSERV_Blast, eSERV_Regular, fabs, free(), fSERV_Dns, fSERV_Http, fSERV_Interzone, fSERV_Local, fSERV_Private, fSERV_Secure, fSERV_Stateful, if(), info, SSERV_Attr::len, MAX_IP_ADDR_LEN, memmove, MIME_ComposeContentTypeEx(), n, NCBI_simple_ftoa(), NcbiAddrToString(), NcbiIsIPv4(), SSERV_Attr::ops, s_GetAttrByType(), ncbi::grid::netcache::search::fields::size, SSERV_Ops::SizeOf, SOCK_HostPortToString(), SOCK_HostToNetLong(), str(), SSERV_Attr::tag, and SSERV_Ops::Write.
Referenced by s_GetNextInfo(), s_Resolve(), SERV_Print(), x_AddInfo(), x_ConsistencyCheck(), x_Finalize(), and x_SetupFromNamerd().
◆ SetAppName() void CUsageReportAPI::SetAppName ( const string & name ) static ◆ SetAppVersion() [1/2] ◆ SetAppVersion() [2/2] void CUsageReportAPI::SetAppVersion ( const string & version ) static ◆ SetDefaultParameters() void CUsageReportAPI::SetDefaultParameters ( TWhat what = fDefault
) static ◆ SetEnabled() [1/2] void CUsageReportAPI::SetEnabled ( bool enable = true
) static
Enable or disable usage statistics reporting globally for all reporters.
This is an only an API method that affects all reporters, even already created. Also, you can enable/disable reporting for each reporter separately, but only if global API is enabled. Global settings have a priority over local status of any reporter.
-
Note
-
The usage reporting is disabled by default.
-
Enabling/disabling reporting can be done using the global parameter: Registry file: [USAGE_REPORT] Enabled = true/false Environment variable: NCBI_USAGE_REPORT_ENABLED=1/0 DO_NOT_TRACK If DO_NOT_TRACK environment variable is set to any value other than 0, FALSE, NO, or OFF (case-insensitive), it disables reporting as well. DO_NOT_TRACK=1 It have priority over NCBI_USAGE_REPORT_ENABLED. See Console Do Not Track standard: https://consoledonottrack.com/.
-
See also
-
SetEnabled(), CUsageReport
Definition at line 148 of file ncbi_usage_report.cpp.
References gs_IsEnabled.
Referenced by CUsageReportSampleApp::ConfigureAPI(), and CBlastUsageReport::x_CheckBlastUsageEnv().
◆ SetEnabled() [2/2] void CUsageReport::SetEnabled ( bool enable = true
) inline ◆ SetMaxQueueSize() void CUsageReportAPI::SetMaxQueueSize ( unsigned n ) static
Declare the maximum reporting jobs queue size per reporter.
Minimum value is 1. Value 0 sets queue to predefined size. Maximum value is unspecified, but be aware that too big queue size takes more memory and affects reporting accuracy. All requests processes on first-in-first-out base, and if queue is almost full, some newly added reports can become obsolete before the reporter can send it to server.
Affects all reporters created afterwards only. Used by CUsageReport::Send() method.
-
Note
-
Can be specified thought the global parameter: Registry file: [USAGE_REPORT] MaxQueueSize = ... Environment variable: NCBI_USAGE_REPORT_MAXQUEUESIZE=...
-
Parameters
-
Maximum number of reporting jobs in the queue per reporter. 0 - (re)set to default value.
-
See also
-
GetMaxQueueSize, CUsageReport::Send()
Definition at line 211 of file ncbi_usage_report.cpp.
References kDefault_MaxQueueSize, n, and NCBI_PARAM_TYPE.
Referenced by CUsageReportSampleApp::ConfigureAPI().
◆ SetRetries() void CUsageReportAPI::SetRetries ( int retries ) static
Set muximum number of retries in case of error reporting.
By default CUsageReport uses number of tries specified for the Connect API. This call allow ro override default Connect API values, or specified using $CONN_MAX_TRY environment variable, or [CONN]MAX_TRY registry value. Zero number mean no-retries, so any connection will be tried to establish only once. Any negative value set default number of tries specified for the Connect API.
-
Note
-
Can be specified thought the global parameter: Registry file: [USAGE_REPORT] ConnectionMaxTry = ... Environment variable: NCBI_USAGE_REPORT_CONN_MAX_TRY=...
-
See also
-
CheckConnection, SetTimeout, GetRetries
Definition at line 248 of file ncbi_usage_report.cpp.
References NCBI_PARAM_TYPE.
Referenced by CBlastUsageReport::CBlastUsageReport(), and CUsageReportSampleApp::ConfigureAPI().
◆ SetTimeout()
Set timeout for connection.
By default CUsageReport uses connection timeout specified for the Connect API. This call allow to override default Connect API values, or specified using $CONN_TIMEOUT environment variable, or [CONN]TIMEOUT registry value. Allow any timeout values except eInfinite.
-
Note
-
Can be specified thought the global parameter: Registry file: [USAGE_REPORT] ConnTimeout = <float-number-in-seconds> Environment variable: NCBI_USAGE_REPORT_CONN_TIMEOUT=<float-number-in-seconds>
-
See also
-
CheckConnection, GetTimeout, SetRetries
Definition at line 225 of file ncbi_usage_report.cpp.
References CTimeout::GetAsDouble(), CTimeout::IsDefault(), CTimeout::IsFinite(), CTimeout::IsZero(), kDefault_ConnTimeout, NCBI_PARAM_TYPE, and NCBI_THROW.
Referenced by CBlastUsageReport::CBlastUsageReport(), and CUsageReportSampleApp::ConfigureAPI().
◆ SetURL() ◆ ToString() string CUsageReportParameters::ToString ( void ) const ◆ Wait()
Wait until all queued jobs starts to process and queue is empty.
Can be called before Finish() to be sure that all queued requests are processed and nothing is discarded.
-
Parameters
-
now Specify what to do in the case if no inernet connection detected, and all previos jobs were failed to be reported. By default it will try to send jobs until queue is empty. But you have an option to skip remaining jobs in the queue and just exit from the function. All jobs will remain in the queue, awaiting to be reported until you call Finish() or ClearQueue(). timeout Specifies a timeout to wait. By default, if not redefined, the timeout is infinite. Default value can be redefined using the global parameter: Registry file: [USAGE_REPORT] WaitTimeout = <float-number-in-seconds> Environment variable: NCBI_USAGE_REPORT_WAIT_TIMEOUT=<float-number-in-seconds> Negative value sets infinite timeout.
Waiting time depends on a connection timeout, and can be greater than specified 'timeout'. Real waiting time is a maximum of 'timeout' and connection timeout, see CUsageReport::SetTimeout().
-
Note
-
It doesn't wait for already started job that is sending at the current moment, even if the queue is empty. You still need to call Finish() to be sure that it has been finished too.
-
See also
-
EWait, CTimeout, Finish, ClearQueue, CUsageReport::SetTimeout()
Definition at line 603 of file ncbi_usage_report.cpp.
References CTimeout::eInfinite, CTimeout::IsDefault(), CUsageReport::m_IsFinishing, CUsageReport::m_IsWaiting, CUsageReport::m_Queue, CUsageReport::m_ThreadSignal, CUsageReport::m_ThreadSignal_Mutex, CUsageReport::m_WaitDeadline, CUsageReport::m_WaitMode, MT_GUARD, NCBI_PARAM_TYPE, and CTimeout::Set().
Referenced by CUsageReportSampleApp::Pattern_2_MultipleReporters(), and CBlastUsageReport::~CBlastUsageReport().
◆ x_ClearQueue() void CUsageReport::x_ClearQueue ( void ) private ◆ x_CopyFrom() [1/2] ◆ x_CopyFrom() [2/2] ◆ x_Send() ◆ x_SendAsync() void CUsageReport::x_SendAsync ( TJobPtr job_ptr ) private
Send job asynchronously.
Definition at line 512 of file ncbi_usage_report.cpp.
References _ASSERT, CUsageReportJob::eQueued, CUsageReportJob::eRejected, ERR_POST_ONCE, CUsageReport::m_MaxQueueSize, CUsageReport::m_Queue, CUsageReport::m_Thread, CUsageReport::m_ThreadSignal, MT_GUARD, CUsageReport::SetEnabled(), Warning(), CUsageReportJob::x_SetState(), and CUsageReport::x_ThreadHandler().
Referenced by CUsageReport::Send().
◆ x_SetState() void CUsageReportJob::x_SetState ( EState state ) protected ◆ x_ThreadHandler() void CUsageReport::x_ThreadHandler ( void ) private
Thread handler for asynchronous job reporting.
Definition at line 696 of file ncbi_usage_report.cpp.
References CUsageReportJob::eCompleted, CUsageReportJob::eFailed, CUsageReportJob::eRunning, CUsageReport::eSkipIfNoConnection, CUsageReport::IsEnabled(), CDeadline::IsExpired(), CUsageReport::m_CountSent, CUsageReport::m_CountTotal, CUsageReport::m_IsFinishing, CUsageReport::m_IsWaiting, CUsageReport::m_Queue, CUsageReport::m_ThreadSignal, CUsageReport::m_ThreadSignal_Mutex, CUsageReport::m_WaitDeadline, CUsageReport::m_WaitMode, MT_GUARD, CUsageReportParameters::ToString(), CUsageReport::x_ClearQueue(), CUsageReport::x_Send(), and CUsageReportJob::x_SetState().
Referenced by CUsageReport::x_SendAsync().
◆ ~CUsageReport() CUsageReport::~CUsageReport ( void ) virtual ◆ ~CUsageReportJob() virtual CUsageReportJob::~CUsageReportJob ( void ) inlinevirtual ◆ _pad ◆ addr ◆ algo ◆ arch ◆ args [1/2] ◆ args [2/2] ◆ bits ◆ bootup ◆ coef ◆ struct { ... } SHINFO_Params::daemon ◆ dns ◆ extra ◆ firewall ◆ flag unsigned int SHEAP_Block::flag ◆ host unsigned int SSERV_Info::host
Definition at line 162 of file ncbi_server_info.h.
Referenced by DBLB_GetServer(), CDBLB_ServiceMapper::GetServerOptions(), CDBLB_ServiceMapper::GetServersList(), LBSM_LookupServiceEx(), s_GetNextInfo(), s_LookupHost(), s_SkipSkip(), SERV_EqualInfo(), x_Finalize(), CDBLBClientApp::x_RunWhatIs(), CDBLBClientApp::x_RunWhereIs(), and x_UpdateHost().
◆ http ◆ struct { ... } SHINFO_Params::kernel ◆ m_CountSent size_t CUsageReport::m_CountSent private ◆ m_CountTotal size_t CUsageReport::m_CountTotal private ◆ m_DefaultParams string CUsageReport::m_DefaultParams private ◆ m_IsEnabled bool CUsageReport::m_IsEnabled mutableprivate ◆ m_IsFinishing bool CUsageReport::m_IsFinishing mutableprivate ◆ m_IsWaiting bool CUsageReport::m_IsWaiting mutableprivate ◆ m_MaxQueueSize unsigned CUsageReport::m_MaxQueueSize private ◆ m_Params ◆ m_Queue list<TJobPtr> CUsageReport::m_Queue private ◆ m_State EState CUsageReportJob::m_State private ◆ m_Thread std::thread CUsageReport::m_Thread private ◆ m_ThreadSignal std::condition_variable CUsageReport::m_ThreadSignal private ◆ m_ThreadSignal_Mutex std::mutex CUsageReport::m_ThreadSignal_Mutex private ◆ m_URL ◆ m_Usage_Mutex std::mutex CUsageReport::m_Usage_Mutex private ◆ m_WaitDeadline ◆ m_WaitMode EWait CUsageReport::m_WaitMode private ◆ [1/3] ◆ major [2/3] unsigned short SHINFO_Params::major ◆ [3/3] ◆ mime_e ◆ mime_s ◆ mime_t ◆ [1/3] ◆ minor [2/3] unsigned short SHINFO_Params::minor ◆ [3/3] ◆ mode ◆ name ◆ ncbid ◆ ostype ◆ [1/3] ◆ patch [2/3] unsigned short SHINFO_Params::patch ◆ [3/3] ◆ path ◆ pgsize size_t SHINFO_Params::pgsize ◆ port [1/2] unsigned short SHINFO_PortUsage::port ◆ port [2/2] unsigned short SSERV_Info::port ◆ rate ◆ site ◆ size ◆ standalone ◆ startup ◆ svcpack unsigned short SHINFO_Params::svcpack ◆ time ◆ type [1/2] ◆ type [2/2] ◆ u ◆ used double SHINFO_PortUsage::used ◆ vhost ◆ CUsageReport [1/2] ◆ CUsageReport [2/2] ◆ CUsageReportAPI
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